@nutui/nutui 4.0.9 → 4.0.10
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/CHANGELOG.md +17 -0
- package/dist/nutui.es.js +1 -1
- package/dist/nutui.js +15382 -0
- package/dist/nutui.umd.js +1 -7
- package/dist/packages/_es/ActionSheet.js +78 -111
- package/dist/packages/_es/Address.js +250 -375
- package/dist/packages/_es/AddressList.js +269 -354
- package/dist/packages/_es/Animate.js +41 -58
- package/dist/packages/_es/Audio.js +128 -197
- package/dist/packages/_es/AudioOperate.js +60 -71
- package/dist/packages/_es/Avatar.js +66 -89
- package/dist/packages/_es/AvatarGroup.js +23 -31
- package/dist/packages/_es/Backtop.js +59 -99
- package/dist/packages/_es/Badge.js +36 -47
- package/dist/packages/_es/Barrage.js +68 -147
- package/dist/packages/_es/Button.js +47 -66
- package/dist/packages/_es/Calendar.js +135 -157
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +42 -56
- package/dist/packages/_es/Cascader.js +315 -474
- package/dist/packages/_es/Category.js +29 -39
- package/dist/packages/_es/CategoryPane.js +57 -83
- package/dist/packages/_es/Cell.js +56 -71
- package/dist/packages/_es/CellGroup.js +19 -27
- package/dist/packages/_es/Checkbox.js +109 -156
- package/dist/packages/_es/CheckboxGroup.js +38 -59
- package/dist/packages/_es/CircleProgress.js +67 -96
- package/dist/packages/_es/Col.js +23 -31
- package/dist/packages/_es/Collapse.js +33 -58
- package/dist/packages/_es/CollapseItem.js +78 -108
- package/dist/packages/_es/Comment.js +207 -279
- package/dist/packages/_es/ConfigProvider.js +37 -55
- package/dist/packages/_es/Countdown.js +100 -212
- package/dist/packages/_es/Countup.js +232 -445
- package/dist/packages/_es/DatePicker.js +162 -265
- package/dist/packages/_es/Dialog.js +161 -213
- package/dist/packages/_es/Divider.js +42 -57
- package/dist/packages/_es/Drag.js +70 -153
- package/dist/packages/_es/Ecard.js +64 -104
- package/dist/packages/_es/Elevator.js +143 -219
- package/dist/packages/_es/Ellipsis.js +95 -178
- package/dist/packages/_es/Empty.js +23 -39
- package/dist/packages/_es/FixedNav.js +93 -116
- package/dist/packages/_es/Form.js +107 -178
- package/dist/packages/_es/FormItem.js +48 -61
- package/dist/packages/_es/Grid.js +5 -6
- package/dist/packages/_es/GridItem.js +58 -84
- package/dist/packages/_es/Image.js +90 -129
- package/dist/packages/_es/ImagePreview.js +256 -412
- package/dist/packages/_es/Indicator.js +30 -34
- package/dist/packages/_es/InfiniteLoading.js +83 -136
- package/dist/packages/_es/Input.js +160 -264
- package/dist/packages/_es/InputNumber.js +81 -117
- package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
- package/dist/packages/_es/Invoice.js +104 -130
- package/dist/packages/_es/Layout.js +3 -4
- package/dist/packages/_es/List.js +117 -215
- package/dist/packages/_es/Menu.js +96 -152
- package/dist/packages/_es/MenuItem.js +117 -172
- package/dist/packages/_es/Navbar.js +103 -119
- package/dist/packages/_es/Noticebar.js +197 -312
- package/dist/packages/_es/Notify.js +110 -166
- package/dist/packages/_es/NumberKeyboard.js +127 -202
- package/dist/packages/_es/Overlay.js +52 -80
- package/dist/packages/_es/Pagination.js +70 -100
- package/dist/packages/_es/Picker.js +275 -441
- package/dist/packages/_es/Popover.js +122 -225
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +44 -82
- package/dist/packages/_es/Progress.js +63 -79
- package/dist/packages/_es/PullRefresh.js +95 -173
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +204 -347
- package/dist/packages/_es/Rate.js +92 -141
- package/dist/packages/_es/Row.js +21 -27
- package/dist/packages/_es/Searchbar.js +130 -179
- package/dist/packages/_es/ShortPassword.js +69 -93
- package/dist/packages/_es/SideNavbar.js +49 -80
- package/dist/packages/_es/SideNavbarItem.js +22 -32
- package/dist/packages/_es/Signature.js +83 -146
- package/dist/packages/_es/Skeleton.js +110 -130
- package/dist/packages/_es/Sku.js +250 -343
- package/dist/packages/_es/Step.js +59 -86
- package/dist/packages/_es/Steps.js +26 -31
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +52 -74
- package/dist/packages/_es/Swipe.js +83 -155
- package/dist/packages/_es/Swiper.js +174 -311
- package/dist/packages/_es/SwiperItem.js +28 -44
- package/dist/packages/_es/Switch.js +55 -68
- package/dist/packages/_es/TabPane.js +30 -41
- package/dist/packages/_es/Tabbar.js +41 -52
- package/dist/packages/_es/TabbarItem.js +61 -82
- package/dist/packages/_es/Table.js +109 -165
- package/dist/packages/_es/Tabs.js +240 -388
- package/dist/packages/_es/Tag.js +44 -61
- package/dist/packages/_es/Textarea.js +80 -124
- package/dist/packages/_es/TimeDetail.js +49 -76
- package/dist/packages/_es/TimePannel.js +34 -48
- package/dist/packages/_es/TimeSelect.js +47 -68
- package/dist/packages/_es/Toast.js +144 -218
- package/dist/packages/_es/Tour.js +138 -192
- package/dist/packages/_es/TrendArrow.js +57 -77
- package/dist/packages/_es/Uploader.js +234 -359
- package/dist/packages/_es/Video.js +191 -316
- package/dist/packages/_es/Watermark.js +84 -117
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
- package/dist/packages/_es/common-d218746f.js +116 -0
- package/dist/packages/_es/component-234624bc.js +89 -0
- package/dist/packages/_es/index-14dfadc4.js +561 -0
- package/dist/packages/_es/index-192a3ef6.js +29 -0
- package/dist/packages/_es/index-360c5092.js +210 -0
- package/dist/packages/_es/index-496e6e05.js +24 -0
- package/dist/packages/_es/index-50eed3d9.js +7 -0
- package/dist/packages/_es/index-53ec2d4d.js +34 -0
- package/dist/packages/_es/index-fadb0974.js +8 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
- package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
- package/dist/packages/_es/pxCheck-38173291.js +4 -0
- package/dist/packages/_es/raf-a74f1a06.js +16 -0
- package/dist/packages/_es/renderIcon-47498b32.js +5 -0
- package/dist/packages/col/index.scss +2 -2
- package/dist/packages/menuitem/index.scss +7 -10
- package/dist/packages/searchbar/index.scss +4 -0
- package/dist/smartips/web-types.json +2 -2
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +158 -55
- package/dist/styles/themes/jdb.scss +158 -55
- package/dist/styles/themes/jddkh.scss +158 -55
- package/dist/styles/themes/jdt.scss +158 -55
- package/dist/types/__VUE/address/index.vue.d.ts +1 -1
- package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
- package/dist/types/__VUE/image/index.vue.d.ts +2 -2
- package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
- package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
- package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
- package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
- package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
- package/dist/types/__VUE/row/index.vue.d.ts +1 -1
- package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
- package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
- package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
- package/dist/types/__VUE/table/common.d.ts +55 -2
- package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
- package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
- package/dist/packages/_es/common-b9a5e726.js +0 -145
- package/dist/packages/_es/component-81a4c1d0.js +0 -145
- package/dist/packages/_es/index-29892cda.js +0 -33
- package/dist/packages/_es/index-43c34ac6.js +0 -30
- package/dist/packages/_es/index-54d03fc1.js +0 -8
- package/dist/packages/_es/index-79c5dc33.js +0 -10
- package/dist/packages/_es/index-7a7385e4.js +0 -67
- package/dist/packages/_es/index-87422be8.js +0 -942
- package/dist/packages/_es/index-da0a7662.js +0 -259
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
- package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
- package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
- package/dist/packages/_es/raf-729dad54.js +0 -25
- package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
var ye = Object.defineProperty, ge = Object.defineProperties;
|
|
2
|
+
var pe = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var x = Object.getOwnPropertySymbols;
|
|
4
|
+
var we = Object.prototype.hasOwnProperty, ve = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ee = (t, n, u) => n in t ? ye(t, n, { enumerable: !0, configurable: !0, writable: !0, value: u }) : t[n] = u, F = (t, n) => {
|
|
6
|
+
for (var u in n || (n = {}))
|
|
7
|
+
we.call(n, u) && ee(t, u, n[u]);
|
|
8
|
+
if (x)
|
|
9
|
+
for (var u of x(n))
|
|
10
|
+
ve.call(n, u) && ee(t, u, n[u]);
|
|
11
|
+
return t;
|
|
12
|
+
}, te = (t, n) => ge(t, pe(n));
|
|
13
|
+
import { ref as B, computed as O, reactive as Se, watch as Te, toRefs as ae, openBlock as m, createElementBlock as y, normalizeClass as R, createElementVNode as N, toDisplayString as $, createCommentVNode as A, renderSlot as Y, Fragment as L, renderList as z, normalizeStyle as ke, createTextVNode as _e } from "vue";
|
|
14
|
+
import { c as be } from "./component-234624bc.js";
|
|
15
|
+
import { r as Ne } from "./raf-a74f1a06.js";
|
|
16
|
+
import { u as $e } from "./index-fadb0974.js";
|
|
17
|
+
import { _ as Ae } from "./_plugin-vue_export-helper-dad06003.js";
|
|
18
|
+
const o = {
|
|
19
|
+
/**
|
|
20
|
+
* 是否为闫年
|
|
21
|
+
* @return {Boolse} true|false
|
|
22
|
+
*/
|
|
23
|
+
isLeapYear: function(t) {
|
|
24
|
+
return t % 4 == 0 && t % 100 != 0 || t % 400 == 0;
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* 返回星期数
|
|
28
|
+
* @return {String}
|
|
29
|
+
*/
|
|
30
|
+
getWhatDay: function(t, n, u) {
|
|
31
|
+
const g = (/* @__PURE__ */ new Date(t + "/" + n + "/" + u)).getDay();
|
|
32
|
+
return ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"][g];
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* 返回星期数
|
|
36
|
+
* @return {Number}
|
|
37
|
+
*/
|
|
38
|
+
getMonthPreDay: function(t, n) {
|
|
39
|
+
let h = (/* @__PURE__ */ new Date(t + "/" + n + "/01")).getDay();
|
|
40
|
+
return h == 0 && (h = 7), h;
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* 返回月份天数
|
|
44
|
+
* @return {Number}
|
|
45
|
+
*/
|
|
46
|
+
getMonthDays: function(t, n) {
|
|
47
|
+
return /^0/.test(n) && (n = n.split("")[1]), [0, 31, this.isLeapYear(Number(t)) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][n];
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* 补齐数字位数
|
|
51
|
+
* @return {string}
|
|
52
|
+
*/
|
|
53
|
+
getNumTwoBit: function(t) {
|
|
54
|
+
return t = Number(t), (t > 9 ? "" : "0") + t;
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* 日期对象转成字符串
|
|
58
|
+
* @return {string}
|
|
59
|
+
*/
|
|
60
|
+
date2Str: function(t, n) {
|
|
61
|
+
n = n || "-";
|
|
62
|
+
const u = t.getFullYear(), h = this.getNumTwoBit(t.getMonth() + 1), g = this.getNumTwoBit(t.getDate());
|
|
63
|
+
return [u, h, g].join(n);
|
|
64
|
+
},
|
|
65
|
+
/**
|
|
66
|
+
* 返回日期格式字符串
|
|
67
|
+
* @param {Number} 0返回今天的日期、1返回明天的日期,2返回后天得日期,依次类推
|
|
68
|
+
* @return {string} '2014-12-31'
|
|
69
|
+
*/
|
|
70
|
+
getDay: function(t) {
|
|
71
|
+
t = t || 0;
|
|
72
|
+
let n = /* @__PURE__ */ new Date();
|
|
73
|
+
const u = t * (1e3 * 60 * 60 * 24);
|
|
74
|
+
return n = new Date(n.getTime() + u), this.date2Str(n);
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* 时间比较
|
|
78
|
+
* @return {Boolean}
|
|
79
|
+
*/
|
|
80
|
+
compareDate: function(t, n) {
|
|
81
|
+
const u = new Date(t.replace("-", "/").replace("-", "/")), h = new Date(n.replace("-", "/").replace("-", "/"));
|
|
82
|
+
return !(u >= h);
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* 时间是否相等
|
|
86
|
+
* @return {Boolean}
|
|
87
|
+
*/
|
|
88
|
+
isEqual: function(t, n) {
|
|
89
|
+
const u = new Date(t).getTime(), h = new Date(n).getTime();
|
|
90
|
+
return u == h;
|
|
91
|
+
},
|
|
92
|
+
getMonthWeek: function(t, n, u, h = 0) {
|
|
93
|
+
const g = new Date(Number(t), parseInt(n) - 1, Number(u));
|
|
94
|
+
let c = g.getDay(), D = g.getDate(), p = 6 - c;
|
|
95
|
+
return h !== 0 && (c = c == 0 ? 7 : c, p = 7 - c), Math.ceil((D + p) / 7);
|
|
96
|
+
},
|
|
97
|
+
getYearWeek: function(t, n, u, h = 0) {
|
|
98
|
+
const g = new Date(Number(t), parseInt(n) - 1, Number(u)), c = new Date(Number(t), 0, 1), D = Math.round((g.valueOf() - c.valueOf()) / 864e5);
|
|
99
|
+
return Math.ceil((D + (c.getDay() + 1 - 1)) / 7);
|
|
100
|
+
},
|
|
101
|
+
getWeekDate: function(t, n, u, h = 0) {
|
|
102
|
+
const g = new Date(Number(t), parseInt(n) - 1, Number(u)), c = g.getTime();
|
|
103
|
+
let D = g.getDay();
|
|
104
|
+
if (h === 0) {
|
|
105
|
+
const d = c - D * 864e5, H = c + (6 - D) * 864e5, I = this.date2Str(new Date(d)), P = this.date2Str(new Date(H));
|
|
106
|
+
return [I, P];
|
|
107
|
+
} else {
|
|
108
|
+
D = D == 0 ? 7 : D;
|
|
109
|
+
const p = 24 * 60 * 60 * 1e3, d = c - (D - 1) * p, H = c + (7 - D) * p, I = this.date2Str(new Date(d)), P = this.date2Str(new Date(H));
|
|
110
|
+
return [I, P];
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
formatResultDate: function(t) {
|
|
114
|
+
let n = [...t.split("-")];
|
|
115
|
+
return n[2] = o.getNumTwoBit(Number(n[2])), n[3] = `${n[0]}-${n[1]}-${n[2]}`, n[4] = o.getWhatDay(+n[0], +n[1], +n[2]), n;
|
|
116
|
+
}
|
|
117
|
+
}, { create: He, translate: M } = be("calendar-item"), Ee = He({
|
|
118
|
+
props: {
|
|
119
|
+
type: {
|
|
120
|
+
type: String,
|
|
121
|
+
default: "one"
|
|
122
|
+
},
|
|
123
|
+
isAutoBackFill: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
default: !1
|
|
126
|
+
},
|
|
127
|
+
toDateAnimation: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
default: !0
|
|
130
|
+
},
|
|
131
|
+
poppable: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: !0
|
|
134
|
+
},
|
|
135
|
+
showTitle: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
default: !0
|
|
138
|
+
},
|
|
139
|
+
showSubTitle: {
|
|
140
|
+
type: Boolean,
|
|
141
|
+
default: !0
|
|
142
|
+
},
|
|
143
|
+
showToday: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
default: !0
|
|
146
|
+
},
|
|
147
|
+
title: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: ""
|
|
150
|
+
},
|
|
151
|
+
confirmText: {
|
|
152
|
+
type: String,
|
|
153
|
+
default: ""
|
|
154
|
+
},
|
|
155
|
+
startText: {
|
|
156
|
+
type: String,
|
|
157
|
+
default: ""
|
|
158
|
+
},
|
|
159
|
+
endText: {
|
|
160
|
+
type: String,
|
|
161
|
+
default: ""
|
|
162
|
+
},
|
|
163
|
+
defaultValue: {
|
|
164
|
+
type: [String, Array],
|
|
165
|
+
default: ""
|
|
166
|
+
},
|
|
167
|
+
startDate: {
|
|
168
|
+
type: String,
|
|
169
|
+
default: o.getDay(0)
|
|
170
|
+
},
|
|
171
|
+
endDate: {
|
|
172
|
+
type: String,
|
|
173
|
+
default: o.getDay(365)
|
|
174
|
+
},
|
|
175
|
+
firstDayOfWeek: {
|
|
176
|
+
type: Number,
|
|
177
|
+
default: 0
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
emits: ["choose", "update", "close", "select"],
|
|
181
|
+
setup(t, { emit: n, slots: u }) {
|
|
182
|
+
const h = M("weekdays"), g = B([...h.slice(t.firstDayOfWeek, 7), ...h.slice(0, t.firstDayOfWeek)]), c = B(null), D = B(null), p = B(null), d = B(null), H = B(0), I = O(() => e.monthsData.slice(e.defaultRange[0], e.defaultRange[1])), P = O(() => u.btn), re = O(() => u["top-info"]), ne = O(() => u["bottom-info"]), e = Se({
|
|
183
|
+
yearMonthTitle: "",
|
|
184
|
+
defaultRange: [],
|
|
185
|
+
currDate: "",
|
|
186
|
+
propStartDate: "",
|
|
187
|
+
propEndDate: "",
|
|
188
|
+
unLoadPrev: !1,
|
|
189
|
+
touchParams: {
|
|
190
|
+
startY: 0,
|
|
191
|
+
endY: 0,
|
|
192
|
+
startTime: 0,
|
|
193
|
+
endTime: 0,
|
|
194
|
+
lastY: 0,
|
|
195
|
+
lastTime: 0
|
|
196
|
+
},
|
|
197
|
+
transformY: 0,
|
|
198
|
+
translateY: 0,
|
|
199
|
+
scrollDistance: 0,
|
|
200
|
+
defaultData: [],
|
|
201
|
+
chooseData: [],
|
|
202
|
+
monthsData: [],
|
|
203
|
+
dayPrefix: "nut-calendar__day",
|
|
204
|
+
startData: "",
|
|
205
|
+
endData: "",
|
|
206
|
+
isRange: t.type === "range",
|
|
207
|
+
timer: 0,
|
|
208
|
+
currentIndex: 0,
|
|
209
|
+
avgHeight: 0,
|
|
210
|
+
monthsNum: 0
|
|
211
|
+
}), S = (a) => a.split("-"), U = (a) => o.isEqual(e.currDate[0], a), G = (a) => o.isEqual(e.currDate[1], a), se = (a) => e.currDate.length > 0 ? e.currDate.some((r) => o.isEqual(r, a)) : !1, V = (a, r) => r.curData[0] + "-" + r.curData[1] + "-" + o.getNumTwoBit(+a.day), q = (a, r) => {
|
|
212
|
+
const s = V(a, r), { type: l } = t;
|
|
213
|
+
return a.type == "curr" ? o.isEqual(e.currDate, s) || (l == "range" || l == "week") && (U(s) || G(s)) || l == "multiple" && se(s) ? `${e.dayPrefix}--active` : e.propStartDate && o.compareDate(s, e.propStartDate) || e.propEndDate && o.compareDate(e.propEndDate, s) ? `${e.dayPrefix}--disabled` : (l == "range" || l == "week") && Array.isArray(e.currDate) && Object.values(e.currDate).length == 2 && o.compareDate(e.currDate[0], s) && o.compareDate(s, e.currDate[1]) ? `${e.dayPrefix}--choose` : null : `${e.dayPrefix}--disabled`;
|
|
214
|
+
}, J = () => {
|
|
215
|
+
const { type: a } = t;
|
|
216
|
+
if (a == "range" && e.chooseData.length == 2 || a != "range") {
|
|
217
|
+
let r = e.chooseData.slice(0);
|
|
218
|
+
a == "week" && (r = {
|
|
219
|
+
weekDate: [C(e.chooseData[0]), C(e.chooseData[1])]
|
|
220
|
+
}), n("choose", r), t.poppable && n("update");
|
|
221
|
+
}
|
|
222
|
+
}, W = (a, r, s = !1) => {
|
|
223
|
+
if (q(a, r) != `${e.dayPrefix}--disabled`) {
|
|
224
|
+
const { type: l } = t;
|
|
225
|
+
let i = [...r.curData], [T, w] = r.curData;
|
|
226
|
+
if (i[2] = o.getNumTwoBit(Number(a.day)), i[3] = `${i[0]}-${i[1]}-${i[2]}`, i[4] = o.getWhatDay(+i[0], +i[1], +i[2]), l == "multiple")
|
|
227
|
+
if (e.currDate.length > 0) {
|
|
228
|
+
let f;
|
|
229
|
+
e.currDate.forEach((v, E) => {
|
|
230
|
+
v == i[3] && (f = E);
|
|
231
|
+
}), s ? e.chooseData.push([...i]) : f !== void 0 ? (e.currDate.splice(f, 1), e.chooseData.splice(f, 1)) : (e.currDate.push(i[3]), e.chooseData.push([...i]));
|
|
232
|
+
} else
|
|
233
|
+
e.currDate = [i[3]], e.chooseData = [[...i]];
|
|
234
|
+
else if (l == "range") {
|
|
235
|
+
let f = Object.values(e.currDate).length;
|
|
236
|
+
f == 2 || f == 0 ? e.currDate = [i[3]] : o.compareDate(e.currDate[0], i[3]) ? Array.isArray(e.currDate) && e.currDate.push(i[3]) : Array.isArray(e.currDate) && e.currDate.unshift(i[3]), e.chooseData.length == 2 || !e.chooseData.length ? e.chooseData = [[...i]] : o.compareDate(e.chooseData[0][3], i[3]) ? e.chooseData = [...e.chooseData, [...i]] : e.chooseData = [[...i], ...e.chooseData];
|
|
237
|
+
} else if (l == "week") {
|
|
238
|
+
let f = o.getWeekDate(T, w, a.day, t.firstDayOfWeek);
|
|
239
|
+
e.propStartDate && o.compareDate(f[0], e.propStartDate) && f.splice(0, 1, e.propStartDate), e.propEndDate && o.compareDate(e.propEndDate, f[1]) && f.splice(1, 1, e.propEndDate), e.currDate = f, e.chooseData = [o.formatResultDate(f[0]), o.formatResultDate(f[1])];
|
|
240
|
+
} else
|
|
241
|
+
e.currDate = i[3], e.chooseData = [...i];
|
|
242
|
+
if (!s) {
|
|
243
|
+
let f = e.chooseData;
|
|
244
|
+
l == "week" && (f = {
|
|
245
|
+
weekDate: [
|
|
246
|
+
C(e.chooseData[0]),
|
|
247
|
+
C(e.chooseData[1])
|
|
248
|
+
]
|
|
249
|
+
}), n("select", f), (t.isAutoBackFill || !t.poppable) && J();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}, C = (a) => {
|
|
253
|
+
let [r, s, l] = a;
|
|
254
|
+
return {
|
|
255
|
+
date: a,
|
|
256
|
+
monthWeekNum: o.getMonthWeek(r, s, l, t.firstDayOfWeek),
|
|
257
|
+
yearWeekNum: o.getYearWeek(r, s, l, t.firstDayOfWeek)
|
|
258
|
+
};
|
|
259
|
+
}, oe = (a) => {
|
|
260
|
+
const r = a == "prev" ? e.monthsData[0] : e.monthsData[e.monthsData.length - 1];
|
|
261
|
+
let s = parseInt(r.curData[0]), l = parseInt(r.curData[1].toString().replace(/^0/, ""));
|
|
262
|
+
switch (a) {
|
|
263
|
+
case "prev":
|
|
264
|
+
l == 1 && (s -= 1), l = l == 1 ? 12 : --l;
|
|
265
|
+
break;
|
|
266
|
+
case "next":
|
|
267
|
+
l == 12 && (s += 1), l = l == 12 ? 1 : ++l;
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
return [s + "", o.getNumTwoBit(l), o.getMonthDays(String(s), String(l)) + ""];
|
|
271
|
+
}, le = (a, r, s) => {
|
|
272
|
+
let { year: l, month: i } = s;
|
|
273
|
+
return r == "prev" && a >= 7 && (a -= 7), Array.from(Array(a), (T, w) => ({
|
|
274
|
+
day: String(w + 1),
|
|
275
|
+
type: r,
|
|
276
|
+
year: l,
|
|
277
|
+
month: i
|
|
278
|
+
}));
|
|
279
|
+
}, ie = (a, r, s, l) => {
|
|
280
|
+
a = a - t.firstDayOfWeek;
|
|
281
|
+
let { year: i, month: T } = s;
|
|
282
|
+
return r == "prev" && a >= 7 && (a -= 7), Array.from(Array(l), (f, v) => ({
|
|
283
|
+
day: String(v + 1),
|
|
284
|
+
type: r,
|
|
285
|
+
year: i,
|
|
286
|
+
month: T
|
|
287
|
+
})).slice(l - a);
|
|
288
|
+
}, K = (a, r) => {
|
|
289
|
+
const s = o.getMonthPreDay(+a[0], +a[1]);
|
|
290
|
+
let l = Number(a[1]) - 1, i = Number(a[0]);
|
|
291
|
+
l <= 0 && (l = 12, i += 1);
|
|
292
|
+
const T = o.getMonthDays(String(a[0]), String(a[1])), w = o.getMonthDays(i + "", l + ""), f = {
|
|
293
|
+
year: a[0],
|
|
294
|
+
month: a[1]
|
|
295
|
+
}, v = {
|
|
296
|
+
curData: a,
|
|
297
|
+
title: M("monthTitle", f.year, f.month),
|
|
298
|
+
monthData: [
|
|
299
|
+
...ie(
|
|
300
|
+
s,
|
|
301
|
+
"prev",
|
|
302
|
+
{ month: l + "", year: i + "" },
|
|
303
|
+
w
|
|
304
|
+
),
|
|
305
|
+
...le(T, "curr", f)
|
|
306
|
+
],
|
|
307
|
+
cssHeight: 0,
|
|
308
|
+
cssScrollHeight: 0
|
|
309
|
+
};
|
|
310
|
+
v.cssHeight = 39 + (v.monthData.length > 35 ? 384 : 320);
|
|
311
|
+
let E = 0;
|
|
312
|
+
e.monthsData.length > 0 && (E = e.monthsData[e.monthsData.length - 1].cssScrollHeight + e.monthsData[e.monthsData.length - 1].cssHeight), v.cssScrollHeight = E, r == "next" ? (!e.endData || !o.compareDate(
|
|
313
|
+
`${e.endData[0]}-${e.endData[1]}-${o.getMonthDays(e.endData[0], e.endData[1])}`,
|
|
314
|
+
`${a[0]}-${a[1]}-${a[2]}`
|
|
315
|
+
)) && e.monthsData.push(v) : !e.startData || !o.compareDate(
|
|
316
|
+
`${a[0]}-${a[1]}-${a[2]}`,
|
|
317
|
+
`${e.startData[0]}-${e.startData[1]}-01`
|
|
318
|
+
) ? e.monthsData.unshift(v) : e.unLoadPrev = !0;
|
|
319
|
+
}, Q = () => {
|
|
320
|
+
let a = t.startDate ? t.startDate : o.getDay(0), r = t.endDate ? t.endDate : o.getDay(365);
|
|
321
|
+
e.propStartDate = a, e.propEndDate = r, e.startData = S(a), e.endData = S(r), (t.defaultValue || Array.isArray(t.defaultValue) && t.defaultValue.length > 0) && (e.currDate = t.type != "one" ? [...t.defaultValue] : t.defaultValue);
|
|
322
|
+
const s = {
|
|
323
|
+
year: Number(e.startData[0]),
|
|
324
|
+
month: Number(e.startData[1])
|
|
325
|
+
}, l = {
|
|
326
|
+
year: Number(e.endData[0]),
|
|
327
|
+
month: Number(e.endData[1])
|
|
328
|
+
};
|
|
329
|
+
let i = l.month - s.month;
|
|
330
|
+
l.year - s.year > 0 && (i = i + 12 * (l.year - s.year)), i <= 0 && (i = 1), K(e.startData, "next");
|
|
331
|
+
let T = 1;
|
|
332
|
+
do
|
|
333
|
+
K(oe("next"), "next");
|
|
334
|
+
while (T++ < i);
|
|
335
|
+
if (e.monthsNum = i, t.type == "range" && Array.isArray(e.currDate))
|
|
336
|
+
e.currDate.length > 0 && (a && o.compareDate(e.currDate[0], a) && e.currDate.splice(0, 1, a), r && o.compareDate(r, e.currDate[1]) && e.currDate.splice(1, 1, r), e.defaultData = [...S(e.currDate[0]), ...S(e.currDate[1])]);
|
|
337
|
+
else if (t.type == "multiple" && Array.isArray(e.currDate)) {
|
|
338
|
+
if (e.currDate.length > 0) {
|
|
339
|
+
let b = [], k = {};
|
|
340
|
+
e.currDate.forEach((_) => {
|
|
341
|
+
a && !o.compareDate(_, a) && r && !o.compareDate(r, _) && (Object.hasOwnProperty.call(k, _) || (b.push(_), k[_] = _));
|
|
342
|
+
}), e.currDate = [...b], e.defaultData = [...S(b[0])];
|
|
343
|
+
}
|
|
344
|
+
} else if (t.type == "week" && Array.isArray(e.currDate)) {
|
|
345
|
+
if (e.currDate.length > 0) {
|
|
346
|
+
let [b, k, _] = S(e.currDate[0]), j = o.getWeekDate(b, k, _, t.firstDayOfWeek);
|
|
347
|
+
e.currDate = j, a && o.compareDate(e.currDate[0], a) && e.currDate.splice(0, 1, a), r && o.compareDate(r, e.currDate[1]) && e.currDate.splice(1, 1, r), e.defaultData = [...S(e.currDate[0]), ...S(e.currDate[1])];
|
|
348
|
+
}
|
|
349
|
+
} else
|
|
350
|
+
e.currDate && (a && o.compareDate(e.currDate, a) ? e.currDate = a : r && !o.compareDate(e.currDate, r) && (e.currDate = r), e.defaultData = [...S(e.currDate)]);
|
|
351
|
+
let w = 0, f = 0;
|
|
352
|
+
e.defaultData.length > 0 && e.monthsData.forEach((b, k) => {
|
|
353
|
+
b.title == M("monthTitle", e.defaultData[0], e.defaultData[1]) && (w = k), (t.type == "range" || t.type == "week") && b.title == M("monthTitle", e.defaultData[3], e.defaultData[4]) && (f = k);
|
|
354
|
+
}), X(i, w), e.currentIndex = w, e.yearMonthTitle = e.monthsData[e.currentIndex].title, e.defaultData.length > 0 && (t.type == "range" ? (W({ day: e.defaultData[2], type: "curr" }, e.monthsData[e.currentIndex], !0), W({ day: e.defaultData[5], type: "curr" }, e.monthsData[f], !0)) : t.type == "week" ? W({ day: e.defaultData[2], type: "curr" }, e.monthsData[e.currentIndex], !0) : t.type == "multiple" ? [...e.currDate].forEach((b) => {
|
|
355
|
+
let k = S(b), _ = e.currentIndex;
|
|
356
|
+
e.monthsData.forEach((j, me) => {
|
|
357
|
+
j.title == M("monthTitle", k[0], k[1]) && (_ = me);
|
|
358
|
+
}), W({ day: k[2], type: "curr" }, e.monthsData[_], !0);
|
|
359
|
+
}) : W({ day: e.defaultData[2], type: "curr" }, e.monthsData[e.currentIndex], !0));
|
|
360
|
+
let v = e.monthsData[e.monthsData.length - 1], E = v.cssHeight + v.cssScrollHeight;
|
|
361
|
+
Ne(() => {
|
|
362
|
+
c != null && c.value && (D != null && D.value) && (d != null && d.value) && (H.value = c.value.clientHeight, D.value.style.height = `${E}px`, c.value.scrollTop = e.monthsData[e.currentIndex].cssScrollHeight);
|
|
363
|
+
}), e.avgHeight = Math.floor(E / (i + 1));
|
|
364
|
+
};
|
|
365
|
+
$e({
|
|
366
|
+
scrollToDate: (a) => {
|
|
367
|
+
o.compareDate(a, e.propStartDate) ? a = e.propStartDate : o.compareDate(a, e.propEndDate) || (a = e.propEndDate);
|
|
368
|
+
let r = S(a);
|
|
369
|
+
e.monthsData.forEach((s, l) => {
|
|
370
|
+
if (s.title == M("monthTitle", r[0], r[1]) && c.value) {
|
|
371
|
+
let i = e.monthsData[l].cssScrollHeight - c.value.scrollTop;
|
|
372
|
+
if (t.toDateAnimation) {
|
|
373
|
+
let T = 0, w = setInterval(() => {
|
|
374
|
+
if (T++, c.value) {
|
|
375
|
+
let f = i / 10;
|
|
376
|
+
c.value.scrollTop = c.value.scrollTop + f;
|
|
377
|
+
}
|
|
378
|
+
T >= 10 && (clearInterval(w), c.value && (c.value.scrollTop = e.monthsData[l].cssScrollHeight));
|
|
379
|
+
}, 40);
|
|
380
|
+
} else
|
|
381
|
+
c.value.scrollTop = e.monthsData[l].cssScrollHeight;
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
},
|
|
385
|
+
initPosition: () => {
|
|
386
|
+
c != null && c.value && (c.value.scrollTop = e.monthsData[e.currentIndex].cssScrollHeight);
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
const X = (a, r) => {
|
|
390
|
+
a >= 3 ? r > 0 && r < a ? e.defaultRange = [r - 1, r + 3] : r == 0 ? e.defaultRange = [r, r + 4] : r == a && (e.defaultRange = [r - 2, r + 2]) : e.defaultRange = [0, a + 2];
|
|
391
|
+
let s = e.monthsData[e.defaultRange[0]].cssScrollHeight;
|
|
392
|
+
e.translateY = s;
|
|
393
|
+
}, Z = (a, r) => (t.type == "range" || t.type == "week") && a.type == "curr" && q(a, r) == "nut-calendar__day--active", ce = (a, r) => Z(a, r) && U(V(a, r)), ue = (a, r) => e.currDate.length >= 2 && G(V(a, r)) ? Z(a, r) : !1, De = () => {
|
|
394
|
+
if (e.currDate.length >= 2)
|
|
395
|
+
return o.isEqual(e.currDate[0], e.currDate[1]);
|
|
396
|
+
}, fe = (a) => {
|
|
397
|
+
const r = `${a.year}-${a.month}-${Number(a.day) < 10 ? "0" + a.day : a.day}`;
|
|
398
|
+
return o.isEqual(r, o.date2Str(/* @__PURE__ */ new Date()));
|
|
399
|
+
}, de = (a) => {
|
|
400
|
+
if (e.monthsData.length <= 1)
|
|
401
|
+
return;
|
|
402
|
+
const r = a.target.scrollTop;
|
|
403
|
+
let s = Math.floor(r / e.avgHeight);
|
|
404
|
+
if (s == 0)
|
|
405
|
+
r >= e.monthsData[s + 1].cssScrollHeight && (s += 1);
|
|
406
|
+
else if (s > 0 && s < e.monthsNum - 1)
|
|
407
|
+
r >= e.monthsData[s + 1].cssScrollHeight && (s += 1), r < e.monthsData[s].cssScrollHeight && (s -= 1);
|
|
408
|
+
else {
|
|
409
|
+
const l = Math.round(r + H.value);
|
|
410
|
+
l < e.monthsData[s].cssScrollHeight + e.monthsData[s].cssHeight && r > e.monthsData[s - 1].cssScrollHeight && (s -= 1), s + 1 <= e.monthsNum && l >= e.monthsData[s + 1].cssScrollHeight + e.monthsData[s + 1].cssHeight && (s += 1), s >= 1 && r < e.monthsData[s - 1].cssScrollHeight && (s -= 1);
|
|
411
|
+
}
|
|
412
|
+
e.currentIndex !== s && (e.currentIndex = s, X(e.monthsNum, s)), e.yearMonthTitle = e.monthsData[s].title;
|
|
413
|
+
}, he = () => {
|
|
414
|
+
e.chooseData.splice(0), e.monthsData.splice(0), Q();
|
|
415
|
+
};
|
|
416
|
+
return Q(), Te(
|
|
417
|
+
() => t.defaultValue,
|
|
418
|
+
(a) => {
|
|
419
|
+
a && t.poppable && he();
|
|
420
|
+
}
|
|
421
|
+
), te(F(F({
|
|
422
|
+
weeks: g,
|
|
423
|
+
compConthsData: I,
|
|
424
|
+
showTopBtn: P,
|
|
425
|
+
topInfo: re,
|
|
426
|
+
bottomInfo: ne,
|
|
427
|
+
rangeTip: De,
|
|
428
|
+
mothsViewScroll: de,
|
|
429
|
+
getClass: q,
|
|
430
|
+
isStartTip: ce,
|
|
431
|
+
isEndTip: ue,
|
|
432
|
+
chooseDay: W,
|
|
433
|
+
isCurrDay: fe,
|
|
434
|
+
confirm: J,
|
|
435
|
+
monthsPanel: D,
|
|
436
|
+
months: c,
|
|
437
|
+
weeksPanel: p,
|
|
438
|
+
viewArea: d
|
|
439
|
+
}, ae(e)), ae(t)), {
|
|
440
|
+
translate: M
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
}), Me = { class: "nut-calendar__header" }, Ie = {
|
|
444
|
+
key: 0,
|
|
445
|
+
class: "nut-calendar__header-title"
|
|
446
|
+
}, We = {
|
|
447
|
+
key: 1,
|
|
448
|
+
class: "nut-calendar__header-slot"
|
|
449
|
+
}, Be = {
|
|
450
|
+
key: 2,
|
|
451
|
+
class: "nut-calendar__header-subtitle"
|
|
452
|
+
}, Pe = {
|
|
453
|
+
class: "nut-calendar__weekdays",
|
|
454
|
+
ref: "weeksPanel"
|
|
455
|
+
}, Ce = {
|
|
456
|
+
class: "nut-calendar__panel",
|
|
457
|
+
ref: "monthsPanel"
|
|
458
|
+
}, Oe = { class: "nut-calendar__month-title" }, Re = { class: "nut-calendar__days" }, Ye = ["onClick"], Ve = { class: "nut-calendar__day-value" }, qe = {
|
|
459
|
+
key: 0,
|
|
460
|
+
class: "nut-calendar__day-tips nut-calendar__day-tips--top"
|
|
461
|
+
}, je = {
|
|
462
|
+
key: 1,
|
|
463
|
+
class: "nut-calendar__day-tips nut-calendar__day-tips--bottom"
|
|
464
|
+
}, Fe = {
|
|
465
|
+
key: 2,
|
|
466
|
+
class: "nut-calendar__day-tips--curr"
|
|
467
|
+
}, Le = {
|
|
468
|
+
key: 4,
|
|
469
|
+
class: "nut-calendar__day-tip"
|
|
470
|
+
}, ze = {
|
|
471
|
+
key: 0,
|
|
472
|
+
class: "nut-calendar__footer"
|
|
473
|
+
};
|
|
474
|
+
function Ue(t, n, u, h, g, c) {
|
|
475
|
+
return m(), y("view", {
|
|
476
|
+
class: R(["nut-calendar", {
|
|
477
|
+
"nut-calendar--nopop": !t.poppable,
|
|
478
|
+
"nut-calendar--nofooter": t.isAutoBackFill
|
|
479
|
+
}])
|
|
480
|
+
}, [
|
|
481
|
+
N("view", Me, [
|
|
482
|
+
t.showTitle ? (m(), y("view", Ie, $(t.title || t.translate("title")), 1)) : A("", !0),
|
|
483
|
+
t.showTopBtn ? (m(), y("view", We, [
|
|
484
|
+
Y(t.$slots, "btn")
|
|
485
|
+
])) : A("", !0),
|
|
486
|
+
t.showSubTitle ? (m(), y("view", Be, $(t.yearMonthTitle), 1)) : A("", !0),
|
|
487
|
+
N("view", Pe, [
|
|
488
|
+
(m(!0), y(L, null, z(t.weeks, (D, p) => (m(), y("view", {
|
|
489
|
+
class: "nut-calendar__weekday",
|
|
490
|
+
key: p
|
|
491
|
+
}, $(D), 1))), 128))
|
|
492
|
+
], 512)
|
|
493
|
+
]),
|
|
494
|
+
N("view", {
|
|
495
|
+
class: "nut-calendar__content",
|
|
496
|
+
ref: "months",
|
|
497
|
+
onScroll: n[0] || (n[0] = (...D) => t.mothsViewScroll && t.mothsViewScroll(...D))
|
|
498
|
+
}, [
|
|
499
|
+
N("view", Ce, [
|
|
500
|
+
N("view", {
|
|
501
|
+
class: "nut-calendar__body",
|
|
502
|
+
ref: "viewArea",
|
|
503
|
+
style: ke({ transform: `translateY(${t.translateY}px)` })
|
|
504
|
+
}, [
|
|
505
|
+
(m(!0), y(L, null, z(t.compConthsData, (D, p) => (m(), y("view", {
|
|
506
|
+
class: "nut-calendar__month",
|
|
507
|
+
key: p
|
|
508
|
+
}, [
|
|
509
|
+
N("view", Oe, $(D.title), 1),
|
|
510
|
+
N("view", Re, [
|
|
511
|
+
N("view", {
|
|
512
|
+
class: R(["nut-calendar__days-item", t.type === "range" ? "nut-calendar__days-item--range" : ""])
|
|
513
|
+
}, [
|
|
514
|
+
(m(!0), y(L, null, z(D.monthData, (d, H) => (m(), y("view", {
|
|
515
|
+
key: H,
|
|
516
|
+
class: R(["nut-calendar__day", t.getClass(d, D)]),
|
|
517
|
+
onClick: (I) => t.chooseDay(d, D)
|
|
518
|
+
}, [
|
|
519
|
+
N("view", Ve, [
|
|
520
|
+
Y(t.$slots, "day", {
|
|
521
|
+
date: d.type == "curr" ? d : ""
|
|
522
|
+
}, () => [
|
|
523
|
+
_e($(d.type == "curr" ? d.day : ""), 1)
|
|
524
|
+
])
|
|
525
|
+
]),
|
|
526
|
+
t.topInfo ? (m(), y("view", qe, [
|
|
527
|
+
Y(t.$slots, "top-info", {
|
|
528
|
+
date: d.type == "curr" ? d : ""
|
|
529
|
+
})
|
|
530
|
+
])) : A("", !0),
|
|
531
|
+
t.bottomInfo ? (m(), y("view", je, [
|
|
532
|
+
Y(t.$slots, "bottom-info", {
|
|
533
|
+
date: d.type == "curr" ? d : ""
|
|
534
|
+
})
|
|
535
|
+
])) : A("", !0),
|
|
536
|
+
!t.bottomInfo && t.showToday && t.isCurrDay(d) ? (m(), y("view", Fe, $(t.translate("today")), 1)) : A("", !0),
|
|
537
|
+
t.isStartTip(d, D) ? (m(), y("view", {
|
|
538
|
+
key: 3,
|
|
539
|
+
class: R(["nut-calendar__day-tip", { "nut-calendar__day-tips--top": t.rangeTip() }])
|
|
540
|
+
}, $(t.startText || t.translate("start")), 3)) : A("", !0),
|
|
541
|
+
t.isEndTip(d, D) ? (m(), y("view", Le, $(t.endText || t.translate("end")), 1)) : A("", !0)
|
|
542
|
+
], 10, Ye))), 128))
|
|
543
|
+
], 2)
|
|
544
|
+
])
|
|
545
|
+
]))), 128))
|
|
546
|
+
], 4)
|
|
547
|
+
], 512)
|
|
548
|
+
], 544),
|
|
549
|
+
t.poppable && !t.isAutoBackFill ? (m(), y("view", ze, [
|
|
550
|
+
N("view", {
|
|
551
|
+
class: "nut-calendar__confirm",
|
|
552
|
+
onClick: n[1] || (n[1] = (...D) => t.confirm && t.confirm(...D))
|
|
553
|
+
}, $(t.confirmText || t.translate("confirm")), 1)
|
|
554
|
+
])) : A("", !0)
|
|
555
|
+
], 2);
|
|
556
|
+
}
|
|
557
|
+
const tt = /* @__PURE__ */ Ae(Ee, [["render", Ue]]);
|
|
558
|
+
export {
|
|
559
|
+
tt as C,
|
|
560
|
+
o as U
|
|
561
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { unref as o } from "vue";
|
|
2
|
+
function r(e) {
|
|
3
|
+
return e === window;
|
|
4
|
+
}
|
|
5
|
+
const u = (e) => {
|
|
6
|
+
const t = o(e);
|
|
7
|
+
if (r(t)) {
|
|
8
|
+
const n = t.innerWidth, i = t.innerHeight;
|
|
9
|
+
return {
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
right: n,
|
|
13
|
+
bottom: i,
|
|
14
|
+
width: n,
|
|
15
|
+
height: i
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return t && t.getBoundingClientRect ? t.getBoundingClientRect() : {
|
|
19
|
+
top: 0,
|
|
20
|
+
left: 0,
|
|
21
|
+
right: 0,
|
|
22
|
+
bottom: 0,
|
|
23
|
+
width: 0,
|
|
24
|
+
height: 0
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
u
|
|
29
|
+
};
|