@studio-west/component-sw 0.3.6 → 0.3.8
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/README.md
CHANGED
|
@@ -11,66 +11,66 @@ const O = {
|
|
|
11
11
|
manual: { type: Boolean, default: !1 }
|
|
12
12
|
},
|
|
13
13
|
setup(k) {
|
|
14
|
-
const
|
|
14
|
+
const o = k, e = d(!1), m = d(null), i = d(null), v = d({}), x = C(
|
|
15
15
|
() => {
|
|
16
16
|
let l = ["sw-dropdown"];
|
|
17
|
-
return
|
|
17
|
+
return o.size.length > 0 && l.push("sw-" + o.size), o.type.length > 0 && l.push("sw-" + o.type), l;
|
|
18
18
|
}
|
|
19
19
|
);
|
|
20
|
-
R(() =>
|
|
20
|
+
R(() => o.manual, (l) => {
|
|
21
21
|
e.value = l, console.log("watch", e.value), e.value && u();
|
|
22
22
|
});
|
|
23
23
|
const u = async () => {
|
|
24
24
|
if (await W(), !i.value) return;
|
|
25
25
|
const l = window.pageYOffset || document.documentElement.scrollTop, n = window.pageXOffset || document.documentElement.scrollLeft;
|
|
26
26
|
document.body.style.position = "fixed", document.body.style.top = `-${l}px`, document.body.style.left = `-${n}px`, i.value.focus(), i.value.addEventListener("blur", () => e.value = !1), document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.documentElement.scrollTop = l, document.documentElement.scrollLeft = n;
|
|
27
|
-
const
|
|
27
|
+
const t = m.value.getBoundingClientRect(), p = i.value.offsetHeight, c = i.value.offsetWidth;
|
|
28
28
|
console.log("popupHeight", p), console.log("popupWidth", c);
|
|
29
|
-
let s =
|
|
30
|
-
const [z, E] =
|
|
31
|
-
switch (console.log(
|
|
29
|
+
let s = t.left + t.width / 2 + n, a = t.top + t.height / 2 + l;
|
|
30
|
+
const [z, E] = o.placement.split("-", 2);
|
|
31
|
+
switch (console.log(o.placement), z) {
|
|
32
32
|
case "bottom":
|
|
33
|
-
a = a +
|
|
33
|
+
a = a + t.height / 2 + 8;
|
|
34
34
|
break;
|
|
35
35
|
case "top":
|
|
36
|
-
a = a -
|
|
36
|
+
a = a - t.height / 2 - 8 - p;
|
|
37
37
|
break;
|
|
38
38
|
case "left":
|
|
39
|
-
s = s - c -
|
|
39
|
+
s = s - c - t.width / 2 - 8, a = a - p / 2;
|
|
40
40
|
break;
|
|
41
41
|
case "right":
|
|
42
|
-
s = s +
|
|
42
|
+
s = s + t.width / 2 + 8, a = a - p / 2;
|
|
43
43
|
break;
|
|
44
44
|
}
|
|
45
45
|
switch (E) {
|
|
46
46
|
case "left":
|
|
47
|
-
s = s -
|
|
47
|
+
s = s - t.width / 2;
|
|
48
48
|
break;
|
|
49
49
|
case "right":
|
|
50
|
-
s = s - c +
|
|
50
|
+
s = s - c + t.width / 2;
|
|
51
51
|
break;
|
|
52
52
|
}
|
|
53
53
|
s < 0 && (s = 0), a < 0 && (a = 0), v.value = {
|
|
54
54
|
position: "absolute",
|
|
55
55
|
top: `${a}px`,
|
|
56
56
|
left: `${s}px`,
|
|
57
|
-
maxWidth:
|
|
57
|
+
maxWidth: o.maxWidth === 0 ? "" : `${o.maxWidth}px`
|
|
58
58
|
};
|
|
59
59
|
}, $ = async () => {
|
|
60
|
-
|
|
60
|
+
o.trigger === "click" && (e.value = !e.value), e.value && await u();
|
|
61
61
|
}, g = async () => {
|
|
62
|
-
|
|
62
|
+
o.trigger === "hover" && (e.value = !e.value), e.value && await u();
|
|
63
63
|
}, S = async () => {
|
|
64
|
-
|
|
64
|
+
o.trigger === "context" && (e.value = !e.value), e.value && await u();
|
|
65
65
|
}, y = () => {
|
|
66
66
|
e.value && u();
|
|
67
67
|
};
|
|
68
68
|
return L(() => window.addEventListener("resize", y)), B(() => window.removeEventListener("resize", y)), (l, n) => (f(), w("div", {
|
|
69
69
|
class: h(x.value),
|
|
70
|
-
onClick: n[0] || (n[0] = r((
|
|
71
|
-
onMouseover: n[1] || (n[1] = r((
|
|
72
|
-
onMouseleave: n[2] || (n[2] = r((
|
|
73
|
-
onContextmenu: n[3] || (n[3] = r((
|
|
70
|
+
onClick: n[0] || (n[0] = r((t) => $(), ["stop"])),
|
|
71
|
+
onMouseover: n[1] || (n[1] = r((t) => g(), ["stop"])),
|
|
72
|
+
onMouseleave: n[2] || (n[2] = r((t) => g(), ["stop"])),
|
|
73
|
+
onContextmenu: n[3] || (n[3] = r((t) => S(), ["stop"])),
|
|
74
74
|
ref_key: "dropdownRef",
|
|
75
75
|
ref: m
|
|
76
76
|
}, [
|
|
@@ -80,7 +80,7 @@ const O = {
|
|
|
80
80
|
key: 0,
|
|
81
81
|
ref_key: "popupRef",
|
|
82
82
|
ref: i,
|
|
83
|
-
class: h(["sw-dropdown-popup",
|
|
83
|
+
class: h(["sw-dropdown-popup", o.class]),
|
|
84
84
|
style: P(v.value),
|
|
85
85
|
tabindex: "-1"
|
|
86
86
|
}, [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createElementBlock as
|
|
1
|
+
import { createElementBlock as f, openBlock as i, mergeProps as _, createElementVNode as $, mergeModels as v, useModel as N, ref as V, computed as M, watch as A, normalizeClass as I, createBlock as x, renderSlot as S, createCommentVNode as k, withDirectives as O, createTextVNode as R, toDisplayString as T, vModelDynamic as F } from "vue";
|
|
2
2
|
import { i as P } from "./index-gmNtBsqX.js";
|
|
3
|
-
const U = (o,
|
|
3
|
+
const U = (o, d) => {
|
|
4
4
|
const t = o.__vccOpts || o;
|
|
5
|
-
for (const [e, n] of
|
|
5
|
+
for (const [e, n] of d)
|
|
6
6
|
t[e] = n;
|
|
7
7
|
return t;
|
|
8
8
|
}, j = {
|
|
@@ -27,12 +27,12 @@ const U = (o, f) => {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}, G = ["href"];
|
|
30
|
-
function H(o,
|
|
31
|
-
return
|
|
30
|
+
function H(o, d, t, e, n, u) {
|
|
31
|
+
return u.isExt ? (i(), f("div", _({
|
|
32
32
|
key: 0,
|
|
33
33
|
style: "mask: url(" + t.iconClass + ") no-repeat 50% 50%;",
|
|
34
34
|
class: "svg-external-icon svg-icon"
|
|
35
|
-
}, o.$attrs), null, 16)) : (i(),
|
|
35
|
+
}, o.$attrs), null, 16)) : (i(), f("svg", _({
|
|
36
36
|
key: 1,
|
|
37
37
|
class: "svg-icon " + t.className,
|
|
38
38
|
"aria-hidden": "true"
|
|
@@ -61,20 +61,20 @@ const b = /* @__PURE__ */ U(j, [["render", H]]), J = ["for"], K = {
|
|
|
61
61
|
modelValue: {},
|
|
62
62
|
modelModifiers: {}
|
|
63
63
|
}),
|
|
64
|
-
emits: /* @__PURE__ */ v(["suffix", "prefix"], ["update:modelValue"]),
|
|
65
|
-
setup(o, { emit:
|
|
64
|
+
emits: /* @__PURE__ */ v(["suffix", "prefix", "focus"], ["update:modelValue"]),
|
|
65
|
+
setup(o, { emit: d }) {
|
|
66
66
|
var h;
|
|
67
|
-
const t = N(o, "modelValue"), e = o, n = V(null),
|
|
68
|
-
l.target.setSelectionRange(t.value.length, t.value.length), n.value !== null && (n.value.style.top = "-.6em");
|
|
67
|
+
const t = N(o, "modelValue"), e = o, n = V(null), u = d, q = (l) => {
|
|
68
|
+
u("focus"), l.target.setSelectionRange(t.value.length, t.value.length), n.value !== null && (n.value.style.top = "-.6em");
|
|
69
69
|
}, C = (l) => {
|
|
70
70
|
var s;
|
|
71
71
|
((s = t.value) == null ? void 0 : s.length) === 0 && n.value !== null && n.value.removeAttribute("style");
|
|
72
72
|
};
|
|
73
73
|
((h = t.value) == null ? void 0 : h.length) > 0 && n.value !== null && (n.value.style.top = "-.6em");
|
|
74
74
|
const E = () => {
|
|
75
|
-
|
|
75
|
+
u("suffix");
|
|
76
76
|
}, w = () => {
|
|
77
|
-
|
|
77
|
+
u("prefix");
|
|
78
78
|
}, z = M(
|
|
79
79
|
() => {
|
|
80
80
|
let l = ["sw-input"];
|
|
@@ -99,7 +99,7 @@ const b = /* @__PURE__ */ U(j, [["render", H]]), J = ["for"], K = {
|
|
|
99
99
|
).replace(/[+()]/g, "\\$&");
|
|
100
100
|
if (g = new RegExp(`^${g}$`), c = c.replace(/[-—]$|(\) )$/g, ""), !g.test(r) || r.length < 5) return c;
|
|
101
101
|
};
|
|
102
|
-
return (l, s) => (i(),
|
|
102
|
+
return (l, s) => (i(), f("div", {
|
|
103
103
|
class: I(z.value)
|
|
104
104
|
}, [
|
|
105
105
|
e.before.length > 0 ? (i(), x(b, {
|
|
@@ -107,14 +107,14 @@ const b = /* @__PURE__ */ U(j, [["render", H]]), J = ["for"], K = {
|
|
|
107
107
|
"icon-class": e.before,
|
|
108
108
|
onClick: w
|
|
109
109
|
}, null, 8, ["icon-class"])) : S(l.$slots, "prefix", { key: 1 }),
|
|
110
|
-
e.label.length > 0 ? (i(),
|
|
110
|
+
e.label.length > 0 ? (i(), f("label", {
|
|
111
111
|
key: 2,
|
|
112
112
|
for: e.name,
|
|
113
113
|
ref_key: "lab",
|
|
114
114
|
ref: n
|
|
115
115
|
}, [
|
|
116
116
|
R(T(e.label), 1),
|
|
117
|
-
e.required ? (i(),
|
|
117
|
+
e.required ? (i(), f("span", K, "*")) : k("", !0)
|
|
118
118
|
], 8, J)) : k("", !0),
|
|
119
119
|
O($("input", {
|
|
120
120
|
"onUpdate:modelValue": s[0] || (s[0] = (r) => t.value = r),
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C["component-sw"]={},C.vue))})(this,function(C,e){"use strict";const P={__name:"SwAlert",props:{message:{type:String,default:"Default message"},before:{type:String,default:""},class:{type:String,default:""},after:{type:String,default:""},size:{type:String,default:""},duration:{type:Number,default:6e3},type:{type:String,default:"info",validator:a=>["success","warning","error","info"].includes(a)}},emits:["closed"],setup(a,{emit:o}){const l=a,n=o,t=e.ref(!1);let p=null;const m=()=>{t.value=!0,f()},w=()=>{t.value=!1,n("closed")},y=()=>{p&&(clearTimeout(p),p=null)},r=()=>{f()},f=()=>{p=setTimeout(w,l.duration)};e.onMounted(()=>{m()}),e.onUnmounted(()=>{p&&clearTimeout(p)});const k=e.computed(()=>{const h=["sw-alert"];return l.size.length>0&&h.push(`sw-${l.size}`),l.type.length>0&&h.push(`sw-${l.type}`),l.class.length>0&&h.push(l.class),h});return(h,i)=>{const u=e.resolveComponent("svg-icon");return e.openBlock(),e.createBlock(e.Transition,{name:"fade"},{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(k.value),onMouseenter:y,onMouseleave:r},[l.before.length>0?(e.openBlock(),e.createBlock(u,{key:0,"icon-class":l.before},null,8,["icon-class"])):e.renderSlot(h.$slots,"prefix",{key:1}),e.renderSlot(h.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.message),1)]),l.after.length>0?(e.openBlock(),e.createBlock(u,{key:2,"icon-class":l.after,onClick:w},null,8,["icon-class"])):e.renderSlot(h.$slots,"suffix",{key:3})],34)):e.createCommentVNode("",!0)]),_:3})}}},U=Object.freeze(Object.defineProperty({__proto__:null,default:P},Symbol.toStringTag,{value:"Module"}));let z=null;function W(a={}){z||(z=document.createElement("div"),document.body.appendChild(z));const{message:o,type:l="info",duration:n=3e3}=a,t=e.createApp({setup(){return()=>e.h(P,{...a,onClose:()=>{z.removeChild(t._container),t.unmount()}})}}),p=t.mount(document.createElement("div"));z.appendChild(p.$el)}const v=Object.assign({"./components/SwAlert.vue":()=>Promise.resolve().then(()=>U),"./components/SwButton.vue":()=>Promise.resolve().then(()=>X),"./components/SwCollapse.vue":()=>Promise.resolve().then(()=>J),"./components/SwDatePicker.vue":()=>Promise.resolve().then(()=>de),"./components/SwDropdown.vue":()=>Promise.resolve().then(()=>pe),"./components/SwDropdownItem.vue":()=>Promise.resolve().then(()=>me),"./components/SwFormItem.vue":()=>Promise.resolve().then(()=>fe),"./components/SwInput.vue":()=>Promise.resolve().then(()=>be),"./components/SwMessage.vue":()=>Promise.resolve().then(()=>Be),"./components/SwSection.vue":()=>Promise.resolve().then(()=>Ee),"./components/SwSelect.vue":()=>Promise.resolve().then(()=>Ce),"./components/SwSkeleton.vue":()=>Promise.resolve().then(()=>xe),"./components/SwSkeletonItem.vue":()=>Promise.resolve().then(()=>Ne),"./components/SwSwitch.vue":()=>Promise.resolve().then(()=>Pe),"./components/SwTabs.vue":()=>Promise.resolve().then(()=>Oe),"./components/SwTabsNew.vue":()=>Promise.resolve().then(()=>Fe),"./components/SwTabsPane.vue":()=>Promise.resolve().then(()=>Ye),"./components/SwTabsPaneNew.vue":()=>Promise.resolve().then(()=>Re)}),j={};for(const a in v){const o=a.split("/").pop().replace(".vue","").replace(/-(\w)/g,(l,n)=>n.toUpperCase());j[o]=e.defineAsyncComponent(()=>v[a]())}const G={install(a){Object.keys(j).forEach(o=>{a.component(o,j[o]),console.log(o)}),a.config.globalProperties.$message=W}},O={__name:"SwButton",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},round:{type:Boolean,default:!1},text:{type:Boolean,default:!1},link:{type:Boolean,default:!1},href:{type:String,default:""}},setup(a){const o=a,l=()=>{if(o.href.length>0){const t=document.createElement("a");t.setAttribute("href",o.href),t.setAttribute("target","_blank"),t.click()}},n=e.computed(()=>{let t=["sw-button"];return o.size.length>0&&t.push("sw-"+o.size),o.type.length>0&&t.push("sw-"+o.type),o.round&&t.push("sw-round"),o.text&&t.push("sw-text"),o.link&&t.push("sw-link"),o.class.length>0&&t.push(o.class),t});return(t,p)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(n.value),onClick:l},[e.renderSlot(t.$slots,"default")],2))}},X=Object.freeze(Object.defineProperty({__proto__:null,default:O},Symbol.toStringTag,{value:"Module"})),J=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwCollapse",props:{visual:{type:Boolean,default:!0}},setup(a){e.onMounted(()=>{n.value="0px"});const o=e.ref(null),l=a,n=e.computed(()=>{var t;return l.visual?((t=o.value)==null?void 0:t.scrollHeight)+"px":"0px"});return(t,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sw-collapse",{open:l.visual}]),style:e.normalizeStyle({height:n.value}),ref_key:"collapse",ref:o},[e.renderSlot(t.$slots,"default")],6))}}},Symbol.toStringTag,{value:"Module"}));function K(a){return/^(https?:|mailto:|tel:)/.test(a)}function N(a,o){if(arguments.length===0||!a)return null;const l=o||"{Y}-{m}-{d} {G}:{i}:{s}";let n;typeof a=="object"?n=a:(typeof a=="string"&&(/^[0-9]+$/.test(a)?a=parseInt(a):a=a.replace(new RegExp(/-/gm),"/")),typeof a=="number"&&a.toString().length===10&&(a=a*1e3),n=new Date(a));const t="ru-RU",p={Y:n.getFullYear(),m:(n.getMonth()+1).toString().padStart(2,"0"),d:n.getDate(),dd:n.getDate().toString().padStart(2,"0"),G:n.getHours(),H:n.getHours().toString().padStart(2,"0"),i:n.getMinutes().toString().padStart(2,"0"),s:n.getSeconds().toString().padStart(2,"0"),D:new Intl.DateTimeFormat(t,{weekday:"short"}).format(n),F:new Intl.DateTimeFormat(t,{month:"long"}).format(n),M:new Intl.DateTimeFormat(t,{month:"short"}).format(n)};return l.replace(/{(dd|[YmdGHisDFM])+}/g,(m,w)=>p[w])}const Q={class:"sw-data-picker"},Z={class:"month_year"},ee={class:"text"},te={class:"week"},le={class:"month"},oe=["onClick"],ne={key:0},ae={class:"month_year"},se={class:"text"},re={class:"week"},ie={class:"month"},ce=["onClick"],de=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDatePicker",props:{data:Object,limitation:{type:[Boolean,Array],default:()=>!1},range:{type:String,default:()=>"solid"}},emits:["input"],setup(a,{emit:o}){var A,Y,L,R,q,H;const l=e.ref(new Date),n=e.ref(new Date),t=a,p=o,m=e.ref(new Date().getFullYear()),w=e.ref(new Date().getMonth()),y=e.ref(new Date().getFullYear()),r=e.ref(new Date().getMonth()),f=e.ref([]),k=e.ref(0),h=e.ref(0),i=e.ref(-1),u=e.ref(-1),B=e.ref(navigator.languages||"ru"),E=/en|zh|ja|he/.test(B.value)?0:1,S=t.range==="range"?2:1,b=g=>{const c=g.split(g.match(/\D.*?\D?/));return c[0].length>2?c.join("-")+"T00:00:01":c.reverse().join("-")+"T00:00:01"};typeof((A=t.data)==null?void 0:A.startDate)<"u"&&((Y=t.data)==null?void 0:Y.startDate)!==null&&(l.value=new Date(b(t.data.startDate)),m.value=l.value.getFullYear(),r.value=l.value.getMonth()),typeof((L=t.data)==null?void 0:L.endDate)<"u"&&((R=t.data)==null?void 0:R.endDate)!==null&&(n.value=new Date(b(t.data.endDate)),y.value=n.value.getFullYear(),w.value=n.value.getMonth());const V=()=>{var s;let g=new Date(m.value,r.value,0);for(let d=g.getDate()-g.getDay()+E;d<=g.getDate()&&g.getDay()!==6+E;d++)k.value++,f.value.push({day:d,month:g.getMonth(),year:g.getFullYear(),class:[]});for(let d=1;d<=new Date(m.value,r.value+1,0).getDate();d++)k.value++,f.value.push({day:d,month:r.value,year:m.value,class:[]});if(t.range==="range"){h.value=new Date(m.value,r.value+2,0);for(let d=1;d<=h.value.getDate();d++)f.value.push({day:d,month:h.value.getMonth(),year:h.value.getFullYear(),class:[]})}let c=new Date(m.value,r.value+S,1);console.log(c.getDay());for(let d=1;d<=(7-c.getDay()+E)%7&&c.getDay()!==E;d++)f.value.push({day:d,month:c.getMonth(),year:c.getFullYear(),class:[]});typeof((s=t.data)==null?void 0:s.holiday)<"u"&&t.data.holiday.length!==0&&(t.data.holiday.preholidays.forEach(d=>{let _=d.split("-");const D=f.value.findIndex($=>$.year==_[0]&&$.month+1==_[1]&&$.day==_[2]);D!==-1&&(f.value[D].class[0]="preholiday")}),t.data.holiday.holidays.forEach(d=>{let _=d.split("-");const D=f.value.findIndex($=>$.year==_[0]&&$.month+1==_[1]&&$.day==_[2]);D!==-1&&(f.value[D].class[0]="weekend")}),t.data.holiday.holiday.forEach(d=>{let _=d.split("-");const D=f.value.findIndex($=>$.year==_[0]&&$.month+1==_[1]&&$.day==_[2]);D!==-1&&(f.value[D].class[0]="holiday")}),t.data.holiday.nowork.forEach(d=>{let _=d.split("-");const D=f.value.findIndex($=>$.year==_[0]&&$.month+1==_[1]&&$.day==_[2]);D!==-1&&(f.value[D].class[0]="nowork")}))},M=(g,c)=>{let s=g-c+1;for(let d=0;d<=g-c;d++)f.value[d+c].class[0]==="holiday"&&s--;return s},x=(g,c)=>{console.log(c);const s=N(new Date(g.year,g.month,g.day),"{dd}.{m}.{Y}");if(t.range==="range")if(console.log(i.value),u.value!==-1){if(u.value<=i.value)for(let d=u.value;d<=i.value;d++)f.value[d].class[1]="";else for(let d=i.value;d<=u.value;d++)f.value[d].class[1]="";i.value=c,u.value=-1,f.value[c].class[1]="active"}else if(i.value!==-1){if(u.value=c,u.value>=i.value)for(let _=i.value+1;_<c;_++)f.value[_].class[1]="select";else for(let _=c+1;_<i.value;_++)f.value[_].class[1]="select";f.value[c].class[1]="active";let d=N(new Date(f.value[i.value].year,f.value[i.value].month,f.value[i.value].day),"{dd}.{m}.{Y}");i.value>c?p("input",{dateStart:s,dateEnd:d,count:M(i.value,c)}):p("input",{dateStart:d,dateEnd:s,count:M(c,i.value)})}else i.value=c,f.value[c].class[1]="active";else i.value!==-1&&(f.value[i.value].class[1]=""),i.value=c,f.value[c].class[1]="active",p("input",{dateStart:s,count:1})};if(V(),typeof((q=t.data)==null?void 0:q.startDate)<"u"&&(i.value=f.value.findIndex(g=>g.day===l.value.getDate()&&g.month===r.value&&g.year===m.value),f.value[i.value].class[1]="active"),typeof((H=t.data)==null?void 0:H.endDate)<"u"&&t.range==="range"){u.value=f.value.findIndex(g=>g.day===n.value.getDate()&&g.month===w.value&&g.year===y.value),f.value[u.value].class[1]="active";for(let g=i.value+1;g<u.value;g++)f.value[g].class[1]="select"}const T=(g,c)=>{qe(g,c)&&(f.value=[],k.value=0,l.value=new Date(g,c,1),m.value=l.value.getFullYear(),r.value=l.value.getMonth(),V())},qe=(g,c)=>{if(!t.limitation)return!0;if(t.limitation[0].dateStart){console.log(t.limitation[0].dateStart);let s=t.limitation[0].dateStart.split(t.limitation[0].dateStart.match(/\D.*?\D?/));if(s[0].length>2&&s.reverse(),parseInt(s[2])>g||parseInt(s[2])===g&&parseInt(s[1])>c+1)return!1}if(t.limitation[t.limitation.length-1].dateEnd){console.log(t.limitation[t.limitation.length-1].dateEnd);let s=t.limitation[t.limitation.length-1].dateEnd.split(t.limitation[t.limitation.length-1].dateEnd.match(/\D.*?\D?/));if(s[0].length>2&&s.reverse(),parseInt(s[2])<g||parseInt(s[2])===g&&parseInt(s[1])<c+S)return!1}return!0};return(g,c)=>(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("div",null,[e.createElementVNode("p",Z,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:c[0]||(c[0]=e.withModifiers(s=>T(m.value-1,r.value),["stop"]))},"«"),e.createElementVNode("button",{onClick:c[1]||(c[1]=e.withModifiers(s=>T(m.value,r.value-1),["stop"]))},"‹")]),e.createElementVNode("span",ee,[e.createElementVNode("button",null,e.toDisplayString(m.value),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(N)(l.value.setMonth(r.value),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:c[2]||(c[2]=e.withModifiers(s=>T(m.value,r.value+1),["stop"]))},"›"),e.createElementVNode("button",{onClick:c[3]||(c[3]=e.withModifiers(s=>T(m.value+1,r.value),["stop"]))},"»")])]),e.createElementVNode("div",te,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(s,d)=>e.createElementVNode("button",{key:d,class:"disabled"},e.toDisplayString(e.unref(N)(new Date(1970,1,s+e.unref(E)),"{D}")),1)),64))]),e.createElementVNode("div",le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(s,d)=>{var _,D;return e.openBlock(),e.createElementBlock(e.Fragment,{key:d},[d<k.value+(7-new Date(m.value,r.value+1,1).getDay()+e.unref(E))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(s.month===r.value&&(!t.limitation||new Date(s.year,s.month,s.day+1).getTime()>new Date(b((_=t.limitation[0])==null?void 0:_.dateStart)).getTime()&&new Date(s.year,s.month,s.day).getTime()<new Date(b((D=t.limitation[0])==null?void 0:D.dateEnd)).getTime())?s.class:"disabled"),onClick:e.withModifiers(()=>{s.month===r.value&&x(s,d)},["stop"])},e.toDisplayString(s.day),11,oe)):e.createCommentVNode("",!0)],64)}),128))])]),t.range==="range"?(e.openBlock(),e.createElementBlock("div",ne,[e.createElementVNode("p",ae,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:c[4]||(c[4]=e.withModifiers(s=>T(m.value-1,r.value),["stop"]))},"«"),e.createElementVNode("button",{onClick:c[5]||(c[5]=e.withModifiers(s=>T(m.value,r.value-1),["stop"]))},"‹")]),e.createElementVNode("span",se,[e.createElementVNode("button",null,e.toDisplayString(new Date(m.value,r.value+1).getFullYear()),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(N)(l.value.setMonth(r.value+1),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:c[6]||(c[6]=e.withModifiers(s=>T(m.value,r.value+1),["stop"]))},"›"),e.createElementVNode("button",{onClick:c[7]||(c[7]=e.withModifiers(s=>T(m.value+1,r.value),["stop"]))},"»")])]),e.createElementVNode("div",re,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(s,d)=>e.createElementVNode("button",{key:d,class:"disabled"},e.toDisplayString(e.unref(N)(new Date(1970,1,s+e.unref(E)),"{D}")),1)),64))]),e.createElementVNode("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(s,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d},[d>=k.value-(7+new Date(m.value,r.value+1,1).getDay()-e.unref(E))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(s.month===h.value.getMonth()&&(!t.limitation||new Date(s.year,s.month,s.day+1).getTime()>new Date(b(t.limitation[0].dateStart)).getTime()&&new Date(s.year,s.month,s.day).getTime()<new Date(b(t.limitation[0].dateEnd)).getTime())?s.class:"disabled"),onClick:e.withModifiers(()=>{s.month===h.value.getMonth()&&x(s,d)},["stop"])},e.toDisplayString(s.day),11,ce)):e.createCommentVNode("",!0)],64))),128))])])):e.createCommentVNode("",!0)]))}}},Symbol.toStringTag,{value:"Module"})),pe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdown",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},trigger:{type:String,default:"click"},placement:{type:String,default:"bottom-left"},maxWidth:{type:Number,default:0},manual:{type:Boolean,default:!1}},setup(a){const o=a,l=e.ref(o.manual),n=e.ref(null),t=e.ref(null),p=e.ref({}),m=e.computed(()=>{let h=["sw-dropdown"];return o.size.length>0&&h.push("sw-"+o.size),o.type.length>0&&h.push("sw-"+o.type),h});e.watch(()=>o.manual,h=>{l.value=h,console.log("watch",l.value),l.value&&w()});const w=async()=>{if(await e.nextTick(),!t.value)return;const h=window.pageYOffset||document.documentElement.scrollTop,i=window.pageXOffset||document.documentElement.scrollLeft;document.body.style.position="fixed",document.body.style.top=`-${h}px`,document.body.style.left=`-${i}px`,t.value.focus(),t.value.addEventListener("blur",()=>l.value=!1),document.body.style.position="",document.body.style.top="",document.body.style.left="",document.documentElement.scrollTop=h,document.documentElement.scrollLeft=i;const u=n.value.getBoundingClientRect(),B=t.value.offsetHeight,E=t.value.offsetWidth;console.log("popupHeight",B),console.log("popupWidth",E);let S=u.left+u.width/2+i,b=u.top+u.height/2+h;const[V,M]=o.placement.split("-",2);switch(console.log(o.placement),V){case"bottom":b=b+u.height/2+8;break;case"top":b=b-u.height/2-8-B;break;case"left":S=S-E-u.width/2-8,b=b-B/2;break;case"right":S=S+u.width/2+8,b=b-B/2;break}switch(M){case"left":S=S-u.width/2;break;case"right":S=S-E+u.width/2;break}S<0&&(S=0),b<0&&(b=0),p.value={position:"absolute",top:`${b}px`,left:`${S}px`,maxWidth:o.maxWidth===0?"":`${o.maxWidth}px`}},y=async()=>{o.trigger==="click"&&(l.value=!l.value),l.value&&await w()},r=async()=>{o.trigger==="hover"&&(l.value=!l.value),l.value&&await w()},f=async()=>{o.trigger==="context"&&(l.value=!l.value),l.value&&await w()},k=()=>{l.value&&w()};return e.onMounted(()=>window.addEventListener("resize",k)),e.onUnmounted(()=>window.removeEventListener("resize",k)),(h,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(m.value),onClick:i[0]||(i[0]=e.withModifiers(u=>y(),["stop"])),onMouseover:i[1]||(i[1]=e.withModifiers(u=>r(),["stop"])),onMouseleave:i[2]||(i[2]=e.withModifiers(u=>r(),["stop"])),onContextmenu:i[3]||(i[3]=e.withModifiers(u=>f(),["stop"])),ref_key:"dropdownRef",ref:n},[e.renderSlot(h.$slots,"default"),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("ul",{key:0,ref_key:"popupRef",ref:t,class:e.normalizeClass(["sw-dropdown-popup",o.class]),style:e.normalizeStyle(p.value),tabindex:"-1"},[e.renderSlot(h.$slots,"dropdown")],6)):e.createCommentVNode("",!0)]))],34))}}},Symbol.toStringTag,{value:"Module"})),me=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdownItem",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},iconBefore:{type:String,default:""}},setup(a){const o=a,l=e.computed(()=>{let n=["sw-dropdown-item"];return o.size.length>0&&n.push("sw-"+o.size),o.type.length>0&&n.push("sw-"+o.type),o.class.length>0&&n.push(o.class),n});return(n,t)=>{const p=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(l.value)},[e.createVNode(p,{"icon-class":a.iconBefore},null,8,["icon-class"]),e.renderSlot(n.$slots,"default")],2)}}}},Symbol.toStringTag,{value:"Module"})),fe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwFormItem",props:{class:{type:String,default:""},type:{type:String,default:""}},setup(a){const o=a,l=e.computed(()=>{let n=["sw-form-item"];return o.type.length>0&&n.push("sw-"+o.type),o.class.length>0&&n.push(o.class),n});return(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value)},[e.renderSlot(n.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),ue=(a,o)=>{const l=a.__vccOpts||a;for(const[n,t]of o)l[n]=t;return l},ge={name:"SvgIcon",props:{prefix:{type:String,default:"icon"},iconClass:{type:String,required:!0},className:{type:String,default:""}},computed:{isExt(){return K(this.iconClass)}}},he=["href"];function ye(a,o,l,n,t,p){return p.isExt?(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:0,style:"mask: url("+l.iconClass+") no-repeat 50% 50%;",class:"svg-external-icon svg-icon"},a.$attrs),null,16)):(e.openBlock(),e.createElementBlock("svg",e.mergeProps({key:1,class:"svg-icon "+l.className,"aria-hidden":"true"},a.$attrs),[e.createElementVNode("use",{href:"#"+l.prefix+"-"+l.iconClass},null,8,he)],16))}const I=ue(ge,[["render",ye]]),_e=["for"],Se={key:0,title:"Это поле обязательно для заполнения."},we=["required","placeholder","type","id","name"],be=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwInput",props:e.mergeModels({before:{type:String,default:""},after:{type:String,default:""},placeholder:{type:String,default:""},label:{type:String,default:""},name:{type:String,required:!0},class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:"text"},required:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["suffix","prefix"],["update:modelValue"]),setup(a,{emit:o}){var h;const l=e.useModel(a,"modelValue"),n=a,t=e.ref(null),p=o,m=i=>{i.target.setSelectionRange(l.value.length,l.value.length),t.value!==null&&(t.value.style.top="-.6em")},w=i=>{var u;((u=l.value)==null?void 0:u.length)===0&&t.value!==null&&t.value.removeAttribute("style")};((h=l.value)==null?void 0:h.length)>0&&t.value!==null&&(t.value.style.top="-.6em");const y=()=>{p("suffix")},r=()=>{p("prefix")},f=e.computed(()=>{let i=["sw-input"];return n.size.length>0&&i.push("sw-"+n.size),n.class.length>0&&i.push(n.class),i});e.watch(l,(i,u)=>{n.type==="phone"&&(l.value=k(i,u))});const k=(i,u)=>{if(/^\+[0-9]\s/.test(u)&&i.length===2||/^\+0\s/.test(i))return"";const B=i;if(typeof B>"u"||B.length===0)return B;const E="+0 (___) ___-__-__";let S=0;const b=E.replace(/\D/g,""),V=B.replace(/\D/g,"");let M=E.replace(/[_\d]/g,T=>S<V.length?V.charAt(S++)||b.charAt(S):T);S=M.indexOf("_"),S!==-1&&(S=S<5?3:S,M=M.slice(0,S));let x=E.slice(0,B.length).replace(/_+/g,T=>`\\d{1,${T.length}}`).replace(/[+()]/g,"\\$&");if(x=new RegExp(`^${x}$`),M=M.replace(/[-—]$|(\) )$/g,""),!x.test(B)||B.length<5)return M};return(i,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(f.value)},[n.before.length>0?(e.openBlock(),e.createBlock(I,{key:0,"icon-class":n.before,onClick:r},null,8,["icon-class"])):e.renderSlot(i.$slots,"prefix",{key:1}),n.label.length>0?(e.openBlock(),e.createElementBlock("label",{key:2,for:n.name,ref_key:"lab",ref:t},[e.createTextVNode(e.toDisplayString(n.label),1),n.required?(e.openBlock(),e.createElementBlock("span",Se,"*")):e.createCommentVNode("",!0)],8,_e)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u[0]||(u[0]=B=>l.value=B),required:n.required,placeholder:n.required&&n.label.length===0?n.placeholder+"*":n.placeholder,type:n.type,id:n.name,name:n.name,size:"60",onFocus:m,onBlur:w,maxlength:"128"},null,40,we),[[e.vModelDynamic,l.value]]),n.after.length>0?(e.openBlock(),e.createBlock(I,{key:3,"icon-class":n.after,onClick:y},null,8,["icon-class"])):e.renderSlot(i.$slots,"suffix",{key:4})],2))}}},Symbol.toStringTag,{value:"Module"})),ke={key:0},Be=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwMessage",props:e.mergeModels({name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const o=e.useModel(a,"modelValue"),l=a,n=e.ref(null);return(t,p)=>{const m=e.resolveComponent("svg-icon");return o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["sw-message",l.class]),ref_key:"messageRef",ref:n},[l.name.length>0?(e.openBlock(),e.createElementBlock("header",ke,[e.renderSlot(t.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(l.name)+" ",1),e.createVNode(O,{link:"",type:"primary",onClick:p[0]||(p[0]=w=>o.value=!1)},{default:e.withCtx(()=>[e.createVNode(m,{"icon-class":l.iconAfter},null,8,["icon-class"])]),_:1})])])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[p[1]||(p[1]=e.createTextVNode("111222"))]),e.createElementVNode("footer",null,[e.renderSlot(t.$slots,"footer")])],2)):e.createCommentVNode("",!0)}}}},Symbol.toStringTag,{value:"Module"})),Ee=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSection",props:{name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},setup(a){const o=a;return(l,n)=>{const t=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(o.class)},[e.createElementVNode("header",null,[e.renderSlot(l.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(o.name)+" ",1),e.createVNode(t,{"icon-class":o.iconAfter},null,8,["icon-class"])])]),e.renderSlot(l.$slots,"default"),e.createElementVNode("footer",null,[e.renderSlot(l.$slots,"footer")])],2)}}}},Symbol.toStringTag,{value:"Module"})),$e={class:"popup"},De={class:"wrapper"},Te={class:"scrollbar"},Me=["onClick"],Ce=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSelect",props:e.mergeModels({name:{type:String,default:""},class:{type:String,default:""},placeholder:{type:String,default:""},token:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const o=e.ref({fullText:""}),l=e.ref(!1),n=e.ref([]),t=e.useModel(a,"modelValue"),p=a;e.watch(t.text,y=>{y.length>3&&(o.value.fullText=y)}),e.watch(o.value.fullText,(y,r)=>{l.value=y.length>3&&y.length>r.length,y.length>3&&m()});const m=()=>{let y="https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address";console.log(o.value.fullText),axios.post(y,{query:o.value.fullText},{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Token "+p.token}}).then(r=>{console.log(r.data.suggestions),n.value=r.data.suggestions,n.value.length===1&&w(n.value[0])}).catch(r=>{console.log(r)})},w=y=>{o.value.fullText=y.value,l.value=!1;const r={};r.text=y.value,r.coords=[Number(y.data.geo_lat),Number(y.data.geo_lon)],r.suggestion=y.data,t.value=r};return(y,r)=>{const f=e.resolveComponent("sw-input");return e.openBlock(),e.createElementBlock("div",$e,[e.createVNode(f,{size:"large",modelValue:o.value.fullText,"onUpdate:modelValue":r[0]||(r[0]=k=>o.value.fullText=k),placeholder:a.placeholder},null,8,["modelValue","placeholder"]),e.withDirectives(e.createElementVNode("div",De,[e.createElementVNode("ul",Te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(k,h)=>(e.openBlock(),e.createElementBlock("li",{tabindex:"1",key:h,onClick:i=>w(k)},e.toDisplayString(k.value),9,Me))),128))])],512),[[e.vShow,l.value]])])}}}},Symbol.toStringTag,{value:"Module"})),Ve={key:0},F={__name:"SwSkeletonItem",props:{width:{type:String,default:"100"},class:{type:String,default:""},animate:{type:Boolean,default:!1},size:{type:String,default:""}},setup(a){const o=a,l=e.computed(()=>{let t=["sw-skeleton-item"];return o.size.length>0&&t.push("sw-"+o.size),o.animate&&t.push("sw-animate"),o.class.length>0&&t.push(o.class),t}),n=e.computed(()=>({width:o.width+"%"}));return(t,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value),style:e.normalizeStyle(n.value)},[o.animate?(e.openBlock(),e.createElementBlock("div",Ve)):e.createCommentVNode("",!0)],6))}},Ne=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"})),xe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSkeleton",props:{class:{type:String,default:""},visual:{type:Boolean,default:!1}},setup(a){const o=a;return(l,n)=>o.visual?e.renderSlot(l.$slots,"default",{key:0},()=>[n[0]||(n[0]=e.createTextVNode("1"))]):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["sw-skeleton",o.class])},[e.renderSlot(l.$slots,"skeleton",{},()=>[e.createVNode(F,{animate:"",size:"small"})])],2))}}},Symbol.toStringTag,{value:"Module"})),ze=["name","id"],je=["for","data-onlabel","data-offlabel"],Pe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSwitch",props:e.mergeModels({id:{type:String,default:"checkbox"},class:{type:String,default:""},name:{type:String,default:""},on:{type:String,default:""},off:{type:String,default:""},size:{type:String,default:""},checkbox:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const o=e.useModel(a,"modelValue"),l=a,n=e.computed(()=>{let t=["sw-switch"];return l.size.length>0&&t.push("sw-"+l.size),l.checkbox&&t.push("sw-checkbox"),l.class.length>0&&t.push(l.class),t});return(t,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(n.value)},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",name:l.name,class:"sw-control",id:l.id,"onUpdate:modelValue":p[0]||(p[0]=m=>o.value=m)},null,8,ze),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:l.id,class:"sw-label","data-onlabel":l.on,"data-offlabel":l.off},null,8,je),e.renderSlot(t.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),ve=["onClick"],Oe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabs",props:e.mergeModels({name:{type:String},class:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["tab-click"],["update:modelValue"]),setup(a,{emit:o}){e.ref(0);const l=e.ref([]),n=a,t=e.useModel(a,"modelValue"),p=o;return l.value=e.useSlots().default().filter(m=>m.type.__name==="SwTabsPane"),e.provide("activeTab",t),e.provide("tabs",l),(m,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass("sw-tabs "+n.class)},[e.createElementVNode("header",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(y,r)=>(e.openBlock(),e.createElementBlock("span",{key:r,class:e.normalizeClass([{active:t.value===r}]),onClick:f=>{t.value=r,p("tab-click",r)}},e.toDisplayString(y.props.label||y.props.title),11,ve))),128))]),e.renderSlot(m.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),Ie=["onClick"],Fe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsNew",props:e.mergeModels({name:{type:String},class:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["tab-click"],["update:modelValue"]),setup(a,{emit:o}){e.ref(0);const l=e.ref([]),n=a,t=e.useModel(a,"modelValue"),p=o;return e.provide("activeTab",t),e.provide("tabs",l),e.provide("registerTab",m=>{l.value.push(m)}),(m,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass("sw-tabs "+n.class)},[e.createElementVNode("header",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(y,r)=>(e.openBlock(),e.createElementBlock("span",{key:r,class:e.normalizeClass([{active:t.value===r}]),onClick:f=>{t.value=r,p("tab-click",r)}},e.toDisplayString(y.props.label||y.props.title),11,Ie))),128))]),e.renderSlot(m.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),Ae={key:0,class:"tab-content"},Ye=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsPane",props:{title:{type:String,required:!0}},setup(a){const o=a,l=e.inject("activeTab"),n=e.inject("tabs"),t=e.computed(()=>{const p=n.value.findIndex(m=>m.props.title===o.title);return l.value===p});return(p,m)=>t.value?(e.openBlock(),e.createElementBlock("div",Ae,[e.renderSlot(p.$slots,"default")])):e.createCommentVNode("",!0)}}},Symbol.toStringTag,{value:"Module"})),Le={key:0,class:"tab-content"},Re=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsPaneNew",props:{label:{type:String,required:!0},title:{type:String}},setup(a){const o=a,l=e.inject("registerTab");if(!l)throw new Error("SwTabsPane must be used inside SwTabs");l({props:o});const n=e.inject("activeTab");if(!e.inject("tabs"))throw new Error("Tabs array is not provided by SwTabs");const p=e.inject("tabs").value.length-1;return(m,w)=>e.unref(n)===p?(e.openBlock(),e.createElementBlock("div",Le,[e.renderSlot(m.$slots,"default")])):e.createCommentVNode("",!0)}}},Symbol.toStringTag,{value:"Module"}));C.components=j,C.default=G,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(C,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(C=typeof globalThis<"u"?globalThis:C||self,e(C["component-sw"]={},C.vue))})(this,function(C,e){"use strict";const P={__name:"SwAlert",props:{message:{type:String,default:"Default message"},before:{type:String,default:""},class:{type:String,default:""},after:{type:String,default:""},size:{type:String,default:""},duration:{type:Number,default:6e3},type:{type:String,default:"info",validator:a=>["success","warning","error","info"].includes(a)}},emits:["closed"],setup(a,{emit:o}){const l=a,n=o,t=e.ref(!1);let p=null;const m=()=>{t.value=!0,f()},w=()=>{t.value=!1,n("closed")},y=()=>{p&&(clearTimeout(p),p=null)},r=()=>{f()},f=()=>{p=setTimeout(w,l.duration)};e.onMounted(()=>{m()}),e.onUnmounted(()=>{p&&clearTimeout(p)});const k=e.computed(()=>{const h=["sw-alert"];return l.size.length>0&&h.push(`sw-${l.size}`),l.type.length>0&&h.push(`sw-${l.type}`),l.class.length>0&&h.push(l.class),h});return(h,i)=>{const u=e.resolveComponent("svg-icon");return e.openBlock(),e.createBlock(e.Transition,{name:"fade"},{default:e.withCtx(()=>[t.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(k.value),onMouseenter:y,onMouseleave:r},[l.before.length>0?(e.openBlock(),e.createBlock(u,{key:0,"icon-class":l.before},null,8,["icon-class"])):e.renderSlot(h.$slots,"prefix",{key:1}),e.renderSlot(h.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.message),1)]),l.after.length>0?(e.openBlock(),e.createBlock(u,{key:2,"icon-class":l.after,onClick:w},null,8,["icon-class"])):e.renderSlot(h.$slots,"suffix",{key:3})],34)):e.createCommentVNode("",!0)]),_:3})}}},U=Object.freeze(Object.defineProperty({__proto__:null,default:P},Symbol.toStringTag,{value:"Module"}));let z=null;function W(a={}){z||(z=document.createElement("div"),document.body.appendChild(z));const{message:o,type:l="info",duration:n=3e3}=a,t=e.createApp({setup(){return()=>e.h(P,{...a,onClose:()=>{z.removeChild(t._container),t.unmount()}})}}),p=t.mount(document.createElement("div"));z.appendChild(p.$el)}const v=Object.assign({"./components/SwAlert.vue":()=>Promise.resolve().then(()=>U),"./components/SwButton.vue":()=>Promise.resolve().then(()=>X),"./components/SwCollapse.vue":()=>Promise.resolve().then(()=>J),"./components/SwDatePicker.vue":()=>Promise.resolve().then(()=>de),"./components/SwDropdown.vue":()=>Promise.resolve().then(()=>pe),"./components/SwDropdownItem.vue":()=>Promise.resolve().then(()=>me),"./components/SwFormItem.vue":()=>Promise.resolve().then(()=>fe),"./components/SwInput.vue":()=>Promise.resolve().then(()=>be),"./components/SwMessage.vue":()=>Promise.resolve().then(()=>Be),"./components/SwSection.vue":()=>Promise.resolve().then(()=>Ee),"./components/SwSelect.vue":()=>Promise.resolve().then(()=>Ce),"./components/SwSkeleton.vue":()=>Promise.resolve().then(()=>xe),"./components/SwSkeletonItem.vue":()=>Promise.resolve().then(()=>Ne),"./components/SwSwitch.vue":()=>Promise.resolve().then(()=>Pe),"./components/SwTabs.vue":()=>Promise.resolve().then(()=>Oe),"./components/SwTabsNew.vue":()=>Promise.resolve().then(()=>Fe),"./components/SwTabsPane.vue":()=>Promise.resolve().then(()=>Ye),"./components/SwTabsPaneNew.vue":()=>Promise.resolve().then(()=>Re)}),j={};for(const a in v){const o=a.split("/").pop().replace(".vue","").replace(/-(\w)/g,(l,n)=>n.toUpperCase());j[o]=e.defineAsyncComponent(()=>v[a]())}const G={install(a){Object.keys(j).forEach(o=>{a.component(o,j[o]),console.log(o)}),a.config.globalProperties.$message=W}},O={__name:"SwButton",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},round:{type:Boolean,default:!1},text:{type:Boolean,default:!1},link:{type:Boolean,default:!1},href:{type:String,default:""}},setup(a){const o=a,l=()=>{if(o.href.length>0){const t=document.createElement("a");t.setAttribute("href",o.href),t.setAttribute("target","_blank"),t.click()}},n=e.computed(()=>{let t=["sw-button"];return o.size.length>0&&t.push("sw-"+o.size),o.type.length>0&&t.push("sw-"+o.type),o.round&&t.push("sw-round"),o.text&&t.push("sw-text"),o.link&&t.push("sw-link"),o.class.length>0&&t.push(o.class),t});return(t,p)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(n.value),onClick:l},[e.renderSlot(t.$slots,"default")],2))}},X=Object.freeze(Object.defineProperty({__proto__:null,default:O},Symbol.toStringTag,{value:"Module"})),J=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwCollapse",props:{visual:{type:Boolean,default:!0}},setup(a){e.onMounted(()=>{n.value="0px"});const o=e.ref(null),l=a,n=e.computed(()=>{var t;return l.visual?((t=o.value)==null?void 0:t.scrollHeight)+"px":"0px"});return(t,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["sw-collapse",{open:l.visual}]),style:e.normalizeStyle({height:n.value}),ref_key:"collapse",ref:o},[e.renderSlot(t.$slots,"default")],6))}}},Symbol.toStringTag,{value:"Module"}));function K(a){return/^(https?:|mailto:|tel:)/.test(a)}function N(a,o){if(arguments.length===0||!a)return null;const l=o||"{Y}-{m}-{d} {G}:{i}:{s}";let n;typeof a=="object"?n=a:(typeof a=="string"&&(/^[0-9]+$/.test(a)?a=parseInt(a):a=a.replace(new RegExp(/-/gm),"/")),typeof a=="number"&&a.toString().length===10&&(a=a*1e3),n=new Date(a));const t="ru-RU",p={Y:n.getFullYear(),m:(n.getMonth()+1).toString().padStart(2,"0"),d:n.getDate(),dd:n.getDate().toString().padStart(2,"0"),G:n.getHours(),H:n.getHours().toString().padStart(2,"0"),i:n.getMinutes().toString().padStart(2,"0"),s:n.getSeconds().toString().padStart(2,"0"),D:new Intl.DateTimeFormat(t,{weekday:"short"}).format(n),F:new Intl.DateTimeFormat(t,{month:"long"}).format(n),M:new Intl.DateTimeFormat(t,{month:"short"}).format(n)};return l.replace(/{(dd|[YmdGHisDFM])+}/g,(m,w)=>p[w])}const Q={class:"sw-data-picker"},Z={class:"month_year"},ee={class:"text"},te={class:"week"},le={class:"month"},oe=["onClick"],ne={key:0},ae={class:"month_year"},se={class:"text"},re={class:"week"},ie={class:"month"},ce=["onClick"],de=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDatePicker",props:{data:Object,limitation:{type:[Boolean,Array],default:()=>!1},range:{type:String,default:()=>"solid"}},emits:["input"],setup(a,{emit:o}){var A,Y,L,R,q,H;const l=e.ref(new Date),n=e.ref(new Date),t=a,p=o,m=e.ref(new Date().getFullYear()),w=e.ref(new Date().getMonth()),y=e.ref(new Date().getFullYear()),r=e.ref(new Date().getMonth()),f=e.ref([]),k=e.ref(0),h=e.ref(0),i=e.ref(-1),u=e.ref(-1),B=e.ref(navigator.languages||"ru"),E=/en|zh|ja|he/.test(B.value)?0:1,S=t.range==="range"?2:1,b=g=>{const c=g.split(g.match(/\D.*?\D?/));return c[0].length>2?c.join("-")+"T00:00:01":c.reverse().join("-")+"T00:00:01"};typeof((A=t.data)==null?void 0:A.startDate)<"u"&&((Y=t.data)==null?void 0:Y.startDate)!==null&&(l.value=new Date(b(t.data.startDate)),m.value=l.value.getFullYear(),r.value=l.value.getMonth()),typeof((L=t.data)==null?void 0:L.endDate)<"u"&&((R=t.data)==null?void 0:R.endDate)!==null&&(n.value=new Date(b(t.data.endDate)),y.value=n.value.getFullYear(),w.value=n.value.getMonth());const V=()=>{var s;let g=new Date(m.value,r.value,0);for(let d=g.getDate()-g.getDay()+E;d<=g.getDate()&&g.getDay()!==6+E;d++)k.value++,f.value.push({day:d,month:g.getMonth(),year:g.getFullYear(),class:[]});for(let d=1;d<=new Date(m.value,r.value+1,0).getDate();d++)k.value++,f.value.push({day:d,month:r.value,year:m.value,class:[]});if(t.range==="range"){h.value=new Date(m.value,r.value+2,0);for(let d=1;d<=h.value.getDate();d++)f.value.push({day:d,month:h.value.getMonth(),year:h.value.getFullYear(),class:[]})}let c=new Date(m.value,r.value+S,1);console.log(c.getDay());for(let d=1;d<=(7-c.getDay()+E)%7&&c.getDay()!==E;d++)f.value.push({day:d,month:c.getMonth(),year:c.getFullYear(),class:[]});typeof((s=t.data)==null?void 0:s.holiday)<"u"&&t.data.holiday.length!==0&&(t.data.holiday.preholidays.forEach(d=>{let _=d.split("-");const D=f.value.findIndex($=>$.year==_[0]&&$.month+1==_[1]&&$.day==_[2]);D!==-1&&(f.value[D].class[0]="preholiday")}),t.data.holiday.holidays.forEach(d=>{let _=d.split("-");const D=f.value.findIndex($=>$.year==_[0]&&$.month+1==_[1]&&$.day==_[2]);D!==-1&&(f.value[D].class[0]="weekend")}),t.data.holiday.holiday.forEach(d=>{let _=d.split("-");const D=f.value.findIndex($=>$.year==_[0]&&$.month+1==_[1]&&$.day==_[2]);D!==-1&&(f.value[D].class[0]="holiday")}),t.data.holiday.nowork.forEach(d=>{let _=d.split("-");const D=f.value.findIndex($=>$.year==_[0]&&$.month+1==_[1]&&$.day==_[2]);D!==-1&&(f.value[D].class[0]="nowork")}))},M=(g,c)=>{let s=g-c+1;for(let d=0;d<=g-c;d++)f.value[d+c].class[0]==="holiday"&&s--;return s},x=(g,c)=>{console.log(c);const s=N(new Date(g.year,g.month,g.day),"{dd}.{m}.{Y}");if(t.range==="range")if(console.log(i.value),u.value!==-1){if(u.value<=i.value)for(let d=u.value;d<=i.value;d++)f.value[d].class[1]="";else for(let d=i.value;d<=u.value;d++)f.value[d].class[1]="";i.value=c,u.value=-1,f.value[c].class[1]="active"}else if(i.value!==-1){if(u.value=c,u.value>=i.value)for(let _=i.value+1;_<c;_++)f.value[_].class[1]="select";else for(let _=c+1;_<i.value;_++)f.value[_].class[1]="select";f.value[c].class[1]="active";let d=N(new Date(f.value[i.value].year,f.value[i.value].month,f.value[i.value].day),"{dd}.{m}.{Y}");i.value>c?p("input",{dateStart:s,dateEnd:d,count:M(i.value,c)}):p("input",{dateStart:d,dateEnd:s,count:M(c,i.value)})}else i.value=c,f.value[c].class[1]="active";else i.value!==-1&&(f.value[i.value].class[1]=""),i.value=c,f.value[c].class[1]="active",p("input",{dateStart:s,count:1})};if(V(),typeof((q=t.data)==null?void 0:q.startDate)<"u"&&(i.value=f.value.findIndex(g=>g.day===l.value.getDate()&&g.month===r.value&&g.year===m.value),f.value[i.value].class[1]="active"),typeof((H=t.data)==null?void 0:H.endDate)<"u"&&t.range==="range"){u.value=f.value.findIndex(g=>g.day===n.value.getDate()&&g.month===w.value&&g.year===y.value),f.value[u.value].class[1]="active";for(let g=i.value+1;g<u.value;g++)f.value[g].class[1]="select"}const T=(g,c)=>{qe(g,c)&&(f.value=[],k.value=0,l.value=new Date(g,c,1),m.value=l.value.getFullYear(),r.value=l.value.getMonth(),V())},qe=(g,c)=>{if(!t.limitation)return!0;if(t.limitation[0].dateStart){console.log(t.limitation[0].dateStart);let s=t.limitation[0].dateStart.split(t.limitation[0].dateStart.match(/\D.*?\D?/));if(s[0].length>2&&s.reverse(),parseInt(s[2])>g||parseInt(s[2])===g&&parseInt(s[1])>c+1)return!1}if(t.limitation[t.limitation.length-1].dateEnd){console.log(t.limitation[t.limitation.length-1].dateEnd);let s=t.limitation[t.limitation.length-1].dateEnd.split(t.limitation[t.limitation.length-1].dateEnd.match(/\D.*?\D?/));if(s[0].length>2&&s.reverse(),parseInt(s[2])<g||parseInt(s[2])===g&&parseInt(s[1])<c+S)return!1}return!0};return(g,c)=>(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("div",null,[e.createElementVNode("p",Z,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:c[0]||(c[0]=e.withModifiers(s=>T(m.value-1,r.value),["stop"]))},"«"),e.createElementVNode("button",{onClick:c[1]||(c[1]=e.withModifiers(s=>T(m.value,r.value-1),["stop"]))},"‹")]),e.createElementVNode("span",ee,[e.createElementVNode("button",null,e.toDisplayString(m.value),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(N)(l.value.setMonth(r.value),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:c[2]||(c[2]=e.withModifiers(s=>T(m.value,r.value+1),["stop"]))},"›"),e.createElementVNode("button",{onClick:c[3]||(c[3]=e.withModifiers(s=>T(m.value+1,r.value),["stop"]))},"»")])]),e.createElementVNode("div",te,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(s,d)=>e.createElementVNode("button",{key:d,class:"disabled"},e.toDisplayString(e.unref(N)(new Date(1970,1,s+e.unref(E)),"{D}")),1)),64))]),e.createElementVNode("div",le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(s,d)=>{var _,D;return e.openBlock(),e.createElementBlock(e.Fragment,{key:d},[d<k.value+(7-new Date(m.value,r.value+1,1).getDay()+e.unref(E))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(s.month===r.value&&(!t.limitation||new Date(s.year,s.month,s.day+1).getTime()>new Date(b((_=t.limitation[0])==null?void 0:_.dateStart)).getTime()&&new Date(s.year,s.month,s.day).getTime()<new Date(b((D=t.limitation[0])==null?void 0:D.dateEnd)).getTime())?s.class:"disabled"),onClick:e.withModifiers(()=>{s.month===r.value&&x(s,d)},["stop"])},e.toDisplayString(s.day),11,oe)):e.createCommentVNode("",!0)],64)}),128))])]),t.range==="range"?(e.openBlock(),e.createElementBlock("div",ne,[e.createElementVNode("p",ae,[e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:c[4]||(c[4]=e.withModifiers(s=>T(m.value-1,r.value),["stop"]))},"«"),e.createElementVNode("button",{onClick:c[5]||(c[5]=e.withModifiers(s=>T(m.value,r.value-1),["stop"]))},"‹")]),e.createElementVNode("span",se,[e.createElementVNode("button",null,e.toDisplayString(new Date(m.value,r.value+1).getFullYear()),1),e.createElementVNode("button",null,e.toDisplayString(e.unref(N)(l.value.setMonth(r.value+1),"{F}")),1)]),e.createElementVNode("span",null,[e.createElementVNode("button",{onClick:c[6]||(c[6]=e.withModifiers(s=>T(m.value,r.value+1),["stop"]))},"›"),e.createElementVNode("button",{onClick:c[7]||(c[7]=e.withModifiers(s=>T(m.value+1,r.value),["stop"]))},"»")])]),e.createElementVNode("div",re,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(7,(s,d)=>e.createElementVNode("button",{key:d,class:"disabled"},e.toDisplayString(e.unref(N)(new Date(1970,1,s+e.unref(E)),"{D}")),1)),64))]),e.createElementVNode("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(s,d)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d},[d>=k.value-(7+new Date(m.value,r.value+1,1).getDay()-e.unref(E))%7?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(s.month===h.value.getMonth()&&(!t.limitation||new Date(s.year,s.month,s.day+1).getTime()>new Date(b(t.limitation[0].dateStart)).getTime()&&new Date(s.year,s.month,s.day).getTime()<new Date(b(t.limitation[0].dateEnd)).getTime())?s.class:"disabled"),onClick:e.withModifiers(()=>{s.month===h.value.getMonth()&&x(s,d)},["stop"])},e.toDisplayString(s.day),11,ce)):e.createCommentVNode("",!0)],64))),128))])])):e.createCommentVNode("",!0)]))}}},Symbol.toStringTag,{value:"Module"})),pe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdown",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},trigger:{type:String,default:"click"},placement:{type:String,default:"bottom-left"},maxWidth:{type:Number,default:0},manual:{type:Boolean,default:!1}},setup(a){const o=a,l=e.ref(!1),n=e.ref(null),t=e.ref(null),p=e.ref({}),m=e.computed(()=>{let h=["sw-dropdown"];return o.size.length>0&&h.push("sw-"+o.size),o.type.length>0&&h.push("sw-"+o.type),h});e.watch(()=>o.manual,h=>{l.value=h,console.log("watch",l.value),l.value&&w()});const w=async()=>{if(await e.nextTick(),!t.value)return;const h=window.pageYOffset||document.documentElement.scrollTop,i=window.pageXOffset||document.documentElement.scrollLeft;document.body.style.position="fixed",document.body.style.top=`-${h}px`,document.body.style.left=`-${i}px`,t.value.focus(),t.value.addEventListener("blur",()=>l.value=!1),document.body.style.position="",document.body.style.top="",document.body.style.left="",document.documentElement.scrollTop=h,document.documentElement.scrollLeft=i;const u=n.value.getBoundingClientRect(),B=t.value.offsetHeight,E=t.value.offsetWidth;console.log("popupHeight",B),console.log("popupWidth",E);let S=u.left+u.width/2+i,b=u.top+u.height/2+h;const[V,M]=o.placement.split("-",2);switch(console.log(o.placement),V){case"bottom":b=b+u.height/2+8;break;case"top":b=b-u.height/2-8-B;break;case"left":S=S-E-u.width/2-8,b=b-B/2;break;case"right":S=S+u.width/2+8,b=b-B/2;break}switch(M){case"left":S=S-u.width/2;break;case"right":S=S-E+u.width/2;break}S<0&&(S=0),b<0&&(b=0),p.value={position:"absolute",top:`${b}px`,left:`${S}px`,maxWidth:o.maxWidth===0?"":`${o.maxWidth}px`}},y=async()=>{o.trigger==="click"&&(l.value=!l.value),l.value&&await w()},r=async()=>{o.trigger==="hover"&&(l.value=!l.value),l.value&&await w()},f=async()=>{o.trigger==="context"&&(l.value=!l.value),l.value&&await w()},k=()=>{l.value&&w()};return e.onMounted(()=>window.addEventListener("resize",k)),e.onUnmounted(()=>window.removeEventListener("resize",k)),(h,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(m.value),onClick:i[0]||(i[0]=e.withModifiers(u=>y(),["stop"])),onMouseover:i[1]||(i[1]=e.withModifiers(u=>r(),["stop"])),onMouseleave:i[2]||(i[2]=e.withModifiers(u=>r(),["stop"])),onContextmenu:i[3]||(i[3]=e.withModifiers(u=>f(),["stop"])),ref_key:"dropdownRef",ref:n},[e.renderSlot(h.$slots,"default"),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[l.value?(e.openBlock(),e.createElementBlock("ul",{key:0,ref_key:"popupRef",ref:t,class:e.normalizeClass(["sw-dropdown-popup",o.class]),style:e.normalizeStyle(p.value),tabindex:"-1"},[e.renderSlot(h.$slots,"dropdown")],6)):e.createCommentVNode("",!0)]))],34))}}},Symbol.toStringTag,{value:"Module"})),me=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwDropdownItem",props:{class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:""},iconBefore:{type:String,default:""}},setup(a){const o=a,l=e.computed(()=>{let n=["sw-dropdown-item"];return o.size.length>0&&n.push("sw-"+o.size),o.type.length>0&&n.push("sw-"+o.type),o.class.length>0&&n.push(o.class),n});return(n,t)=>{const p=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(l.value)},[e.createVNode(p,{"icon-class":a.iconBefore},null,8,["icon-class"]),e.renderSlot(n.$slots,"default")],2)}}}},Symbol.toStringTag,{value:"Module"})),fe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwFormItem",props:{class:{type:String,default:""},type:{type:String,default:""}},setup(a){const o=a,l=e.computed(()=>{let n=["sw-form-item"];return o.type.length>0&&n.push("sw-"+o.type),o.class.length>0&&n.push(o.class),n});return(n,t)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value)},[e.renderSlot(n.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),ue=(a,o)=>{const l=a.__vccOpts||a;for(const[n,t]of o)l[n]=t;return l},ge={name:"SvgIcon",props:{prefix:{type:String,default:"icon"},iconClass:{type:String,required:!0},className:{type:String,default:""}},computed:{isExt(){return K(this.iconClass)}}},he=["href"];function ye(a,o,l,n,t,p){return p.isExt?(e.openBlock(),e.createElementBlock("div",e.mergeProps({key:0,style:"mask: url("+l.iconClass+") no-repeat 50% 50%;",class:"svg-external-icon svg-icon"},a.$attrs),null,16)):(e.openBlock(),e.createElementBlock("svg",e.mergeProps({key:1,class:"svg-icon "+l.className,"aria-hidden":"true"},a.$attrs),[e.createElementVNode("use",{href:"#"+l.prefix+"-"+l.iconClass},null,8,he)],16))}const I=ue(ge,[["render",ye]]),_e=["for"],Se={key:0,title:"Это поле обязательно для заполнения."},we=["required","placeholder","type","id","name"],be=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwInput",props:e.mergeModels({before:{type:String,default:""},after:{type:String,default:""},placeholder:{type:String,default:""},label:{type:String,default:""},name:{type:String,required:!0},class:{type:String,default:""},size:{type:String,default:""},type:{type:String,default:"text"},required:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["suffix","prefix","focus"],["update:modelValue"]),setup(a,{emit:o}){var h;const l=e.useModel(a,"modelValue"),n=a,t=e.ref(null),p=o,m=i=>{p("focus"),i.target.setSelectionRange(l.value.length,l.value.length),t.value!==null&&(t.value.style.top="-.6em")},w=i=>{var u;((u=l.value)==null?void 0:u.length)===0&&t.value!==null&&t.value.removeAttribute("style")};((h=l.value)==null?void 0:h.length)>0&&t.value!==null&&(t.value.style.top="-.6em");const y=()=>{p("suffix")},r=()=>{p("prefix")},f=e.computed(()=>{let i=["sw-input"];return n.size.length>0&&i.push("sw-"+n.size),n.class.length>0&&i.push(n.class),i});e.watch(l,(i,u)=>{n.type==="phone"&&(l.value=k(i,u))});const k=(i,u)=>{if(/^\+[0-9]\s/.test(u)&&i.length===2||/^\+0\s/.test(i))return"";const B=i;if(typeof B>"u"||B.length===0)return B;const E="+0 (___) ___-__-__";let S=0;const b=E.replace(/\D/g,""),V=B.replace(/\D/g,"");let M=E.replace(/[_\d]/g,T=>S<V.length?V.charAt(S++)||b.charAt(S):T);S=M.indexOf("_"),S!==-1&&(S=S<5?3:S,M=M.slice(0,S));let x=E.slice(0,B.length).replace(/_+/g,T=>`\\d{1,${T.length}}`).replace(/[+()]/g,"\\$&");if(x=new RegExp(`^${x}$`),M=M.replace(/[-—]$|(\) )$/g,""),!x.test(B)||B.length<5)return M};return(i,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(f.value)},[n.before.length>0?(e.openBlock(),e.createBlock(I,{key:0,"icon-class":n.before,onClick:r},null,8,["icon-class"])):e.renderSlot(i.$slots,"prefix",{key:1}),n.label.length>0?(e.openBlock(),e.createElementBlock("label",{key:2,for:n.name,ref_key:"lab",ref:t},[e.createTextVNode(e.toDisplayString(n.label),1),n.required?(e.openBlock(),e.createElementBlock("span",Se,"*")):e.createCommentVNode("",!0)],8,_e)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u[0]||(u[0]=B=>l.value=B),required:n.required,placeholder:n.required&&n.label.length===0?n.placeholder+"*":n.placeholder,type:n.type,id:n.name,name:n.name,size:"60",onFocus:m,onBlur:w,maxlength:"128"},null,40,we),[[e.vModelDynamic,l.value]]),n.after.length>0?(e.openBlock(),e.createBlock(I,{key:3,"icon-class":n.after,onClick:y},null,8,["icon-class"])):e.renderSlot(i.$slots,"suffix",{key:4})],2))}}},Symbol.toStringTag,{value:"Module"})),ke={key:0},Be=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwMessage",props:e.mergeModels({name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const o=e.useModel(a,"modelValue"),l=a,n=e.ref(null);return(t,p)=>{const m=e.resolveComponent("svg-icon");return o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["sw-message",l.class]),ref_key:"messageRef",ref:n},[l.name.length>0?(e.openBlock(),e.createElementBlock("header",ke,[e.renderSlot(t.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(l.name)+" ",1),e.createVNode(O,{link:"",type:"primary",onClick:p[0]||(p[0]=w=>o.value=!1)},{default:e.withCtx(()=>[e.createVNode(m,{"icon-class":l.iconAfter},null,8,["icon-class"])]),_:1})])])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[p[1]||(p[1]=e.createTextVNode("111222"))]),e.createElementVNode("footer",null,[e.renderSlot(t.$slots,"footer")])],2)):e.createCommentVNode("",!0)}}}},Symbol.toStringTag,{value:"Module"})),Ee=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSection",props:{name:{type:String,default:""},class:{type:String,default:""},iconAfter:{type:String,default:""}},setup(a){const o=a;return(l,n)=>{const t=e.resolveComponent("svg-icon");return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(o.class)},[e.createElementVNode("header",null,[e.renderSlot(l.$slots,"header",{},()=>[e.createTextVNode(e.toDisplayString(o.name)+" ",1),e.createVNode(t,{"icon-class":o.iconAfter},null,8,["icon-class"])])]),e.renderSlot(l.$slots,"default"),e.createElementVNode("footer",null,[e.renderSlot(l.$slots,"footer")])],2)}}}},Symbol.toStringTag,{value:"Module"})),$e={class:"popup"},De={class:"wrapper"},Te={class:"scrollbar"},Me=["onClick"],Ce=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSelect",props:e.mergeModels({name:{type:String,default:""},class:{type:String,default:""},placeholder:{type:String,default:""},token:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const o=e.ref({fullText:""}),l=e.ref(!1),n=e.ref([]),t=e.useModel(a,"modelValue"),p=a;e.watch(t.text,y=>{y.length>3&&(o.value.fullText=y)}),e.watch(o.value.fullText,(y,r)=>{l.value=y.length>3&&y.length>r.length,y.length>3&&m()});const m=()=>{let y="https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address";console.log(o.value.fullText),axios.post(y,{query:o.value.fullText},{headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Token "+p.token}}).then(r=>{console.log(r.data.suggestions),n.value=r.data.suggestions,n.value.length===1&&w(n.value[0])}).catch(r=>{console.log(r)})},w=y=>{o.value.fullText=y.value,l.value=!1;const r={};r.text=y.value,r.coords=[Number(y.data.geo_lat),Number(y.data.geo_lon)],r.suggestion=y.data,t.value=r};return(y,r)=>{const f=e.resolveComponent("sw-input");return e.openBlock(),e.createElementBlock("div",$e,[e.createVNode(f,{size:"large",modelValue:o.value.fullText,"onUpdate:modelValue":r[0]||(r[0]=k=>o.value.fullText=k),placeholder:a.placeholder},null,8,["modelValue","placeholder"]),e.withDirectives(e.createElementVNode("div",De,[e.createElementVNode("ul",Te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(k,h)=>(e.openBlock(),e.createElementBlock("li",{tabindex:"1",key:h,onClick:i=>w(k)},e.toDisplayString(k.value),9,Me))),128))])],512),[[e.vShow,l.value]])])}}}},Symbol.toStringTag,{value:"Module"})),Ve={key:0},F={__name:"SwSkeletonItem",props:{width:{type:String,default:"100"},class:{type:String,default:""},animate:{type:Boolean,default:!1},size:{type:String,default:""}},setup(a){const o=a,l=e.computed(()=>{let t=["sw-skeleton-item"];return o.size.length>0&&t.push("sw-"+o.size),o.animate&&t.push("sw-animate"),o.class.length>0&&t.push(o.class),t}),n=e.computed(()=>({width:o.width+"%"}));return(t,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value),style:e.normalizeStyle(n.value)},[o.animate?(e.openBlock(),e.createElementBlock("div",Ve)):e.createCommentVNode("",!0)],6))}},Ne=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"})),xe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSkeleton",props:{class:{type:String,default:""},visual:{type:Boolean,default:!1}},setup(a){const o=a;return(l,n)=>o.visual?e.renderSlot(l.$slots,"default",{key:0},()=>[n[0]||(n[0]=e.createTextVNode("1"))]):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["sw-skeleton",o.class])},[e.renderSlot(l.$slots,"skeleton",{},()=>[e.createVNode(F,{animate:"",size:"small"})])],2))}}},Symbol.toStringTag,{value:"Module"})),ze=["name","id"],je=["for","data-onlabel","data-offlabel"],Pe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwSwitch",props:e.mergeModels({id:{type:String,default:"checkbox"},class:{type:String,default:""},name:{type:String,default:""},on:{type:String,default:""},off:{type:String,default:""},size:{type:String,default:""},checkbox:{type:Boolean,default:!1}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const o=e.useModel(a,"modelValue"),l=a,n=e.computed(()=>{let t=["sw-switch"];return l.size.length>0&&t.push("sw-"+l.size),l.checkbox&&t.push("sw-checkbox"),l.class.length>0&&t.push(l.class),t});return(t,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(n.value)},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",name:l.name,class:"sw-control",id:l.id,"onUpdate:modelValue":p[0]||(p[0]=m=>o.value=m)},null,8,ze),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:l.id,class:"sw-label","data-onlabel":l.on,"data-offlabel":l.off},null,8,je),e.renderSlot(t.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),ve=["onClick"],Oe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabs",props:e.mergeModels({name:{type:String},class:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["tab-click"],["update:modelValue"]),setup(a,{emit:o}){e.ref(0);const l=e.ref([]),n=a,t=e.useModel(a,"modelValue"),p=o;return l.value=e.useSlots().default().filter(m=>m.type.__name==="SwTabsPane"),e.provide("activeTab",t),e.provide("tabs",l),(m,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass("sw-tabs "+n.class)},[e.createElementVNode("header",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(y,r)=>(e.openBlock(),e.createElementBlock("span",{key:r,class:e.normalizeClass([{active:t.value===r}]),onClick:f=>{t.value=r,p("tab-click",r)}},e.toDisplayString(y.props.label||y.props.title),11,ve))),128))]),e.renderSlot(m.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),Ie=["onClick"],Fe=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsNew",props:e.mergeModels({name:{type:String},class:{type:String,default:""}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["tab-click"],["update:modelValue"]),setup(a,{emit:o}){e.ref(0);const l=e.ref([]),n=a,t=e.useModel(a,"modelValue"),p=o;return e.provide("activeTab",t),e.provide("tabs",l),e.provide("registerTab",m=>{l.value.push(m)}),(m,w)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass("sw-tabs "+n.class)},[e.createElementVNode("header",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(y,r)=>(e.openBlock(),e.createElementBlock("span",{key:r,class:e.normalizeClass([{active:t.value===r}]),onClick:f=>{t.value=r,p("tab-click",r)}},e.toDisplayString(y.props.label||y.props.title),11,Ie))),128))]),e.renderSlot(m.$slots,"default")],2))}}},Symbol.toStringTag,{value:"Module"})),Ae={key:0,class:"tab-content"},Ye=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsPane",props:{title:{type:String,required:!0}},setup(a){const o=a,l=e.inject("activeTab"),n=e.inject("tabs"),t=e.computed(()=>{const p=n.value.findIndex(m=>m.props.title===o.title);return l.value===p});return(p,m)=>t.value?(e.openBlock(),e.createElementBlock("div",Ae,[e.renderSlot(p.$slots,"default")])):e.createCommentVNode("",!0)}}},Symbol.toStringTag,{value:"Module"})),Le={key:0,class:"tab-content"},Re=Object.freeze(Object.defineProperty({__proto__:null,default:{__name:"SwTabsPaneNew",props:{label:{type:String,required:!0},title:{type:String}},setup(a){const o=a,l=e.inject("registerTab");if(!l)throw new Error("SwTabsPane must be used inside SwTabs");l({props:o});const n=e.inject("activeTab");if(!e.inject("tabs"))throw new Error("Tabs array is not provided by SwTabs");const p=e.inject("tabs").value.length-1;return(m,w)=>e.unref(n)===p?(e.openBlock(),e.createElementBlock("div",Le,[e.renderSlot(m.$slots,"default")])):e.createCommentVNode("",!0)}}},Symbol.toStringTag,{value:"Module"}));C.components=j,C.default=G,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/index.js
CHANGED
|
@@ -85,7 +85,7 @@ function O(t = {}) {
|
|
|
85
85
|
}), n = r.mount(document.createElement("div"));
|
|
86
86
|
c.appendChild(n.$el);
|
|
87
87
|
}
|
|
88
|
-
const v = /* @__PURE__ */ Object.assign({ "./components/SwAlert.vue": () => Promise.resolve().then(() => I), "./components/SwButton.vue": () => import("./SwButton-0uPLNlAn.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-DxAVOWF1.js"), "./components/SwDatePicker.vue": () => import("./SwDatePicker-w-_v2i4C.js"), "./components/SwDropdown.vue": () => import("./SwDropdown-
|
|
88
|
+
const v = /* @__PURE__ */ Object.assign({ "./components/SwAlert.vue": () => Promise.resolve().then(() => I), "./components/SwButton.vue": () => import("./SwButton-0uPLNlAn.js"), "./components/SwCollapse.vue": () => import("./SwCollapse-DxAVOWF1.js"), "./components/SwDatePicker.vue": () => import("./SwDatePicker-w-_v2i4C.js"), "./components/SwDropdown.vue": () => import("./SwDropdown-BCuumz7q.js"), "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-C3_wJ1DL.js"), "./components/SwFormItem.vue": () => import("./SwFormItem-CfnEis1u.js"), "./components/SwInput.vue": () => import("./SwInput-y4HWBBjJ.js"), "./components/SwMessage.vue": () => import("./SwMessage-BB2yKYsR.js"), "./components/SwSection.vue": () => import("./SwSection-CaY8OFmf.js"), "./components/SwSelect.vue": () => import("./SwSelect-0vcmQ8qv.js"), "./components/SwSkeleton.vue": () => import("./SwSkeleton-DWILNFfF.js"), "./components/SwSkeletonItem.vue": () => import("./SwSkeletonItem-CU7LvihY.js"), "./components/SwSwitch.vue": () => import("./SwSwitch-BxSLWRTx.js"), "./components/SwTabs.vue": () => import("./SwTabs-DgvDpw7u.js"), "./components/SwTabsNew.vue": () => import("./SwTabsNew-Dr5Vyz6M.js"), "./components/SwTabsPane.vue": () => import("./SwTabsPane-BUUmFjh7.js"), "./components/SwTabsPaneNew.vue": () => import("./SwTabsPaneNew-DFPu-sRT.js") }), m = {};
|
|
89
89
|
for (const t in v) {
|
|
90
90
|
const o = t.split("/").pop().replace(".vue", "").replace(/-(\w)/g, (e, l) => l.toUpperCase());
|
|
91
91
|
m[o] = E(() => v[t]());
|