@varlet/ui 2.16.2 → 2.16.3-alpha.1694267513697
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/es/action-sheet/ActionSheet.mjs +20 -16
- package/es/app-bar/AppBar.mjs +10 -9
- package/es/avatar/Avatar.mjs +16 -15
- package/es/avatar-group/AvatarGroup.mjs +4 -3
- package/es/back-top/BackTop.mjs +20 -19
- package/es/badge/Badge.mjs +4 -3
- package/es/bottom-navigation/BottomNavigation.mjs +70 -63
- package/es/bottom-navigation-item/BottomNavigationItem.mjs +13 -10
- package/es/breadcrumb/Breadcrumb.mjs +5 -4
- package/es/breadcrumbs/Breadcrumbs.mjs +2 -1
- package/es/button/Button.mjs +10 -9
- package/es/button-group/ButtonGroup.mjs +2 -1
- package/es/card/Card.mjs +28 -26
- package/es/cell/Cell.mjs +5 -4
- package/es/checkbox/Checkbox.mjs +32 -29
- package/es/checkbox-group/CheckboxGroup.mjs +45 -40
- package/es/chip/Chip.mjs +6 -5
- package/es/col/Col.mjs +15 -14
- package/es/collapse/Collapse.mjs +30 -29
- package/es/collapse-item/CollapseItem.mjs +52 -47
- package/es/countdown/Countdown.mjs +36 -35
- package/es/counter/Counter.mjs +63 -60
- package/es/date-picker/DatePicker.mjs +67 -63
- package/es/dialog/Dialog.mjs +39 -29
- package/es/divider/Divider.mjs +6 -9
- package/es/drag/Drag.mjs +47 -45
- package/es/ellipsis/Ellipsis.mjs +6 -5
- package/es/fab/Fab.mjs +21 -20
- package/es/field-decorator/FieldDecorator.mjs +14 -13
- package/es/form/Form.mjs +41 -36
- package/es/form-details/FormDetails.mjs +2 -1
- package/es/hover-overlay/HoverOverlay.mjs +6 -7
- package/es/icon/Icon.mjs +14 -12
- package/es/image/Image.mjs +14 -12
- package/es/image-preview/ImagePreview.mjs +51 -50
- package/es/index-anchor/IndexAnchor.mjs +15 -12
- package/es/index-bar/IndexBar.mjs +68 -65
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +63 -56
- package/es/link/Link.mjs +6 -5
- package/es/list/List.mjs +55 -46
- package/es/loading/Loading.mjs +11 -8
- package/es/loading-bar/LoadingBar.mjs +2 -1
- package/es/menu/Menu.mjs +2 -1
- package/es/option/Option.mjs +14 -11
- package/es/overlay/Overlay.mjs +18 -18
- package/es/pagination/Pagination.mjs +67 -64
- package/es/paper/Paper.mjs +4 -3
- package/es/picker/Picker.mjs +95 -85
- package/es/popup/Popup.mjs +26 -23
- package/es/progress/Progress.mjs +9 -8
- package/es/pull-refresh/PullRefresh.mjs +54 -51
- package/es/radio/Radio.mjs +25 -22
- package/es/radio-group/RadioGroup.mjs +30 -25
- package/es/rate/Rate.mjs +35 -28
- package/es/result/Result.mjs +6 -5
- package/es/row/Row.mjs +14 -13
- package/es/select/Select.mjs +57 -54
- package/es/skeleton/Skeleton.mjs +8 -9
- package/es/slider/Slider.mjs +86 -79
- package/es/snackbar/Snackbar.mjs +4 -3
- package/es/space/Space.mjs +5 -2
- package/es/step/Step.mjs +7 -4
- package/es/steps/Steps.mjs +5 -4
- package/es/sticky/Sticky.mjs +30 -27
- package/es/style-provider/StyleProvider.mjs +2 -1
- package/es/swipe/Swipe.mjs +95 -89
- package/es/swipe-item/SwipeItem.mjs +5 -4
- package/es/switch/Switch.mjs +22 -17
- package/es/tab/Tab.mjs +16 -12
- package/es/tab-item/TabItem.mjs +7 -6
- package/es/table/Table.mjs +8 -9
- package/es/tabs/Tabs.mjs +57 -52
- package/es/tabs-items/TabsItems.mjs +38 -29
- package/es/time-picker/TimePicker.mjs +63 -60
- package/es/tooltip/Tooltip.mjs +3 -2
- package/es/uploader/Uploader.mjs +100 -85
- package/es/utils/components.mjs +2 -1
- package/es/utils/shared.mjs +0 -1
- package/es/varlet.esm.js +9589 -8914
- package/es/watermark/Watermark.mjs +29 -26
- package/highlight/web-types.en-US.json +1 -1
- package/highlight/web-types.zh-CN.json +1 -1
- package/lib/varlet.cjs.js +2366 -2103
- package/package.json +12 -14
- package/umd/varlet.js +4 -4
package/es/tabs/Tabs.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { toSizeUnit, scrollTo } from '../utils/elements.mjs';
|
|
|
10
10
|
import { createNamespace, call, formatElevation } from '../utils/components.mjs';
|
|
11
11
|
import { onWindowResize } from '@varlet/use';
|
|
12
12
|
var {
|
|
13
|
+
name,
|
|
13
14
|
n,
|
|
14
15
|
classes
|
|
15
16
|
} = createNamespace('tabs');
|
|
@@ -47,7 +48,7 @@ function __render__(_ctx, _cache) {
|
|
|
47
48
|
}, 8 /* PROPS */, ["css-mode", "offset-top", "z-index"]);
|
|
48
49
|
}
|
|
49
50
|
var __sfc__ = defineComponent({
|
|
50
|
-
name
|
|
51
|
+
name,
|
|
51
52
|
components: {
|
|
52
53
|
VarSticky
|
|
53
54
|
},
|
|
@@ -61,18 +62,35 @@ var __sfc__ = defineComponent({
|
|
|
61
62
|
var localScrollable = ref(false);
|
|
62
63
|
var scrollerEl = ref(null);
|
|
63
64
|
var active = computed(() => props.active);
|
|
64
|
-
var indicatorPosition = computed(() => props.indicatorPosition === 'reverse' ? '-reverse' : '');
|
|
65
65
|
var activeColor = computed(() => props.activeColor);
|
|
66
66
|
var inactiveColor = computed(() => props.inactiveColor);
|
|
67
67
|
var disabledColor = computed(() => props.disabledColor);
|
|
68
68
|
var itemDirection = computed(() => props.itemDirection);
|
|
69
69
|
var stickyComponent = ref(null);
|
|
70
|
+
var indicatorPosition = computed(() => props.indicatorPosition === 'reverse' ? '-reverse' : '');
|
|
70
71
|
var {
|
|
71
72
|
tabList,
|
|
72
73
|
bindTabList,
|
|
73
74
|
length
|
|
74
75
|
} = useTabList();
|
|
75
|
-
var
|
|
76
|
+
var tabsProvider = {
|
|
77
|
+
active,
|
|
78
|
+
activeColor,
|
|
79
|
+
inactiveColor,
|
|
80
|
+
disabledColor,
|
|
81
|
+
itemDirection,
|
|
82
|
+
resize,
|
|
83
|
+
onTabClick
|
|
84
|
+
};
|
|
85
|
+
bindTabList(tabsProvider);
|
|
86
|
+
watch(() => length.value, /*#__PURE__*/_asyncToGenerator(function* () {
|
|
87
|
+
yield doubleRaf();
|
|
88
|
+
resize();
|
|
89
|
+
}));
|
|
90
|
+
watch(() => [props.active, props.scrollable], resize);
|
|
91
|
+
onActivated(resize);
|
|
92
|
+
onWindowResize(resize);
|
|
93
|
+
function onTabClick(tab) {
|
|
76
94
|
var _tab$name$value;
|
|
77
95
|
var currentActive = (_tab$name$value = tab.name.value) != null ? _tab$name$value : tab.index.value;
|
|
78
96
|
var {
|
|
@@ -83,20 +101,24 @@ var __sfc__ = defineComponent({
|
|
|
83
101
|
call(props['onUpdate:active'], currentActive);
|
|
84
102
|
call(onClick, currentActive);
|
|
85
103
|
currentActive !== active && call(onChange, currentActive);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
104
|
+
}
|
|
105
|
+
function matchName() {
|
|
106
|
+
return tabList.find(_ref2 => {
|
|
107
|
+
var {
|
|
108
|
+
name
|
|
109
|
+
} = _ref2;
|
|
110
|
+
return props.active === name.value;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function matchIndex(activeIndex) {
|
|
114
|
+
return tabList.find(_ref3 => {
|
|
115
|
+
var {
|
|
116
|
+
index
|
|
117
|
+
} = _ref3;
|
|
118
|
+
return (activeIndex != null ? activeIndex : props.active) === index.value;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
function matchBoundary() {
|
|
100
122
|
if (length.value === 0) {
|
|
101
123
|
return;
|
|
102
124
|
}
|
|
@@ -108,14 +130,14 @@ var __sfc__ = defineComponent({
|
|
|
108
130
|
call(props['onUpdate:active'], activeIndex);
|
|
109
131
|
return matchIndex(activeIndex);
|
|
110
132
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
133
|
+
}
|
|
134
|
+
function watchScrollable() {
|
|
113
135
|
localScrollable.value = props.scrollable === 'always' || tabList.length >= 5;
|
|
114
|
-
}
|
|
115
|
-
|
|
136
|
+
}
|
|
137
|
+
function moveIndicator(_ref4) {
|
|
116
138
|
var {
|
|
117
139
|
element
|
|
118
|
-
} =
|
|
140
|
+
} = _ref4;
|
|
119
141
|
var el = element.value;
|
|
120
142
|
if (!el) return;
|
|
121
143
|
if (props.layoutDirection === 'horizontal') {
|
|
@@ -125,11 +147,11 @@ var __sfc__ = defineComponent({
|
|
|
125
147
|
indicatorHeight.value = el.offsetHeight + "px";
|
|
126
148
|
indicatorY.value = el.offsetTop + "px";
|
|
127
149
|
}
|
|
128
|
-
}
|
|
129
|
-
|
|
150
|
+
}
|
|
151
|
+
function scrollToCenter(_ref5) {
|
|
130
152
|
var {
|
|
131
153
|
element
|
|
132
|
-
} =
|
|
154
|
+
} = _ref5;
|
|
133
155
|
if (!localScrollable.value) {
|
|
134
156
|
return;
|
|
135
157
|
}
|
|
@@ -148,10 +170,10 @@ var __sfc__ = defineComponent({
|
|
|
148
170
|
animation: linear
|
|
149
171
|
});
|
|
150
172
|
}
|
|
151
|
-
}
|
|
173
|
+
}
|
|
152
174
|
|
|
153
175
|
// expose
|
|
154
|
-
|
|
176
|
+
function resize() {
|
|
155
177
|
var tab = matchName() || matchIndex() || matchBoundary();
|
|
156
178
|
if (!tab || tab.disabled.value) {
|
|
157
179
|
return;
|
|
@@ -159,37 +181,20 @@ var __sfc__ = defineComponent({
|
|
|
159
181
|
watchScrollable();
|
|
160
182
|
moveIndicator(tab);
|
|
161
183
|
scrollToCenter(tab);
|
|
162
|
-
}
|
|
184
|
+
}
|
|
163
185
|
|
|
164
186
|
// expose
|
|
165
|
-
|
|
166
|
-
|
|
187
|
+
function resizeSticky() {
|
|
188
|
+
return _resizeSticky.apply(this, arguments);
|
|
189
|
+
}
|
|
190
|
+
function _resizeSticky() {
|
|
191
|
+
_resizeSticky = _asyncToGenerator(function* () {
|
|
167
192
|
if (props.sticky && stickyComponent.value) {
|
|
168
193
|
yield stickyComponent.value.resize();
|
|
169
194
|
}
|
|
170
195
|
});
|
|
171
|
-
return
|
|
172
|
-
|
|
173
|
-
};
|
|
174
|
-
}();
|
|
175
|
-
var tabsProvider = {
|
|
176
|
-
active,
|
|
177
|
-
activeColor,
|
|
178
|
-
inactiveColor,
|
|
179
|
-
disabledColor,
|
|
180
|
-
itemDirection,
|
|
181
|
-
resize,
|
|
182
|
-
onTabClick
|
|
183
|
-
};
|
|
184
|
-
bindTabList(tabsProvider);
|
|
185
|
-
watch(() => length.value, /*#__PURE__*/_asyncToGenerator(function* () {
|
|
186
|
-
yield doubleRaf();
|
|
187
|
-
resize();
|
|
188
|
-
}));
|
|
189
|
-
watch(() => props.active, resize);
|
|
190
|
-
watch(() => props.scrollable, resize);
|
|
191
|
-
onActivated(resize);
|
|
192
|
-
onWindowResize(resize);
|
|
196
|
+
return _resizeSticky.apply(this, arguments);
|
|
197
|
+
}
|
|
193
198
|
return {
|
|
194
199
|
stickyComponent,
|
|
195
200
|
indicatorWidth,
|
|
@@ -7,6 +7,7 @@ import { call, createNamespace } from '../utils/components.mjs';
|
|
|
7
7
|
import { props } from './props.mjs';
|
|
8
8
|
import { doubleRaf } from '@varlet/shared';
|
|
9
9
|
var {
|
|
10
|
+
name,
|
|
10
11
|
n
|
|
11
12
|
} = createNamespace('tabs-items');
|
|
12
13
|
import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue";
|
|
@@ -25,7 +26,7 @@ function __render__(_ctx, _cache) {
|
|
|
25
26
|
}, 8 /* PROPS */, ["class", "loop", "touchable", "onChange"]);
|
|
26
27
|
}
|
|
27
28
|
var __sfc__ = defineComponent({
|
|
28
|
-
name
|
|
29
|
+
name,
|
|
29
30
|
components: {
|
|
30
31
|
VarSwipe
|
|
31
32
|
},
|
|
@@ -37,54 +38,62 @@ var __sfc__ = defineComponent({
|
|
|
37
38
|
bindTabItem,
|
|
38
39
|
length
|
|
39
40
|
} = useTabItem();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
bindTabItem({});
|
|
42
|
+
watch(() => props.active, handleActiveChange);
|
|
43
|
+
watch(() => length.value, /*#__PURE__*/_asyncToGenerator(function* () {
|
|
44
|
+
yield doubleRaf();
|
|
45
|
+
handleActiveChange(props.active);
|
|
46
|
+
}));
|
|
47
|
+
function matchName(active) {
|
|
48
|
+
return tabItemList.find(_ref2 => {
|
|
49
|
+
var {
|
|
50
|
+
name
|
|
51
|
+
} = _ref2;
|
|
52
|
+
return active === name.value;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function matchIndex(active) {
|
|
56
|
+
return tabItemList.find(_ref3 => {
|
|
57
|
+
var {
|
|
58
|
+
index
|
|
59
|
+
} = _ref3;
|
|
60
|
+
return active === index.value;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function matchActive(active) {
|
|
64
|
+
return matchName(active) || matchIndex(active);
|
|
65
|
+
}
|
|
66
|
+
function handleActiveChange(newValue) {
|
|
54
67
|
var _swipe$value;
|
|
55
68
|
var newActiveTabItemProvider = matchActive(newValue);
|
|
56
69
|
if (!newActiveTabItemProvider) {
|
|
57
70
|
return;
|
|
58
71
|
}
|
|
59
|
-
tabItemList.forEach(
|
|
72
|
+
tabItemList.forEach(_ref4 => {
|
|
60
73
|
var {
|
|
61
74
|
setCurrent
|
|
62
|
-
} =
|
|
75
|
+
} = _ref4;
|
|
63
76
|
return setCurrent(false);
|
|
64
77
|
});
|
|
65
78
|
newActiveTabItemProvider.setCurrent(true);
|
|
66
79
|
(_swipe$value = swipe.value) == null ? void 0 : _swipe$value.to(newActiveTabItemProvider.index.value);
|
|
67
|
-
}
|
|
68
|
-
|
|
80
|
+
}
|
|
81
|
+
function handleSwipeChange(currentIndex) {
|
|
69
82
|
var _tabItem$name$value;
|
|
70
|
-
var tabItem = tabItemList.find(
|
|
83
|
+
var tabItem = tabItemList.find(_ref5 => {
|
|
71
84
|
var {
|
|
72
85
|
index
|
|
73
|
-
} =
|
|
86
|
+
} = _ref5;
|
|
74
87
|
return index.value === currentIndex;
|
|
75
88
|
});
|
|
76
89
|
var active = (_tabItem$name$value = tabItem.name.value) != null ? _tabItem$name$value : tabItem.index.value;
|
|
77
90
|
call(props['onUpdate:active'], active);
|
|
78
|
-
}
|
|
91
|
+
}
|
|
79
92
|
|
|
80
93
|
// expose
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
watch(() => length.value, /*#__PURE__*/_asyncToGenerator(function* () {
|
|
85
|
-
yield doubleRaf();
|
|
86
|
-
handleActiveChange(props.active);
|
|
87
|
-
}));
|
|
94
|
+
function getSwipe() {
|
|
95
|
+
return swipe.value;
|
|
96
|
+
}
|
|
88
97
|
return {
|
|
89
98
|
swipe,
|
|
90
99
|
n,
|
|
@@ -7,6 +7,7 @@ import { createNamespace, call, formatElevation } from '../utils/components.mjs'
|
|
|
7
7
|
import { padStart } from '../utils/shared.mjs';
|
|
8
8
|
import { getNumberTime, getIsDisableMinute, getIsDisableSecond } from './utils.mjs';
|
|
9
9
|
var {
|
|
10
|
+
name,
|
|
10
11
|
n,
|
|
11
12
|
classes
|
|
12
13
|
} = createNamespace('time-picker');
|
|
@@ -87,7 +88,7 @@ function __render__(_ctx, _cache) {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
var __sfc__ = defineComponent({
|
|
90
|
-
name
|
|
91
|
+
name,
|
|
91
92
|
components: {
|
|
92
93
|
Clock
|
|
93
94
|
},
|
|
@@ -101,13 +102,13 @@ var __sfc__ = defineComponent({
|
|
|
101
102
|
var isActualInner = ref(false);
|
|
102
103
|
var isChosenUsableHour = ref(false);
|
|
103
104
|
var isChosenUsableMinute = ref(false);
|
|
104
|
-
var
|
|
105
|
+
var isDisableHour = ref(false);
|
|
106
|
+
var isDisableMinute = ref(false);
|
|
105
107
|
var minuteRad = ref(0);
|
|
106
108
|
var secondRad = ref(0);
|
|
109
|
+
var hourRad = ref();
|
|
107
110
|
var type = ref('hour');
|
|
108
111
|
var ampm = ref('am');
|
|
109
|
-
var isDisableHour = ref(false);
|
|
110
|
-
var isDisableMinute = ref(false);
|
|
111
112
|
var time = ref({
|
|
112
113
|
hour: '00',
|
|
113
114
|
minute: '00',
|
|
@@ -126,17 +127,42 @@ var __sfc__ = defineComponent({
|
|
|
126
127
|
if (type.value === 'minute') return minuteRad.value;
|
|
127
128
|
return secondRad.value;
|
|
128
129
|
});
|
|
129
|
-
|
|
130
|
+
watch(() => props.modelValue, value => {
|
|
131
|
+
if (value) {
|
|
132
|
+
var {
|
|
133
|
+
hour,
|
|
134
|
+
minute,
|
|
135
|
+
second
|
|
136
|
+
} = getNumberTime(value);
|
|
137
|
+
var formatHour12 = dayjs().hour(hour).format('hh');
|
|
138
|
+
var formatHour24 = dayjs().hour(hour).format('HH');
|
|
139
|
+
var formatMinute = dayjs().minute(minute).format('mm');
|
|
140
|
+
var formatSecond = dayjs().second(second).format('ss');
|
|
141
|
+
hourRad.value = (formatHour12 === '12' ? 0 : toNumber(formatHour12)) * 30;
|
|
142
|
+
minuteRad.value = toNumber(formatMinute) * 6;
|
|
143
|
+
secondRad.value = toNumber(formatSecond) * 6;
|
|
144
|
+
time.value = getTime(value);
|
|
145
|
+
if (props.format !== '24hr') {
|
|
146
|
+
ampm.value = padStart("" + hour, 2, '0') === formatHour24 && hours24.includes(formatHour24) ? 'pm' : 'am';
|
|
147
|
+
}
|
|
148
|
+
isInner.value = props.format === '24hr' && hours24.includes(formatHour24);
|
|
149
|
+
}
|
|
150
|
+
}, {
|
|
151
|
+
immediate: true
|
|
152
|
+
});
|
|
153
|
+
function update(newTime) {
|
|
130
154
|
call(props['onUpdate:modelValue'], newTime);
|
|
131
155
|
call(props.onChange, newTime);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
156
|
+
}
|
|
157
|
+
function rad2deg(rad) {
|
|
158
|
+
return rad * 57.29577951308232;
|
|
159
|
+
}
|
|
160
|
+
function checkPanel(panelType) {
|
|
135
161
|
isChosenUsableHour.value = false;
|
|
136
162
|
isDisableMinute.value = false;
|
|
137
163
|
type.value = panelType;
|
|
138
|
-
}
|
|
139
|
-
|
|
164
|
+
}
|
|
165
|
+
function findAvailableHour(ampm) {
|
|
140
166
|
var {
|
|
141
167
|
disableHour
|
|
142
168
|
} = inner.value;
|
|
@@ -147,8 +173,8 @@ var __sfc__ = defineComponent({
|
|
|
147
173
|
isPreventNextUpdate.value = index !== 0;
|
|
148
174
|
return !disableHour.includes(hour);
|
|
149
175
|
});
|
|
150
|
-
}
|
|
151
|
-
|
|
176
|
+
}
|
|
177
|
+
function checkAmpm(ampmType) {
|
|
152
178
|
if (props.readonly) return;
|
|
153
179
|
ampm.value = ampmType;
|
|
154
180
|
var newHour = findAvailableHour(ampmType);
|
|
@@ -156,13 +182,13 @@ var __sfc__ = defineComponent({
|
|
|
156
182
|
var second = props.useSeconds ? ":" + time.value.second : '';
|
|
157
183
|
var newTime = padStart(newHour, 2, '0') + ":" + time.value.minute + second;
|
|
158
184
|
update(newTime);
|
|
159
|
-
}
|
|
160
|
-
|
|
185
|
+
}
|
|
186
|
+
function getInner(clientX, clientY) {
|
|
161
187
|
var xIsInRange = clientX >= innerRange.x[0] && clientX <= innerRange.x[1];
|
|
162
188
|
var yIsInRange = clientY >= innerRange.y[0] && clientY <= innerRange.y[1];
|
|
163
189
|
return xIsInRange && yIsInRange;
|
|
164
|
-
}
|
|
165
|
-
|
|
190
|
+
}
|
|
191
|
+
function getTime(value) {
|
|
166
192
|
var hourFormat = props.format === '24hr' ? 'HH' : 'hh';
|
|
167
193
|
var {
|
|
168
194
|
hour,
|
|
@@ -174,12 +200,12 @@ var __sfc__ = defineComponent({
|
|
|
174
200
|
minute: dayjs().minute(minute).format('mm'),
|
|
175
201
|
second: dayjs().second(second).format('ss')
|
|
176
202
|
};
|
|
177
|
-
}
|
|
178
|
-
|
|
203
|
+
}
|
|
204
|
+
function getHourIndex(rad) {
|
|
179
205
|
var value = rad / 30;
|
|
180
206
|
return value >= 0 ? value : value + 12;
|
|
181
|
-
}
|
|
182
|
-
|
|
207
|
+
}
|
|
208
|
+
function getRangeSize() {
|
|
183
209
|
var {
|
|
184
210
|
width: innerWidth,
|
|
185
211
|
height: innerHeight
|
|
@@ -194,8 +220,8 @@ var __sfc__ = defineComponent({
|
|
|
194
220
|
rangeYMin,
|
|
195
221
|
rangeYMax
|
|
196
222
|
};
|
|
197
|
-
}
|
|
198
|
-
|
|
223
|
+
}
|
|
224
|
+
function setHourRad(clientX, clientY, roundDeg) {
|
|
199
225
|
var {
|
|
200
226
|
disableHour
|
|
201
227
|
} = inner.value;
|
|
@@ -212,8 +238,8 @@ var __sfc__ = defineComponent({
|
|
|
212
238
|
if (isDisableHour.value) return;
|
|
213
239
|
hourRad.value = rad;
|
|
214
240
|
isChosenUsableHour.value = true;
|
|
215
|
-
}
|
|
216
|
-
|
|
241
|
+
}
|
|
242
|
+
function setMinuteRad(roundDeg) {
|
|
217
243
|
var {
|
|
218
244
|
disableHour
|
|
219
245
|
} = inner.value;
|
|
@@ -233,8 +259,8 @@ var __sfc__ = defineComponent({
|
|
|
233
259
|
if (isDisableMinute.value) return;
|
|
234
260
|
minuteRad.value = rad;
|
|
235
261
|
isChosenUsableMinute.value = true;
|
|
236
|
-
}
|
|
237
|
-
|
|
262
|
+
}
|
|
263
|
+
function setSecondRad(roundDeg) {
|
|
238
264
|
var {
|
|
239
265
|
disableHour
|
|
240
266
|
} = inner.value;
|
|
@@ -252,8 +278,8 @@ var __sfc__ = defineComponent({
|
|
|
252
278
|
allowedTime: props.allowedTime
|
|
253
279
|
};
|
|
254
280
|
if (!getIsDisableSecond(values)) secondRad.value = rad;
|
|
255
|
-
}
|
|
256
|
-
|
|
281
|
+
}
|
|
282
|
+
function setCenterAndRange() {
|
|
257
283
|
var {
|
|
258
284
|
left,
|
|
259
285
|
top,
|
|
@@ -272,8 +298,8 @@ var __sfc__ = defineComponent({
|
|
|
272
298
|
innerRange.x = [rangeXMin, rangeXMax];
|
|
273
299
|
innerRange.y = [rangeYMin, rangeYMax];
|
|
274
300
|
}
|
|
275
|
-
}
|
|
276
|
-
|
|
301
|
+
}
|
|
302
|
+
function moveHand(event) {
|
|
277
303
|
event.preventDefault();
|
|
278
304
|
if (props.readonly) return;
|
|
279
305
|
setCenterAndRange();
|
|
@@ -285,8 +311,8 @@ var __sfc__ = defineComponent({
|
|
|
285
311
|
var y = clientY - center.y;
|
|
286
312
|
var roundDeg = Math.round(rad2deg(Math.atan2(y, x)));
|
|
287
313
|
if (type.value === 'hour') setHourRad(clientX, clientY, roundDeg);else if (type.value === 'minute') setMinuteRad(roundDeg);else setSecondRad(roundDeg);
|
|
288
|
-
}
|
|
289
|
-
|
|
314
|
+
}
|
|
315
|
+
function end() {
|
|
290
316
|
if (props.readonly) return;
|
|
291
317
|
if (type.value === 'hour' && isChosenUsableHour.value) {
|
|
292
318
|
type.value = 'minute';
|
|
@@ -295,36 +321,11 @@ var __sfc__ = defineComponent({
|
|
|
295
321
|
if (type.value === 'minute' && props.useSeconds && isChosenUsableMinute.value) {
|
|
296
322
|
type.value = 'second';
|
|
297
323
|
}
|
|
298
|
-
}
|
|
299
|
-
|
|
324
|
+
}
|
|
325
|
+
function changePreventUpdate() {
|
|
300
326
|
isPreventNextUpdate.value = false;
|
|
301
|
-
}
|
|
302
|
-
watch(() => props.modelValue, value => {
|
|
303
|
-
if (value) {
|
|
304
|
-
var {
|
|
305
|
-
hour,
|
|
306
|
-
minute,
|
|
307
|
-
second
|
|
308
|
-
} = getNumberTime(value);
|
|
309
|
-
var formatHour12 = dayjs().hour(hour).format('hh');
|
|
310
|
-
var formatHour24 = dayjs().hour(hour).format('HH');
|
|
311
|
-
var formatMinute = dayjs().minute(minute).format('mm');
|
|
312
|
-
var formatSecond = dayjs().second(second).format('ss');
|
|
313
|
-
hourRad.value = (formatHour12 === '12' ? 0 : toNumber(formatHour12)) * 30;
|
|
314
|
-
minuteRad.value = toNumber(formatMinute) * 6;
|
|
315
|
-
secondRad.value = toNumber(formatSecond) * 6;
|
|
316
|
-
time.value = getTime(value);
|
|
317
|
-
if (props.format !== '24hr') {
|
|
318
|
-
ampm.value = padStart("" + hour, 2, '0') === formatHour24 && hours24.includes(formatHour24) ? 'pm' : 'am';
|
|
319
|
-
}
|
|
320
|
-
isInner.value = props.format === '24hr' && hours24.includes(formatHour24);
|
|
321
|
-
}
|
|
322
|
-
}, {
|
|
323
|
-
immediate: true
|
|
324
|
-
});
|
|
327
|
+
}
|
|
325
328
|
return {
|
|
326
|
-
n,
|
|
327
|
-
classes,
|
|
328
329
|
getRad,
|
|
329
330
|
time,
|
|
330
331
|
container,
|
|
@@ -334,6 +335,8 @@ var __sfc__ = defineComponent({
|
|
|
334
335
|
type,
|
|
335
336
|
ampm,
|
|
336
337
|
isPreventNextUpdate,
|
|
338
|
+
n,
|
|
339
|
+
classes,
|
|
337
340
|
moveHand,
|
|
338
341
|
checkPanel,
|
|
339
342
|
checkAmpm,
|
package/es/tooltip/Tooltip.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { toSizeUnit } from '../utils/elements.mjs';
|
|
|
4
4
|
import { usePopover } from '../menu/usePopover.mjs';
|
|
5
5
|
import { props } from './props.mjs';
|
|
6
6
|
var {
|
|
7
|
+
name,
|
|
7
8
|
n,
|
|
8
9
|
classes
|
|
9
10
|
} = createNamespace('tooltip');
|
|
@@ -55,7 +56,7 @@ function __render__(_ctx, _cache) {
|
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
var __sfc__ = defineComponent({
|
|
58
|
-
name
|
|
59
|
+
name,
|
|
59
60
|
props,
|
|
60
61
|
setup(props) {
|
|
61
62
|
var {
|
|
@@ -82,13 +83,13 @@ var __sfc__ = defineComponent({
|
|
|
82
83
|
resize
|
|
83
84
|
} = usePopover(props);
|
|
84
85
|
return {
|
|
85
|
-
toSizeUnit,
|
|
86
86
|
popover,
|
|
87
87
|
host,
|
|
88
88
|
hostSize,
|
|
89
89
|
show,
|
|
90
90
|
zIndex,
|
|
91
91
|
teleportDisabled,
|
|
92
|
+
toSizeUnit,
|
|
92
93
|
n,
|
|
93
94
|
classes,
|
|
94
95
|
handleHostClick,
|