@ozdao/prometheus-framework 0.2.200 → 0.2.202
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/prometheus-framework/src/components/Address/Address.vue.cjs +113 -1
- package/dist/prometheus-framework/src/components/Address/Address.vue.cjs.map +1 -0
- package/dist/prometheus-framework/src/components/Address/Address.vue.js +76 -51
- package/dist/prometheus-framework/src/components/Address/Address.vue.js.map +1 -0
- package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs +133 -1
- package/dist/prometheus-framework/src/components/Button/Button.vue2.cjs.map +1 -0
- package/dist/prometheus-framework/src/components/Button/Button.vue2.js +82 -44
- package/dist/prometheus-framework/src/components/Button/Button.vue2.js.map +1 -0
- package/dist/prometheus-framework/src/components/Chips/Chips.vue.cjs +32 -1
- package/dist/prometheus-framework/src/components/Chips/Chips.vue.cjs.map +1 -0
- package/dist/prometheus-framework/src/components/Chips/Chips.vue.js +20 -14
- package/dist/prometheus-framework/src/components/Chips/Chips.vue.js.map +1 -0
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.cjs +64 -1
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.cjs.map +1 -0
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.js +45 -38
- package/dist/prometheus-framework/src/components/Dropdown/Dropdown.vue.js.map +1 -0
- package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs +121 -1
- package/dist/prometheus-framework/src/components/Field/Field.vue2.cjs.map +1 -0
- package/dist/prometheus-framework/src/components/Field/Field.vue2.js +97 -76
- package/dist/prometheus-framework/src/components/Field/Field.vue2.js.map +1 -0
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.cjs +1 -1
- package/dist/prometheus-framework/src/components/FieldBig/FieldBig.vue.js +1 -1
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue.cjs +169 -1
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue.cjs.map +1 -0
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue.js +125 -82
- package/dist/prometheus-framework/src/components/LocationMarker/LocationMarker.vue.js.map +1 -0
- package/dist/prometheus-framework/src/components/Menu/Menu.vue.cjs +17 -1
- package/dist/prometheus-framework/src/components/Menu/Menu.vue.cjs.map +1 -0
- package/dist/prometheus-framework/src/components/Menu/Menu.vue.js +11 -7
- package/dist/prometheus-framework/src/components/Menu/Menu.vue.js.map +1 -0
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs +92 -1
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.cjs.map +1 -0
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js +69 -54
- package/dist/prometheus-framework/src/components/Popup/Popup.vue2.js.map +1 -0
- package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs +127 -1
- package/dist/prometheus-framework/src/components/Select/Select.vue2.cjs.map +1 -0
- package/dist/prometheus-framework/src/components/Select/Select.vue2.js +75 -51
- package/dist/prometheus-framework/src/components/Select/Select.vue2.js.map +1 -0
- package/dist/prometheus-framework/src/modules/auth/views/components/layouts/Auth.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/layouts/Auth.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/EnterCode.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/EnterCode.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/EnterPassword.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/EnterPassword.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/Invite.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/Invite.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/ResetPassword.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/ResetPassword.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignIn.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignIn.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignUp.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/auth/views/components/pages/SignUp.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/pages/Dashboard.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/partials/Sidebar.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/backoffice/components/partials/Sidebar.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/community/components/pages/Community.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/community/components/pages/CreateBlogPost.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/community/components/sections/HotPosts.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/constructor/components/elements/Embed.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonCheck.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/events/components/elements/ButtonJoin.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEvent.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/events/components/pages/EditEventTickets.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/gallery/components/sections/BackofficeGallery.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/globals/views/components/blocks/BlockSearch.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/blocks/BlockSearch.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/blocks/CardHeader.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/blocks/CardHeader.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.cjs.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/layouts/Client.vue.js.map +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/Header.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/LocationSelection.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/LocationSelection.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/globals/views/components/partials/NavigationBar.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.cjs +3 -3
- package/dist/prometheus-framework/src/modules/legal/components/pages/Legal.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/orders/components/pages/OrderCreateBackoffice.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormAddCustomer.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormCustomerDetails.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.cjs +3 -3
- package/dist/prometheus-framework/src/modules/orders/components/sections/FormDelivery.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/elements/ButtonToggleMembership.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.cjs +4 -4
- package/dist/prometheus-framework/src/modules/organizations/components/pages/DepartmentEdit.vue.js +4 -4
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Members.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/Organization.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationBackoffice.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/pages/OrganizationEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Documents.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/MembersAdd.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/organizations/components/sections/Organizations.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/pages/views/components/blocks/CardPage.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/pages/views/components/blocks/CardPage.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/pages/views/components/pages/PageEdit.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/pages/views/components/pages/PageEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/pages/views/components/partials/SidebarPages.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/pages/views/components/partials/SidebarPages.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/CardPosition.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/LeftoverPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/blocks/ListPositions.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/Categories.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/products/components/pages/CategoryEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/EditLeftover.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/products/components/pages/ProductEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditModifications.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/products/components/sections/EditProductInfo.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/products/components/sections/SectionProduct.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/reports/components/sections/FormReport.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/blocks/SpotMemberModify.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/layouts/Spots.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/Map.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.cjs +4 -4
- package/dist/prometheus-framework/src/modules/spots/components/pages/SpotEdit.vue.js +4 -4
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.cjs +3 -3
- package/dist/prometheus-framework/src/modules/users/components/pages/Profile.vue.js +3 -3
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.cjs +2 -2
- package/dist/prometheus-framework/src/modules/users/components/pages/ProfileEdit.vue.js +2 -2
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CardDeposit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/blocks/CryptoDeposit.vue.js +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.cjs +1 -1
- package/dist/prometheus-framework/src/modules/wallet/views/components/pages/Wallet.vue.js +1 -1
- package/package.json +1 -1
- package/src/modules/globals/views/components/layouts/Client.vue +2 -2
@@ -1 +1,113 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
3
|
+
const vue = require("vue");
|
4
|
+
const index = require("../../../../node_modules/@googlemaps/js-api-loader/dist/index.cjs");
|
5
|
+
;/* empty css */
|
6
|
+
const _hoisted_1 = {
|
7
|
+
key: 0,
|
8
|
+
class: "t-transp mn-r-small"
|
9
|
+
};
|
10
|
+
const _hoisted_2 = ["placeholder", "value"];
|
11
|
+
const _hoisted_3 = {
|
12
|
+
key: 0,
|
13
|
+
class: "mn-t-thin invalid-feedback"
|
14
|
+
};
|
15
|
+
const _sfc_main = {
|
16
|
+
__name: "Address",
|
17
|
+
props: {
|
18
|
+
apiKey: {
|
19
|
+
type: String,
|
20
|
+
required: true
|
21
|
+
},
|
22
|
+
label: null,
|
23
|
+
placeholder: "Enter something here",
|
24
|
+
field: null,
|
25
|
+
location: {
|
26
|
+
type: Object,
|
27
|
+
default: { lat: 48.6900735, lng: 41.1620239 }
|
28
|
+
},
|
29
|
+
address: {
|
30
|
+
type: String,
|
31
|
+
default: ""
|
32
|
+
},
|
33
|
+
locale: {
|
34
|
+
type: String,
|
35
|
+
default: "en"
|
36
|
+
}
|
37
|
+
},
|
38
|
+
emits: ["update:address", "update:location", "update:country", "update:state", "update:city"],
|
39
|
+
setup(__props, { emit: __emit }) {
|
40
|
+
const props = __props;
|
41
|
+
const emit = __emit;
|
42
|
+
const addressInput = vue.ref(null);
|
43
|
+
let autocomplete;
|
44
|
+
const onPlaceChanged = () => {
|
45
|
+
const place = autocomplete.getPlace();
|
46
|
+
if (!place.geometry || !place.address_components) {
|
47
|
+
return;
|
48
|
+
}
|
49
|
+
let country = "", state = "", city = "";
|
50
|
+
for (let i = 0; i < place.address_components.length; i++) {
|
51
|
+
let addr = place.address_components[i];
|
52
|
+
if (addr.types.includes("country")) {
|
53
|
+
country = addr.long_name;
|
54
|
+
}
|
55
|
+
if (addr.types.includes("administrative_area_level_1")) {
|
56
|
+
state = addr.long_name;
|
57
|
+
}
|
58
|
+
if (addr.types.includes("locality")) {
|
59
|
+
city = addr.long_name;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
const newAddress = place.formatted_address;
|
63
|
+
const newLocation = { lat: place.geometry.location.lat(), lng: place.geometry.location.lng() };
|
64
|
+
emit("update:address", newAddress);
|
65
|
+
emit("update:location", newLocation);
|
66
|
+
emit("update:country", country);
|
67
|
+
emit("update:state", state);
|
68
|
+
emit("update:city", city);
|
69
|
+
};
|
70
|
+
vue.onMounted(() => {
|
71
|
+
const loader = new index.Loader({
|
72
|
+
apiKey: props.apiKey,
|
73
|
+
version: "weekly",
|
74
|
+
libraries: ["places"],
|
75
|
+
language: props.locale
|
76
|
+
});
|
77
|
+
loader.load().then(() => {
|
78
|
+
autocomplete = new google.maps.places.Autocomplete(addressInput.value);
|
79
|
+
autocomplete.addListener("place_changed", onPlaceChanged);
|
80
|
+
}).catch((e) => {
|
81
|
+
console.error(e);
|
82
|
+
});
|
83
|
+
});
|
84
|
+
return (_ctx, _cache) => {
|
85
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
86
|
+
class: vue.normalizeClass([_ctx.$attrs.class, "flex-nowrap flex"])
|
87
|
+
}, [
|
88
|
+
__props.label ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
89
|
+
vue.createElementVNode("span", null, vue.toDisplayString(__props.label), 1)
|
90
|
+
])) : vue.createCommentVNode("", true),
|
91
|
+
vue.createElementVNode("input", {
|
92
|
+
ref_key: "addressInput",
|
93
|
+
ref: addressInput,
|
94
|
+
class: "w-100",
|
95
|
+
placeholder: __props.placeholder,
|
96
|
+
value: __props.address,
|
97
|
+
onInput: _cache[0] || (_cache[0] = (...args) => _ctx.onInput && _ctx.onInput(...args))
|
98
|
+
}, null, 40, _hoisted_2),
|
99
|
+
vue.createVNode(vue.Transition, {
|
100
|
+
mode: "out-in",
|
101
|
+
name: "fade"
|
102
|
+
}, {
|
103
|
+
default: vue.withCtx(() => [
|
104
|
+
_ctx.validation ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3, " * " + vue.toDisplayString(_ctx.validation.message), 1)) : vue.createCommentVNode("", true)
|
105
|
+
]),
|
106
|
+
_: 1
|
107
|
+
})
|
108
|
+
], 2);
|
109
|
+
};
|
110
|
+
}
|
111
|
+
};
|
112
|
+
exports.default = _sfc_main;
|
113
|
+
//# sourceMappingURL=Address.vue.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Address.vue.cjs","sources":["../../../../../src/components/Address/Address.vue"],"sourcesContent":["<template>\n <div :class=\"$attrs.class\" class=\"flex-nowrap flex\"> \n <!-- ////////////////////////// -->\n <!-- Label -->\n <!-- ////////////////////////// -->\n <div v-if=\"label\" class=\"t-transp mn-r-small\">\n <span>{{label}}</span>\n </div>\n <!-- ////////////////////////// -->\n <!-- Input -->\n <!-- ////////////////////////// -->\n <input\n ref=\"addressInput\"\n class=\"w-100\"\n :placeholder=\"placeholder\"\n :value=\"address\"\n @input=\"onInput\"\n />\n <!-- ////////////////////////// -->\n <!-- Validation -->\n <!-- ////////////////////////// -->\n <transition mode=\"out-in\" name=\"fade\">\n <div v-if=\"validation\" class=\"mn-t-thin invalid-feedback\">\n * {{validation.message}}\n </div>\n </transition>\n </div>\n</template>\n\n<style>\n.pac-container {\n position: absolute;\n background-color: white;\n z-index: 1000;\n border-radius: 2rem;\n overflow: hidden;\n}\n</style>\n\n<script setup>\nimport { ref, onMounted, watchEffect } from 'vue';\n\nimport { Loader as GMLoader } from \"@googlemaps/js-api-loader\";\n\nconst props = defineProps({\n apiKey: {\n type: String,\n required: true,\n },\n label: null,\n placeholder: 'Enter something here',\n field: null,\n location: {\n type: Object,\n default: { lat: 48.6900735, lng: 41.16202390 }\n },\n address: {\n type: String,\n default: \"\"\n },\n locale: {\n type: String,\n default: 'en'\n }\n});\n\nconst emit = defineEmits(['update:address', 'update:location', 'update:country', 'update:state', 'update:city']);\n\nconst addressInput = ref(null);\n\nlet autocomplete;\n\nconst onPlaceChanged = () => {\n const place = autocomplete.getPlace();\n\n if (!place.geometry || !place.address_components) {\n return;\n }\n\n let country = '', state = '', city = '';\n\n for (let i = 0; i < place.address_components.length; i++) {\n\n let addr = place.address_components[i];\n\n if (addr.types.includes('country')) {\n country = addr.long_name;\n }\n if (addr.types.includes('administrative_area_level_1')) {\n state = addr.long_name;\n }\n if (addr.types.includes('locality')) {\n city = addr.long_name;\n }\n }\n \n const newAddress = place.formatted_address;\n const newLocation = { lat: place.geometry.location.lat(), lng: place.geometry.location.lng() };\n\n emit('update:address', newAddress);\n emit('update:location', newLocation);\n \n // Add new emits\n emit('update:country', country);\n emit('update:state', state);\n emit('update:city', city);\n};\n\nonMounted(() => { \n const loader = new GMLoader({ \n apiKey: props.apiKey, \n version: \"weekly\", \n libraries: [\"places\"],\n language: props.locale, \n });\n\n loader.load().then(() => { \n autocomplete = new google.maps.places.Autocomplete(addressInput.value); \n autocomplete.addListener('place_changed', onPlaceChanged); \n }).catch(e => { \n console.error(e); \n }); \n});\n</script>"],"names":["ref","onMounted","GMLoader"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,UAAM,QAAQ;AAsBd,UAAM,OAAO;AAEb,UAAM,eAAeA,IAAAA,IAAI,IAAI;AAE7B,QAAI;AAEJ,UAAM,iBAAiB,MAAM;AAC3B,YAAM,QAAQ,aAAa;AAE3B,UAAI,CAAC,MAAM,YAAY,CAAC,MAAM,oBAAoB;AAChD;AAAA,MACD;AAED,UAAI,UAAU,IAAI,QAAQ,IAAI,OAAO;AAErC,eAAS,IAAI,GAAG,IAAI,MAAM,mBAAmB,QAAQ,KAAK;AAExD,YAAI,OAAO,MAAM,mBAAmB,CAAC;AAErC,YAAI,KAAK,MAAM,SAAS,SAAS,GAAG;AAClC,oBAAU,KAAK;AAAA,QAChB;AACD,YAAI,KAAK,MAAM,SAAS,6BAA6B,GAAG;AACtD,kBAAQ,KAAK;AAAA,QACd;AACD,YAAI,KAAK,MAAM,SAAS,UAAU,GAAG;AACnC,iBAAO,KAAK;AAAA,QACb;AAAA,MACF;AAED,YAAM,aAAa,MAAM;AACzB,YAAM,cAAc,EAAE,KAAK,MAAM,SAAS,SAAS,OAAO,KAAK,MAAM,SAAS,SAAS,IAAK,EAAA;AAE5F,WAAK,kBAAkB,UAAU;AACjC,WAAK,mBAAmB,WAAW;AAGnC,WAAK,kBAAkB,OAAO;AAC9B,WAAK,gBAAgB,KAAK;AAC1B,WAAK,eAAe,IAAI;AAAA,IAC1B;AAEAC,QAAAA,UAAU,MAAM;AACd,YAAM,SAAS,IAAIC,aAAS;AAAA,QAC1B,QAAQ,MAAM;AAAA,QACd,SAAS;AAAA,QACT,WAAW,CAAC,QAAQ;AAAA,QACpB,UAAU,MAAM;AAAA,MACpB,CAAG;AAED,aAAO,OAAO,KAAK,MAAM;AACvB,uBAAe,IAAI,OAAO,KAAK,OAAO,aAAa,aAAa,KAAK;AACrE,qBAAa,YAAY,iBAAiB,cAAc;AAAA,MAC5D,CAAG,EAAE,MAAM,OAAK;AACZ,gBAAQ,MAAM,CAAC;AAAA,MACnB,CAAG;AAAA,IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1,18 +1,21 @@
|
|
1
|
-
import { ref
|
2
|
-
import { Loader
|
1
|
+
import { ref, onMounted, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, createVNode, Transition, withCtx } from "vue";
|
2
|
+
import { Loader } from "../../../../node_modules/@googlemaps/js-api-loader/dist/index.js";
|
3
3
|
/* empty css */
|
4
|
-
const
|
4
|
+
const _hoisted_1 = {
|
5
5
|
key: 0,
|
6
6
|
class: "t-transp mn-r-small"
|
7
|
-
}
|
7
|
+
};
|
8
|
+
const _hoisted_2 = ["placeholder", "value"];
|
9
|
+
const _hoisted_3 = {
|
8
10
|
key: 0,
|
9
11
|
class: "mn-t-thin invalid-feedback"
|
10
|
-
}
|
12
|
+
};
|
13
|
+
const _sfc_main = {
|
11
14
|
__name: "Address",
|
12
15
|
props: {
|
13
16
|
apiKey: {
|
14
17
|
type: String,
|
15
|
-
required:
|
18
|
+
required: true
|
16
19
|
},
|
17
20
|
label: null,
|
18
21
|
placeholder: "Enter something here",
|
@@ -31,58 +34,80 @@ const E = {
|
|
31
34
|
}
|
32
35
|
},
|
33
36
|
emits: ["update:address", "update:location", "update:country", "update:state", "update:city"],
|
34
|
-
setup(
|
35
|
-
const
|
36
|
-
|
37
|
-
const
|
38
|
-
|
39
|
-
|
37
|
+
setup(__props, { emit: __emit }) {
|
38
|
+
const props = __props;
|
39
|
+
const emit = __emit;
|
40
|
+
const addressInput = ref(null);
|
41
|
+
let autocomplete;
|
42
|
+
const onPlaceChanged = () => {
|
43
|
+
const place = autocomplete.getPlace();
|
44
|
+
if (!place.geometry || !place.address_components) {
|
40
45
|
return;
|
41
|
-
let t = "", o = "", p = "";
|
42
|
-
for (let d = 0; d < e.address_components.length; d++) {
|
43
|
-
let a = e.address_components[d];
|
44
|
-
a.types.includes("country") && (t = a.long_name), a.types.includes("administrative_area_level_1") && (o = a.long_name), a.types.includes("locality") && (p = a.long_name);
|
45
46
|
}
|
46
|
-
|
47
|
-
|
47
|
+
let country = "", state = "", city = "";
|
48
|
+
for (let i = 0; i < place.address_components.length; i++) {
|
49
|
+
let addr = place.address_components[i];
|
50
|
+
if (addr.types.includes("country")) {
|
51
|
+
country = addr.long_name;
|
52
|
+
}
|
53
|
+
if (addr.types.includes("administrative_area_level_1")) {
|
54
|
+
state = addr.long_name;
|
55
|
+
}
|
56
|
+
if (addr.types.includes("locality")) {
|
57
|
+
city = addr.long_name;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
const newAddress = place.formatted_address;
|
61
|
+
const newLocation = { lat: place.geometry.location.lat(), lng: place.geometry.location.lng() };
|
62
|
+
emit("update:address", newAddress);
|
63
|
+
emit("update:location", newLocation);
|
64
|
+
emit("update:country", country);
|
65
|
+
emit("update:state", state);
|
66
|
+
emit("update:city", city);
|
48
67
|
};
|
49
|
-
|
50
|
-
new
|
51
|
-
apiKey:
|
68
|
+
onMounted(() => {
|
69
|
+
const loader = new Loader({
|
70
|
+
apiKey: props.apiKey,
|
52
71
|
version: "weekly",
|
53
72
|
libraries: ["places"],
|
54
|
-
language:
|
55
|
-
}).load().then(() => {
|
56
|
-
s = new google.maps.places.Autocomplete(u.value), s.addListener("place_changed", h);
|
57
|
-
}).catch((t) => {
|
58
|
-
console.error(t);
|
73
|
+
language: props.locale
|
59
74
|
});
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
class: "
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
75
|
+
loader.load().then(() => {
|
76
|
+
autocomplete = new google.maps.places.Autocomplete(addressInput.value);
|
77
|
+
autocomplete.addListener("place_changed", onPlaceChanged);
|
78
|
+
}).catch((e) => {
|
79
|
+
console.error(e);
|
80
|
+
});
|
81
|
+
});
|
82
|
+
return (_ctx, _cache) => {
|
83
|
+
return openBlock(), createElementBlock("div", {
|
84
|
+
class: normalizeClass([_ctx.$attrs.class, "flex-nowrap flex"])
|
85
|
+
}, [
|
86
|
+
__props.label ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
87
|
+
createElementVNode("span", null, toDisplayString(__props.label), 1)
|
88
|
+
])) : createCommentVNode("", true),
|
89
|
+
createElementVNode("input", {
|
90
|
+
ref_key: "addressInput",
|
91
|
+
ref: addressInput,
|
92
|
+
class: "w-100",
|
93
|
+
placeholder: __props.placeholder,
|
94
|
+
value: __props.address,
|
95
|
+
onInput: _cache[0] || (_cache[0] = (...args) => _ctx.onInput && _ctx.onInput(...args))
|
96
|
+
}, null, 40, _hoisted_2),
|
97
|
+
createVNode(Transition, {
|
98
|
+
mode: "out-in",
|
99
|
+
name: "fade"
|
100
|
+
}, {
|
101
|
+
default: withCtx(() => [
|
102
|
+
_ctx.validation ? (openBlock(), createElementBlock("div", _hoisted_3, " * " + toDisplayString(_ctx.validation.message), 1)) : createCommentVNode("", true)
|
103
|
+
]),
|
104
|
+
_: 1
|
105
|
+
})
|
106
|
+
], 2);
|
107
|
+
};
|
84
108
|
}
|
85
109
|
};
|
86
110
|
export {
|
87
|
-
|
111
|
+
_sfc_main as default
|
88
112
|
};
|
113
|
+
//# sourceMappingURL=Address.vue.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Address.vue.js","sources":["../../../../../src/components/Address/Address.vue"],"sourcesContent":["<template>\n <div :class=\"$attrs.class\" class=\"flex-nowrap flex\"> \n <!-- ////////////////////////// -->\n <!-- Label -->\n <!-- ////////////////////////// -->\n <div v-if=\"label\" class=\"t-transp mn-r-small\">\n <span>{{label}}</span>\n </div>\n <!-- ////////////////////////// -->\n <!-- Input -->\n <!-- ////////////////////////// -->\n <input\n ref=\"addressInput\"\n class=\"w-100\"\n :placeholder=\"placeholder\"\n :value=\"address\"\n @input=\"onInput\"\n />\n <!-- ////////////////////////// -->\n <!-- Validation -->\n <!-- ////////////////////////// -->\n <transition mode=\"out-in\" name=\"fade\">\n <div v-if=\"validation\" class=\"mn-t-thin invalid-feedback\">\n * {{validation.message}}\n </div>\n </transition>\n </div>\n</template>\n\n<style>\n.pac-container {\n position: absolute;\n background-color: white;\n z-index: 1000;\n border-radius: 2rem;\n overflow: hidden;\n}\n</style>\n\n<script setup>\nimport { ref, onMounted, watchEffect } from 'vue';\n\nimport { Loader as GMLoader } from \"@googlemaps/js-api-loader\";\n\nconst props = defineProps({\n apiKey: {\n type: String,\n required: true,\n },\n label: null,\n placeholder: 'Enter something here',\n field: null,\n location: {\n type: Object,\n default: { lat: 48.6900735, lng: 41.16202390 }\n },\n address: {\n type: String,\n default: \"\"\n },\n locale: {\n type: String,\n default: 'en'\n }\n});\n\nconst emit = defineEmits(['update:address', 'update:location', 'update:country', 'update:state', 'update:city']);\n\nconst addressInput = ref(null);\n\nlet autocomplete;\n\nconst onPlaceChanged = () => {\n const place = autocomplete.getPlace();\n\n if (!place.geometry || !place.address_components) {\n return;\n }\n\n let country = '', state = '', city = '';\n\n for (let i = 0; i < place.address_components.length; i++) {\n\n let addr = place.address_components[i];\n\n if (addr.types.includes('country')) {\n country = addr.long_name;\n }\n if (addr.types.includes('administrative_area_level_1')) {\n state = addr.long_name;\n }\n if (addr.types.includes('locality')) {\n city = addr.long_name;\n }\n }\n \n const newAddress = place.formatted_address;\n const newLocation = { lat: place.geometry.location.lat(), lng: place.geometry.location.lng() };\n\n emit('update:address', newAddress);\n emit('update:location', newLocation);\n \n // Add new emits\n emit('update:country', country);\n emit('update:state', state);\n emit('update:city', city);\n};\n\nonMounted(() => { \n const loader = new GMLoader({ \n apiKey: props.apiKey, \n version: \"weekly\", \n libraries: [\"places\"],\n language: props.locale, \n });\n\n loader.load().then(() => { \n autocomplete = new google.maps.places.Autocomplete(addressInput.value); \n autocomplete.addListener('place_changed', onPlaceChanged); \n }).catch(e => { \n console.error(e); \n }); \n});\n</script>"],"names":["GMLoader"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,UAAM,QAAQ;AAsBd,UAAM,OAAO;AAEb,UAAM,eAAe,IAAI,IAAI;AAE7B,QAAI;AAEJ,UAAM,iBAAiB,MAAM;AAC3B,YAAM,QAAQ,aAAa;AAE3B,UAAI,CAAC,MAAM,YAAY,CAAC,MAAM,oBAAoB;AAChD;AAAA,MACD;AAED,UAAI,UAAU,IAAI,QAAQ,IAAI,OAAO;AAErC,eAAS,IAAI,GAAG,IAAI,MAAM,mBAAmB,QAAQ,KAAK;AAExD,YAAI,OAAO,MAAM,mBAAmB,CAAC;AAErC,YAAI,KAAK,MAAM,SAAS,SAAS,GAAG;AAClC,oBAAU,KAAK;AAAA,QAChB;AACD,YAAI,KAAK,MAAM,SAAS,6BAA6B,GAAG;AACtD,kBAAQ,KAAK;AAAA,QACd;AACD,YAAI,KAAK,MAAM,SAAS,UAAU,GAAG;AACnC,iBAAO,KAAK;AAAA,QACb;AAAA,MACF;AAED,YAAM,aAAa,MAAM;AACzB,YAAM,cAAc,EAAE,KAAK,MAAM,SAAS,SAAS,OAAO,KAAK,MAAM,SAAS,SAAS,IAAK,EAAA;AAE5F,WAAK,kBAAkB,UAAU;AACjC,WAAK,mBAAmB,WAAW;AAGnC,WAAK,kBAAkB,OAAO;AAC9B,WAAK,gBAAgB,KAAK;AAC1B,WAAK,eAAe,IAAI;AAAA,IAC1B;AAEA,cAAU,MAAM;AACd,YAAM,SAAS,IAAIA,OAAS;AAAA,QAC1B,QAAQ,MAAM;AAAA,QACd,SAAS;AAAA,QACT,WAAW,CAAC,QAAQ;AAAA,QACpB,UAAU,MAAM;AAAA,MACpB,CAAG;AAED,aAAO,OAAO,KAAK,MAAM;AACvB,uBAAe,IAAI,OAAO,KAAK,OAAO,aAAa,aAAa,KAAK;AACrE,qBAAa,YAAY,iBAAiB,cAAc;AAAA,MAC5D,CAAG,EAAE,MAAM,OAAK;AACZ,gBAAQ,MAAM,CAAC;AAAA,MACnB,CAAG;AAAA,IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1 +1,133 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
3
|
+
const vue = require("vue");
|
4
|
+
const Loader = require("../Loader/Loader.vue2.cjs");
|
5
|
+
;/* empty css */
|
6
|
+
const _hoisted_1 = ["disabled"];
|
7
|
+
const _hoisted_2 = { key: 0 };
|
8
|
+
const _hoisted_3 = { key: 1 };
|
9
|
+
const _hoisted_4 = {
|
10
|
+
key: 2,
|
11
|
+
class: "t-semi loading t-black"
|
12
|
+
};
|
13
|
+
const _hoisted_5 = {
|
14
|
+
key: 3,
|
15
|
+
class: "error"
|
16
|
+
};
|
17
|
+
const _hoisted_6 = {
|
18
|
+
key: 0,
|
19
|
+
class: "button-counter"
|
20
|
+
};
|
21
|
+
const _sfc_main = {
|
22
|
+
__name: "Button",
|
23
|
+
props: {
|
24
|
+
submit: {
|
25
|
+
type: Function,
|
26
|
+
default: async () => {
|
27
|
+
console.log("Button click.");
|
28
|
+
}
|
29
|
+
},
|
30
|
+
text: {
|
31
|
+
type: Object,
|
32
|
+
default: (textComponent) => {
|
33
|
+
console.log(textComponent);
|
34
|
+
return textComponent = {
|
35
|
+
...textComponent.text,
|
36
|
+
success: "✔",
|
37
|
+
error: "✖"
|
38
|
+
};
|
39
|
+
}
|
40
|
+
},
|
41
|
+
counter: {
|
42
|
+
type: Object
|
43
|
+
},
|
44
|
+
callback: {
|
45
|
+
type: Function,
|
46
|
+
default: async () => {
|
47
|
+
console.log("Button callback.");
|
48
|
+
}
|
49
|
+
},
|
50
|
+
callbackDelay: {
|
51
|
+
type: Number,
|
52
|
+
default: 750
|
53
|
+
},
|
54
|
+
showSucces: {
|
55
|
+
type: Boolean,
|
56
|
+
default: true
|
57
|
+
},
|
58
|
+
showLoader: {
|
59
|
+
type: Boolean,
|
60
|
+
default: true
|
61
|
+
},
|
62
|
+
validation: {
|
63
|
+
type: Boolean,
|
64
|
+
default: false
|
65
|
+
}
|
66
|
+
},
|
67
|
+
emits: ["error"],
|
68
|
+
setup(__props, { emit: __emit }) {
|
69
|
+
const props = __props;
|
70
|
+
const emits = __emit;
|
71
|
+
const button = vue.ref(null);
|
72
|
+
const error = vue.ref(null);
|
73
|
+
const loading = vue.ref(false);
|
74
|
+
const finished = vue.ref(false);
|
75
|
+
async function Submit() {
|
76
|
+
button.value.style["pointer-events"] = "none";
|
77
|
+
error.value = null;
|
78
|
+
loading.value = true;
|
79
|
+
const resetButton = () => {
|
80
|
+
if (button.value) {
|
81
|
+
button.value.classList.replace("bg-second", "bg-main");
|
82
|
+
button.value.style.pointerEvents = "auto";
|
83
|
+
loading.value = false;
|
84
|
+
finished.value = false;
|
85
|
+
error.value = null;
|
86
|
+
}
|
87
|
+
};
|
88
|
+
try {
|
89
|
+
await props.submit();
|
90
|
+
button.value.classList.replace("bg-main", "bg-second");
|
91
|
+
loading.value = false;
|
92
|
+
if (props.showSucces) {
|
93
|
+
finished.value = true;
|
94
|
+
setTimeout(resetButton, 500);
|
95
|
+
} else {
|
96
|
+
resetButton();
|
97
|
+
}
|
98
|
+
if (props.callback) setTimeout(() => props.callback(), props.callbackDelay);
|
99
|
+
} catch (err) {
|
100
|
+
emits("error", err);
|
101
|
+
button.value.classList.replace("bg-main", "bg-fourth-nano");
|
102
|
+
error.value = props.error;
|
103
|
+
setTimeout(() => {
|
104
|
+
resetButton();
|
105
|
+
button.value.classList.replace("bg-fourth-nano", "bg-main");
|
106
|
+
}, 1330);
|
107
|
+
}
|
108
|
+
}
|
109
|
+
return (_ctx, _cache) => {
|
110
|
+
return vue.openBlock(), vue.createElementBlock("button", {
|
111
|
+
onClick: vue.withModifiers(Submit, ["stop"]),
|
112
|
+
disabled: __props.validation,
|
113
|
+
ref_key: "button",
|
114
|
+
ref: button,
|
115
|
+
class: "button"
|
116
|
+
}, [
|
117
|
+
vue.createVNode(vue.Transition, { name: "FromTop" }, {
|
118
|
+
default: vue.withCtx(() => [
|
119
|
+
!loading.value && !error.value && !finished.value || !__props.showLoader ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2, [
|
120
|
+
vue.renderSlot(_ctx.$slots, "default")
|
121
|
+
])) : loading.value && !error.value && __props.showLoader ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3, [
|
122
|
+
vue.createVNode(Loader.default, { class: "pos-relative pos-t-0 pos-l-0 loading" })
|
123
|
+
])) : finished.value && __props.showSucces ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_4, vue.toDisplayString(__props.text.success), 1)) : error.value ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5, vue.toDisplayString(error.value), 1)) : vue.createCommentVNode("", true)
|
124
|
+
]),
|
125
|
+
_: 3
|
126
|
+
}),
|
127
|
+
__props.counter ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_6, vue.toDisplayString(__props.counter), 1)) : vue.createCommentVNode("", true)
|
128
|
+
], 8, _hoisted_1);
|
129
|
+
};
|
130
|
+
}
|
131
|
+
};
|
132
|
+
exports.default = _sfc_main;
|
133
|
+
//# sourceMappingURL=Button.vue2.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Button.vue2.cjs","sources":["../../../../../src/components/Button/Button.vue"],"sourcesContent":["<script setup>\n\timport { ref } from 'vue'\n\n\timport Loader from '@pf/src/components/Loader/Loader.vue'\n\n\tconst props = defineProps({\n\t\tsubmit: {\n\t\t\ttype: Function,\n\t\t\tdefault: async () => { console.log('Button click.') }\n\t\t},\n\t\ttext: {\n\t\t\ttype: Object,\n\t\t\tdefault: (textComponent) => {\n\t\t\t\tconsole.log(textComponent)\n\t\t\t\treturn textComponent = {\n\t\t\t\t\t...textComponent.text,\n\t\t\t\t\tsuccess: '✔',\n\t\t\t\t\terror: '✖'\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tcounter: {\n\t type: Object\n\t },\n\t\tcallback: {\n\t\t\ttype: Function,\n\t\t\tdefault: async () => { console.log('Button callback.') }\n\t\t},\n\t\tcallbackDelay: {\n\t\t\ttype: Number,\n\t\t\tdefault: 750\n\t\t},\n\t\tshowSucces: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true\n\t\t},\n\t\tshowLoader: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true\n\t\t},\n\t\tvalidation: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t})\t\n\n\tconst emits = defineEmits(['error'])\n\n\tconst button = ref(null);\n\tconst error = ref(null);\n\tconst loading = ref(false);\n\tconst finished = ref(false);\n\n\tasync function Submit() {\n\t button.value.style['pointer-events'] = 'none';\n\t error.value = null;\n\t loading.value = true;\n\n\t // Функция для сброса состояния кнопки.\n\t const resetButton = () => {\n\t if (button.value) {\n button.value.classList.replace('bg-second', 'bg-main');\n button.value.style.pointerEvents = 'auto';\n loading.value = false;\n finished.value = false;\n error.value = null;\n\t }\n\t };\n\n\t try {\n\t await props.submit();\n\n\t button.value.classList.replace('bg-main', 'bg-second');\n\n\t loading.value = false;\n\n\t // Используем функцию сброса состояния кнопки здесь.\n\t if (props.showSucces) { \n\t\t\t\t\t\t\tfinished.value = true;\n\t setTimeout(resetButton, 500);\n\t } else {\n\t resetButton();\n\t }\n\n\t // Если есть callback, мы также установим таймер для его вызова.\n\t if (props.callback) setTimeout(() => props.callback(), props.callbackDelay);\n\n\t } catch (err) {\n\t \t\temits('error',err)\n\t // Если возникла ошибка, мы изменяем стили и устанавливаем сообщение об ошибке.\n\t button.value.classList.replace('bg-main', 'bg-fourth-nano');\n\t error.value = props.error;\n\t \n\t // После задержки снова сбрасываем состояние кнопки.\n\t setTimeout(() => {\n\t resetButton();\n\t // Так как класс кнопки был изменен, вернем его в исходное состояние.\n\t button.value.classList.replace('bg-fourth-nano', 'bg-main');\n\t }, 1330);\n\t }\n\t}\n\n</script>\n\n<template>\n\t<button @click.stop=\"Submit\" :disabled=\"validation\" ref=\"button\" class=\"button\">\n\t\t<transition name=\"FromTop\" >\n\t\t\t<!-- Slot -->\n\t\t\t<span v-if=\"!loading && !error && !finished || !showLoader\"><slot></slot></span>\n\t\t\t<!-- Loading Circle Animation -->\n\t\t\t<span v-else-if=\"loading && !error && showLoader\"><Loader class=\"pos-relative pos-t-0 pos-l-0 loading\"/></span>\n\t\t\t<!-- <Loader v-else-if=\"loading && !error && showLoader\"/> -->\n\t\t\t<!-- Success -->\n\t\t\t<span v-else-if=\"finished && showSucces\" class=\"t-semi loading t-black\">{{text.success}}</span>\n\t\t\t<!-- Error if not finished -->\n\t\t\t<span v-else-if=\"error\" class=\"error\">{{ error }}</span>\n\t\t</transition>\n\t\t<!-- Counter -->\n\t\t<p v-if=\"counter\" class=\"button-counter\">{{counter}}</p> \n\n\t</button> \n</template>\n\n\n<style lang=\"scss\">\n\tbutton[disabled] {\n\t\tbackground: grey; \n\t\t&:hover {\n\t\t\tbackground: grey; \n\t\t} \n\t}\n\n\t.FromTop-enter-active,\n\t.FromTop-leave-active {\n\t\ttransform: translateY(0);\n\t\topacity: 1;\n\t\ttransition: all 0.5s ease; \n\t\t\n\t}\n\t.FromTop-enter-from,\n\t.FromTop-leave-to {\n\t\tposition: absolute;\n\t\ttransform: translateY(-1rem);\n\t\topacity: 0;\n\t\ttransition: all 0.5s ease;\n\t}\n\n\t.button {\n\t\tdisplay: flex;\n\t\twidth: fit-content;\n\n\t\tpadding: 1rem 1.75rem;\n\t\tborder-radius: 3rem;\n\n\t\ttransform: scale(1);\n\t\topacity: 1;\n\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\t\n\t\tcolor: black;\n\t\ttext-align: center;\n\t\ttext-transform: uppercase;\n\t\tfont-size: 1rem;\n\t\tletter-spacing: 5%;\n\n\t\ttransition: all 0.33s ease;\n\t \n\t\t&:hover {\n\t\t\tcursor: pointer;\n\t\t\topacity: 0.9;\n\t\t}\n\n\t\t&:active {\n\t\t\ttransform: scale(0.95);\n\t\t}\n\n\t\t&-small {\n\t\t\tpadding: 0.5rem 0.75rem;\n\t\t\tborder-radius: 0.5rem;\n\t\t\theight: fit-content;\n\t\t}\n\n\t\t.button-counter {\n\t\t\tposition: absolute;\n\t\t\tright: -8px;\n\t bottom: -8px;\n\t background: yellow;\n\t height: 16px;\n\t border-radius: 16px;\n\t width: 16px;\n\t font-weight: 500;\n\t text-align: center;\n\t line-height: 16px;\n\t font-size: 10px;\n\t\t}\n\t}\n</style>"],"names":["ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKC,UAAM,QAAQ;AAyCd,UAAM,QAAQ;AAEd,UAAM,SAASA,QAAI,IAAI;AACvB,UAAM,QAAQA,QAAI,IAAI;AACtB,UAAM,UAAUA,QAAI,KAAK;AACzB,UAAM,WAAWA,QAAI,KAAK;AAE1B,mBAAe,SAAS;AACpB,aAAO,MAAM,MAAM,gBAAgB,IAAI;AACvC,YAAM,QAAQ;AACd,cAAQ,QAAQ;AAGhB,YAAM,cAAc,MAAM;AACtB,YAAI,OAAO,OAAO;AACf,iBAAO,MAAM,UAAU,QAAQ,aAAa,SAAS;AACrD,iBAAO,MAAM,MAAM,gBAAgB;AACnC,kBAAQ,QAAQ;AAChB,mBAAS,QAAQ;AACjB,gBAAM,QAAQ;AAAA,QAChB;AAAA,MACV;AAEK,UAAI;AACA,cAAM,MAAM;AAEZ,eAAO,MAAM,UAAU,QAAQ,WAAW,WAAW;AAErD,gBAAQ,QAAQ;AAGhB,YAAI,MAAM,YAAY;AACxB,mBAAS,QAAQ;AACX,qBAAW,aAAa,GAAG;AAAA,QACxC,OAAgB;AACH;QACH;AAGD,YAAI,MAAM,SAAU,YAAW,MAAM,MAAM,SAAU,GAAE,MAAM,aAAa;AAAA,MAE7E,SAAQ,KAAK;AACZ,cAAM,SAAQ,GAAG;AAEf,eAAO,MAAM,UAAU,QAAQ,WAAW,gBAAgB;AAC1D,cAAM,QAAQ,MAAM;AAGpB,mBAAW,MAAM;AACb;AAEA,iBAAO,MAAM,UAAU,QAAQ,kBAAkB,SAAS;AAAA,QAC7D,GAAE,IAAI;AAAA,MACV;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1,16 +1,22 @@
|
|
1
|
-
import { ref
|
2
|
-
import
|
1
|
+
import { ref, openBlock, createElementBlock, withModifiers, createVNode, Transition, withCtx, renderSlot, toDisplayString, createCommentVNode } from "vue";
|
2
|
+
import Loader from "../Loader/Loader.vue2.js";
|
3
3
|
/* empty css */
|
4
|
-
const
|
4
|
+
const _hoisted_1 = ["disabled"];
|
5
|
+
const _hoisted_2 = { key: 0 };
|
6
|
+
const _hoisted_3 = { key: 1 };
|
7
|
+
const _hoisted_4 = {
|
5
8
|
key: 2,
|
6
9
|
class: "t-semi loading t-black"
|
7
|
-
}
|
10
|
+
};
|
11
|
+
const _hoisted_5 = {
|
8
12
|
key: 3,
|
9
13
|
class: "error"
|
10
|
-
}
|
14
|
+
};
|
15
|
+
const _hoisted_6 = {
|
11
16
|
key: 0,
|
12
17
|
class: "button-counter"
|
13
|
-
}
|
18
|
+
};
|
19
|
+
const _sfc_main = {
|
14
20
|
__name: "Button",
|
15
21
|
props: {
|
16
22
|
submit: {
|
@@ -21,11 +27,14 @@ const B = ["disabled"], L = { key: 0 }, S = { key: 1 }, T = {
|
|
21
27
|
},
|
22
28
|
text: {
|
23
29
|
type: Object,
|
24
|
-
default: (
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
30
|
+
default: (textComponent) => {
|
31
|
+
console.log(textComponent);
|
32
|
+
return textComponent = {
|
33
|
+
...textComponent.text,
|
34
|
+
success: "✔",
|
35
|
+
error: "✖"
|
36
|
+
};
|
37
|
+
}
|
29
38
|
},
|
30
39
|
counter: {
|
31
40
|
type: Object
|
@@ -42,54 +51,83 @@ const B = ["disabled"], L = { key: 0 }, S = { key: 1 }, T = {
|
|
42
51
|
},
|
43
52
|
showSucces: {
|
44
53
|
type: Boolean,
|
45
|
-
default:
|
54
|
+
default: true
|
46
55
|
},
|
47
56
|
showLoader: {
|
48
57
|
type: Boolean,
|
49
|
-
default:
|
58
|
+
default: true
|
50
59
|
},
|
51
60
|
validation: {
|
52
61
|
type: Boolean,
|
53
|
-
default:
|
62
|
+
default: false
|
54
63
|
}
|
55
64
|
},
|
56
65
|
emits: ["error"],
|
57
|
-
setup(
|
58
|
-
const
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
66
|
+
setup(__props, { emit: __emit }) {
|
67
|
+
const props = __props;
|
68
|
+
const emits = __emit;
|
69
|
+
const button = ref(null);
|
70
|
+
const error = ref(null);
|
71
|
+
const loading = ref(false);
|
72
|
+
const finished = ref(false);
|
73
|
+
async function Submit() {
|
74
|
+
button.value.style["pointer-events"] = "none";
|
75
|
+
error.value = null;
|
76
|
+
loading.value = true;
|
77
|
+
const resetButton = () => {
|
78
|
+
if (button.value) {
|
79
|
+
button.value.classList.replace("bg-second", "bg-main");
|
80
|
+
button.value.style.pointerEvents = "auto";
|
81
|
+
loading.value = false;
|
82
|
+
finished.value = false;
|
83
|
+
error.value = null;
|
84
|
+
}
|
63
85
|
};
|
64
86
|
try {
|
65
|
-
await
|
66
|
-
|
67
|
-
|
68
|
-
|
87
|
+
await props.submit();
|
88
|
+
button.value.classList.replace("bg-main", "bg-second");
|
89
|
+
loading.value = false;
|
90
|
+
if (props.showSucces) {
|
91
|
+
finished.value = true;
|
92
|
+
setTimeout(resetButton, 500);
|
93
|
+
} else {
|
94
|
+
resetButton();
|
95
|
+
}
|
96
|
+
if (props.callback) setTimeout(() => props.callback(), props.callbackDelay);
|
97
|
+
} catch (err) {
|
98
|
+
emits("error", err);
|
99
|
+
button.value.classList.replace("bg-main", "bg-fourth-nano");
|
100
|
+
error.value = props.error;
|
101
|
+
setTimeout(() => {
|
102
|
+
resetButton();
|
103
|
+
button.value.classList.replace("bg-fourth-nano", "bg-main");
|
69
104
|
}, 1330);
|
70
105
|
}
|
71
106
|
}
|
72
|
-
return (
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
107
|
+
return (_ctx, _cache) => {
|
108
|
+
return openBlock(), createElementBlock("button", {
|
109
|
+
onClick: withModifiers(Submit, ["stop"]),
|
110
|
+
disabled: __props.validation,
|
111
|
+
ref_key: "button",
|
112
|
+
ref: button,
|
113
|
+
class: "button"
|
114
|
+
}, [
|
115
|
+
createVNode(Transition, { name: "FromTop" }, {
|
116
|
+
default: withCtx(() => [
|
117
|
+
!loading.value && !error.value && !finished.value || !__props.showLoader ? (openBlock(), createElementBlock("span", _hoisted_2, [
|
118
|
+
renderSlot(_ctx.$slots, "default")
|
119
|
+
])) : loading.value && !error.value && __props.showLoader ? (openBlock(), createElementBlock("span", _hoisted_3, [
|
120
|
+
createVNode(Loader, { class: "pos-relative pos-t-0 pos-l-0 loading" })
|
121
|
+
])) : finished.value && __props.showSucces ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(__props.text.success), 1)) : error.value ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(error.value), 1)) : createCommentVNode("", true)
|
122
|
+
]),
|
123
|
+
_: 3
|
124
|
+
}),
|
125
|
+
__props.counter ? (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString(__props.counter), 1)) : createCommentVNode("", true)
|
126
|
+
], 8, _hoisted_1);
|
127
|
+
};
|
91
128
|
}
|
92
129
|
};
|
93
130
|
export {
|
94
|
-
|
131
|
+
_sfc_main as default
|
95
132
|
};
|
133
|
+
//# sourceMappingURL=Button.vue2.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Button.vue2.js","sources":["../../../../../src/components/Button/Button.vue"],"sourcesContent":["<script setup>\n\timport { ref } from 'vue'\n\n\timport Loader from '@pf/src/components/Loader/Loader.vue'\n\n\tconst props = defineProps({\n\t\tsubmit: {\n\t\t\ttype: Function,\n\t\t\tdefault: async () => { console.log('Button click.') }\n\t\t},\n\t\ttext: {\n\t\t\ttype: Object,\n\t\t\tdefault: (textComponent) => {\n\t\t\t\tconsole.log(textComponent)\n\t\t\t\treturn textComponent = {\n\t\t\t\t\t...textComponent.text,\n\t\t\t\t\tsuccess: '✔',\n\t\t\t\t\terror: '✖'\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tcounter: {\n\t type: Object\n\t },\n\t\tcallback: {\n\t\t\ttype: Function,\n\t\t\tdefault: async () => { console.log('Button callback.') }\n\t\t},\n\t\tcallbackDelay: {\n\t\t\ttype: Number,\n\t\t\tdefault: 750\n\t\t},\n\t\tshowSucces: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true\n\t\t},\n\t\tshowLoader: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true\n\t\t},\n\t\tvalidation: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false\n\t\t},\n\t})\t\n\n\tconst emits = defineEmits(['error'])\n\n\tconst button = ref(null);\n\tconst error = ref(null);\n\tconst loading = ref(false);\n\tconst finished = ref(false);\n\n\tasync function Submit() {\n\t button.value.style['pointer-events'] = 'none';\n\t error.value = null;\n\t loading.value = true;\n\n\t // Функция для сброса состояния кнопки.\n\t const resetButton = () => {\n\t if (button.value) {\n button.value.classList.replace('bg-second', 'bg-main');\n button.value.style.pointerEvents = 'auto';\n loading.value = false;\n finished.value = false;\n error.value = null;\n\t }\n\t };\n\n\t try {\n\t await props.submit();\n\n\t button.value.classList.replace('bg-main', 'bg-second');\n\n\t loading.value = false;\n\n\t // Используем функцию сброса состояния кнопки здесь.\n\t if (props.showSucces) { \n\t\t\t\t\t\t\tfinished.value = true;\n\t setTimeout(resetButton, 500);\n\t } else {\n\t resetButton();\n\t }\n\n\t // Если есть callback, мы также установим таймер для его вызова.\n\t if (props.callback) setTimeout(() => props.callback(), props.callbackDelay);\n\n\t } catch (err) {\n\t \t\temits('error',err)\n\t // Если возникла ошибка, мы изменяем стили и устанавливаем сообщение об ошибке.\n\t button.value.classList.replace('bg-main', 'bg-fourth-nano');\n\t error.value = props.error;\n\t \n\t // После задержки снова сбрасываем состояние кнопки.\n\t setTimeout(() => {\n\t resetButton();\n\t // Так как класс кнопки был изменен, вернем его в исходное состояние.\n\t button.value.classList.replace('bg-fourth-nano', 'bg-main');\n\t }, 1330);\n\t }\n\t}\n\n</script>\n\n<template>\n\t<button @click.stop=\"Submit\" :disabled=\"validation\" ref=\"button\" class=\"button\">\n\t\t<transition name=\"FromTop\" >\n\t\t\t<!-- Slot -->\n\t\t\t<span v-if=\"!loading && !error && !finished || !showLoader\"><slot></slot></span>\n\t\t\t<!-- Loading Circle Animation -->\n\t\t\t<span v-else-if=\"loading && !error && showLoader\"><Loader class=\"pos-relative pos-t-0 pos-l-0 loading\"/></span>\n\t\t\t<!-- <Loader v-else-if=\"loading && !error && showLoader\"/> -->\n\t\t\t<!-- Success -->\n\t\t\t<span v-else-if=\"finished && showSucces\" class=\"t-semi loading t-black\">{{text.success}}</span>\n\t\t\t<!-- Error if not finished -->\n\t\t\t<span v-else-if=\"error\" class=\"error\">{{ error }}</span>\n\t\t</transition>\n\t\t<!-- Counter -->\n\t\t<p v-if=\"counter\" class=\"button-counter\">{{counter}}</p> \n\n\t</button> \n</template>\n\n\n<style lang=\"scss\">\n\tbutton[disabled] {\n\t\tbackground: grey; \n\t\t&:hover {\n\t\t\tbackground: grey; \n\t\t} \n\t}\n\n\t.FromTop-enter-active,\n\t.FromTop-leave-active {\n\t\ttransform: translateY(0);\n\t\topacity: 1;\n\t\ttransition: all 0.5s ease; \n\t\t\n\t}\n\t.FromTop-enter-from,\n\t.FromTop-leave-to {\n\t\tposition: absolute;\n\t\ttransform: translateY(-1rem);\n\t\topacity: 0;\n\t\ttransition: all 0.5s ease;\n\t}\n\n\t.button {\n\t\tdisplay: flex;\n\t\twidth: fit-content;\n\n\t\tpadding: 1rem 1.75rem;\n\t\tborder-radius: 3rem;\n\n\t\ttransform: scale(1);\n\t\topacity: 1;\n\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\t\n\t\tcolor: black;\n\t\ttext-align: center;\n\t\ttext-transform: uppercase;\n\t\tfont-size: 1rem;\n\t\tletter-spacing: 5%;\n\n\t\ttransition: all 0.33s ease;\n\t \n\t\t&:hover {\n\t\t\tcursor: pointer;\n\t\t\topacity: 0.9;\n\t\t}\n\n\t\t&:active {\n\t\t\ttransform: scale(0.95);\n\t\t}\n\n\t\t&-small {\n\t\t\tpadding: 0.5rem 0.75rem;\n\t\t\tborder-radius: 0.5rem;\n\t\t\theight: fit-content;\n\t\t}\n\n\t\t.button-counter {\n\t\t\tposition: absolute;\n\t\t\tright: -8px;\n\t bottom: -8px;\n\t background: yellow;\n\t height: 16px;\n\t border-radius: 16px;\n\t width: 16px;\n\t font-weight: 500;\n\t text-align: center;\n\t line-height: 16px;\n\t font-size: 10px;\n\t\t}\n\t}\n</style>"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKC,UAAM,QAAQ;AAyCd,UAAM,QAAQ;AAEd,UAAM,SAAS,IAAI,IAAI;AACvB,UAAM,QAAQ,IAAI,IAAI;AACtB,UAAM,UAAU,IAAI,KAAK;AACzB,UAAM,WAAW,IAAI,KAAK;AAE1B,mBAAe,SAAS;AACpB,aAAO,MAAM,MAAM,gBAAgB,IAAI;AACvC,YAAM,QAAQ;AACd,cAAQ,QAAQ;AAGhB,YAAM,cAAc,MAAM;AACtB,YAAI,OAAO,OAAO;AACf,iBAAO,MAAM,UAAU,QAAQ,aAAa,SAAS;AACrD,iBAAO,MAAM,MAAM,gBAAgB;AACnC,kBAAQ,QAAQ;AAChB,mBAAS,QAAQ;AACjB,gBAAM,QAAQ;AAAA,QAChB;AAAA,MACV;AAEK,UAAI;AACA,cAAM,MAAM;AAEZ,eAAO,MAAM,UAAU,QAAQ,WAAW,WAAW;AAErD,gBAAQ,QAAQ;AAGhB,YAAI,MAAM,YAAY;AACxB,mBAAS,QAAQ;AACX,qBAAW,aAAa,GAAG;AAAA,QACxC,OAAgB;AACH;QACH;AAGD,YAAI,MAAM,SAAU,YAAW,MAAM,MAAM,SAAU,GAAE,MAAM,aAAa;AAAA,MAE7E,SAAQ,KAAK;AACZ,cAAM,SAAQ,GAAG;AAEf,eAAO,MAAM,UAAU,QAAQ,WAAW,gBAAgB;AAC1D,cAAM,QAAQ,MAAM;AAGpB,mBAAW,MAAM;AACb;AAEA,iBAAO,MAAM,UAAU,QAAQ,kBAAkB,SAAS;AAAA,QAC7D,GAAE,IAAI;AAAA,MACV;AAAA,IACJ;;;;;;;;;;;;;;;;;;;;;;;;"}
|