@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
|
@@ -3,10 +3,10 @@ import VarPopup from '../popup/index.mjs';
|
|
|
3
3
|
import VarIcon from '../icon/index.mjs';
|
|
4
4
|
import { defineComponent, ref, watch } from 'vue';
|
|
5
5
|
import { props } from './props.mjs';
|
|
6
|
-
import { dt } from '../utils/shared.mjs';
|
|
7
6
|
import { pack } from '../locale/index.mjs';
|
|
8
7
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
9
8
|
var {
|
|
9
|
+
name,
|
|
10
10
|
n,
|
|
11
11
|
classes
|
|
12
12
|
} = createNamespace('action-sheet');
|
|
@@ -39,9 +39,12 @@ function __render__(_ctx, _cache) {
|
|
|
39
39
|
}), {
|
|
40
40
|
default: _withCtx(() => [_createElementVNode("div", _mergeProps({
|
|
41
41
|
class: _ctx.classes(_ctx.n(), _ctx.n('$--box'))
|
|
42
|
-
}, _ctx.$attrs), [_renderSlot(_ctx.$slots, "title", {}, () =>
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
}, _ctx.$attrs), [_renderSlot(_ctx.$slots, "title", {}, () => {
|
|
43
|
+
var _ctx$title;
|
|
44
|
+
return [_createElementVNode("div", {
|
|
45
|
+
class: _normalizeClass(_ctx.n('title'))
|
|
46
|
+
}, _toDisplayString((_ctx$title = _ctx.title) != null ? _ctx$title : _ctx.pack.actionSheetTitle), 3 /* TEXT, CLASS */)];
|
|
47
|
+
}), _renderSlot(_ctx.$slots, "actions", {}, () => [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.actions, action => {
|
|
45
48
|
return _withDirectives((_openBlock(), _createElementBlock("div", {
|
|
46
49
|
class: _normalizeClass(_ctx.classes(_ctx.n('action-item'), action.className, [action.disabled, _ctx.n('--disabled')])),
|
|
47
50
|
key: action.name,
|
|
@@ -66,7 +69,7 @@ function __render__(_ctx, _cache) {
|
|
|
66
69
|
}, 16 /* FULL_PROPS */, ["class", "show", "overlay", "overlay-class", "overlay-style", "lock-scroll", "close-on-click-overlay", "teleport", "safe-area", "onOpen", "onClose", "onClosed", "onOpened", "onRouteChange"]);
|
|
67
70
|
}
|
|
68
71
|
var __sfc__ = defineComponent({
|
|
69
|
-
name
|
|
72
|
+
name,
|
|
70
73
|
directives: {
|
|
71
74
|
Ripple
|
|
72
75
|
},
|
|
@@ -78,7 +81,12 @@ var __sfc__ = defineComponent({
|
|
|
78
81
|
props,
|
|
79
82
|
setup(props) {
|
|
80
83
|
var popupShow = ref(false);
|
|
81
|
-
|
|
84
|
+
watch(() => props.show, newValue => {
|
|
85
|
+
popupShow.value = newValue;
|
|
86
|
+
}, {
|
|
87
|
+
immediate: true
|
|
88
|
+
});
|
|
89
|
+
function handleSelect(action) {
|
|
82
90
|
if (action.disabled) {
|
|
83
91
|
return;
|
|
84
92
|
}
|
|
@@ -88,20 +96,16 @@ var __sfc__ = defineComponent({
|
|
|
88
96
|
} = props;
|
|
89
97
|
call(onSelect, action);
|
|
90
98
|
closeOnClickAction && call(props['onUpdate:show'], false);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}, {
|
|
96
|
-
immediate: true
|
|
97
|
-
});
|
|
99
|
+
}
|
|
100
|
+
function handlePopupUpdateShow(value) {
|
|
101
|
+
call(props['onUpdate:show'], value);
|
|
102
|
+
}
|
|
98
103
|
return {
|
|
104
|
+
popupShow,
|
|
105
|
+
pack,
|
|
99
106
|
n,
|
|
100
107
|
classes,
|
|
101
108
|
handlePopupUpdateShow,
|
|
102
|
-
popupShow,
|
|
103
|
-
pack,
|
|
104
|
-
dt,
|
|
105
109
|
handleSelect
|
|
106
110
|
};
|
|
107
111
|
}
|
package/es/app-bar/AppBar.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { props } from './props.mjs';
|
|
|
3
3
|
import { createNamespace, formatElevation } from '../utils/components.mjs';
|
|
4
4
|
import { onSmartMounted } from '@varlet/use';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n,
|
|
7
8
|
classes
|
|
8
9
|
} = createNamespace('app-bar');
|
|
@@ -36,7 +37,7 @@ function __render__(_ctx, _cache) {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
var __sfc__ = defineComponent({
|
|
39
|
-
name
|
|
40
|
+
name,
|
|
40
41
|
props,
|
|
41
42
|
setup(props, _ref) {
|
|
42
43
|
var {
|
|
@@ -44,10 +45,6 @@ var __sfc__ = defineComponent({
|
|
|
44
45
|
} = _ref;
|
|
45
46
|
var paddingLeft = ref();
|
|
46
47
|
var paddingRight = ref();
|
|
47
|
-
var computePadding = () => {
|
|
48
|
-
paddingLeft.value = slots.left ? 0 : undefined;
|
|
49
|
-
paddingRight.value = slots.right ? 0 : undefined;
|
|
50
|
-
};
|
|
51
48
|
var rootStyles = computed(() => {
|
|
52
49
|
var {
|
|
53
50
|
image,
|
|
@@ -70,13 +67,17 @@ var __sfc__ = defineComponent({
|
|
|
70
67
|
});
|
|
71
68
|
onSmartMounted(computePadding);
|
|
72
69
|
onUpdated(computePadding);
|
|
70
|
+
function computePadding() {
|
|
71
|
+
paddingLeft.value = slots.left ? 0 : undefined;
|
|
72
|
+
paddingRight.value = slots.right ? 0 : undefined;
|
|
73
|
+
}
|
|
73
74
|
return {
|
|
74
|
-
n,
|
|
75
|
-
classes,
|
|
76
|
-
formatElevation,
|
|
77
75
|
rootStyles,
|
|
78
76
|
paddingLeft,
|
|
79
|
-
paddingRight
|
|
77
|
+
paddingRight,
|
|
78
|
+
n,
|
|
79
|
+
classes,
|
|
80
|
+
formatElevation
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
});
|
package/es/avatar/Avatar.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import { createNamespace, call } from '../utils/components.mjs';
|
|
|
6
6
|
import { onSmartMounted } from '@varlet/use';
|
|
7
7
|
var isInternalSize = size => ['mini', 'small', 'normal', 'large'].includes(size);
|
|
8
8
|
var {
|
|
9
|
+
name,
|
|
9
10
|
n,
|
|
10
11
|
classes
|
|
11
12
|
} = createNamespace('avatar');
|
|
@@ -67,7 +68,7 @@ function __render__(_ctx, _cache) {
|
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
var __sfc__ = defineComponent({
|
|
70
|
-
name
|
|
71
|
+
name,
|
|
71
72
|
directives: {
|
|
72
73
|
Lazy
|
|
73
74
|
},
|
|
@@ -76,7 +77,9 @@ var __sfc__ = defineComponent({
|
|
|
76
77
|
var avatarElement = ref(null);
|
|
77
78
|
var textElement = ref(null);
|
|
78
79
|
var scale = ref(1);
|
|
79
|
-
|
|
80
|
+
onSmartMounted(getScale);
|
|
81
|
+
onUpdated(getScale);
|
|
82
|
+
function getScale() {
|
|
80
83
|
if (!avatarElement.value || !textElement.value) {
|
|
81
84
|
scale.value = 1;
|
|
82
85
|
return;
|
|
@@ -88,8 +91,8 @@ var __sfc__ = defineComponent({
|
|
|
88
91
|
} else {
|
|
89
92
|
scale.value = avatarElementWidth / textElementWidth;
|
|
90
93
|
}
|
|
91
|
-
}
|
|
92
|
-
|
|
94
|
+
}
|
|
95
|
+
function handleLoad(e) {
|
|
93
96
|
var el = e.currentTarget;
|
|
94
97
|
var {
|
|
95
98
|
lazy,
|
|
@@ -102,23 +105,21 @@ var __sfc__ = defineComponent({
|
|
|
102
105
|
} else {
|
|
103
106
|
call(onLoad, e);
|
|
104
107
|
}
|
|
105
|
-
}
|
|
106
|
-
|
|
108
|
+
}
|
|
109
|
+
function handleError(e) {
|
|
107
110
|
call(props.onError, e);
|
|
108
|
-
}
|
|
109
|
-
|
|
111
|
+
}
|
|
112
|
+
function handleClick(e) {
|
|
110
113
|
call(props.onClick, e);
|
|
111
|
-
}
|
|
112
|
-
onSmartMounted(getScale);
|
|
113
|
-
onUpdated(getScale);
|
|
114
|
+
}
|
|
114
115
|
return {
|
|
115
|
-
isInternalSize,
|
|
116
|
-
toSizeUnit,
|
|
117
|
-
n,
|
|
118
|
-
classes,
|
|
119
116
|
avatarElement,
|
|
120
117
|
textElement,
|
|
121
118
|
scale,
|
|
119
|
+
n,
|
|
120
|
+
classes,
|
|
121
|
+
isInternalSize,
|
|
122
|
+
toSizeUnit,
|
|
122
123
|
handleLoad,
|
|
123
124
|
handleError,
|
|
124
125
|
handleClick
|
|
@@ -3,6 +3,7 @@ import { props } from './props.mjs';
|
|
|
3
3
|
import { createNamespace } from '../utils/components.mjs';
|
|
4
4
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n,
|
|
7
8
|
classes
|
|
8
9
|
} = createNamespace('avatar-group');
|
|
@@ -15,7 +16,7 @@ function __render__(_ctx, _cache) {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
var __sfc__ = defineComponent({
|
|
18
|
-
name
|
|
19
|
+
name,
|
|
19
20
|
props,
|
|
20
21
|
setup(props) {
|
|
21
22
|
var rootStyles = computed(() => {
|
|
@@ -27,10 +28,10 @@ var __sfc__ = defineComponent({
|
|
|
27
28
|
};
|
|
28
29
|
});
|
|
29
30
|
return {
|
|
31
|
+
rootStyles,
|
|
30
32
|
n,
|
|
31
33
|
classes,
|
|
32
|
-
toSizeUnit
|
|
33
|
-
rootStyles
|
|
34
|
+
toSizeUnit
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
37
|
});
|
package/es/back-top/BackTop.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { getScrollTop, getScrollLeft, scrollTo, getParentScroller, toPxNum, toSi
|
|
|
8
8
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
9
9
|
import { onSmartUnmounted } from '@varlet/use';
|
|
10
10
|
var {
|
|
11
|
+
name,
|
|
11
12
|
n,
|
|
12
13
|
classes
|
|
13
14
|
} = createNamespace('back-top');
|
|
@@ -42,7 +43,7 @@ function __render__(_ctx, _cache) {
|
|
|
42
43
|
}, 8 /* PROPS */, ["elevation"])])], 16 /* FULL_PROPS */)], 8 /* PROPS */, ["disabled"]);
|
|
43
44
|
}
|
|
44
45
|
var __sfc__ = defineComponent({
|
|
45
|
-
name
|
|
46
|
+
name,
|
|
46
47
|
components: {
|
|
47
48
|
VarButton,
|
|
48
49
|
VarIcon
|
|
@@ -54,27 +55,9 @@ var __sfc__ = defineComponent({
|
|
|
54
55
|
var backTopEl = ref(null);
|
|
55
56
|
var disabled = ref(true);
|
|
56
57
|
var scroller;
|
|
57
|
-
var handleClick = event => {
|
|
58
|
-
call(props.onClick, event);
|
|
59
|
-
var left = getScrollLeft(scroller);
|
|
60
|
-
scrollTo(scroller, {
|
|
61
|
-
left,
|
|
62
|
-
duration: props.duration,
|
|
63
|
-
animation: easeInOutCubic
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
58
|
var handleScroll = throttle(() => {
|
|
67
59
|
show.value = getScrollTop(scroller) >= toPxNum(props.visibilityHeight);
|
|
68
60
|
}, 200);
|
|
69
|
-
var setScroller = () => {
|
|
70
|
-
scroller = props.target ? getTarget(props.target, 'BackTop') : getParentScroller(backTopEl.value);
|
|
71
|
-
};
|
|
72
|
-
var addScrollerEventListener = () => {
|
|
73
|
-
scroller.addEventListener('scroll', handleScroll);
|
|
74
|
-
};
|
|
75
|
-
var removeScrollerEventListener = () => {
|
|
76
|
-
scroller.removeEventListener('scroll', handleScroll);
|
|
77
|
-
};
|
|
78
61
|
onMounted(() => {
|
|
79
62
|
setScroller();
|
|
80
63
|
addScrollerEventListener();
|
|
@@ -82,6 +65,24 @@ var __sfc__ = defineComponent({
|
|
|
82
65
|
});
|
|
83
66
|
onActivated(addScrollerEventListener);
|
|
84
67
|
onSmartUnmounted(removeScrollerEventListener);
|
|
68
|
+
function handleClick(event) {
|
|
69
|
+
call(props.onClick, event);
|
|
70
|
+
var left = getScrollLeft(scroller);
|
|
71
|
+
scrollTo(scroller, {
|
|
72
|
+
left,
|
|
73
|
+
duration: props.duration,
|
|
74
|
+
animation: easeInOutCubic
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function setScroller() {
|
|
78
|
+
scroller = props.target ? getTarget(props.target, 'BackTop') : getParentScroller(backTopEl.value);
|
|
79
|
+
}
|
|
80
|
+
function addScrollerEventListener() {
|
|
81
|
+
scroller.addEventListener('scroll', handleScroll);
|
|
82
|
+
}
|
|
83
|
+
function removeScrollerEventListener() {
|
|
84
|
+
scroller.removeEventListener('scroll', handleScroll);
|
|
85
|
+
}
|
|
85
86
|
return {
|
|
86
87
|
disabled,
|
|
87
88
|
show,
|
package/es/badge/Badge.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { computed, defineComponent } from 'vue';
|
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
import { createNamespace } from '../utils/components.mjs';
|
|
6
6
|
var {
|
|
7
|
+
name,
|
|
7
8
|
n,
|
|
8
9
|
classes
|
|
9
10
|
} = createNamespace('badge');
|
|
@@ -35,7 +36,7 @@ function __render__(_ctx, _cache) {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
var __sfc__ = defineComponent({
|
|
38
|
-
name
|
|
39
|
+
name,
|
|
39
40
|
components: {
|
|
40
41
|
VarIcon
|
|
41
42
|
},
|
|
@@ -50,9 +51,9 @@ var __sfc__ = defineComponent({
|
|
|
50
51
|
return value != null && maxValue != null && toNumber(value) > toNumber(maxValue) ? maxValue + "+" : value;
|
|
51
52
|
});
|
|
52
53
|
return {
|
|
54
|
+
value,
|
|
53
55
|
n,
|
|
54
|
-
classes
|
|
55
|
-
value
|
|
56
|
+
classes
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
59
|
});
|
|
@@ -7,6 +7,7 @@ import { createNamespace, call } from '../utils/components.mjs';
|
|
|
7
7
|
import { isNumber, normalizeToArray } from '@varlet/shared';
|
|
8
8
|
import { onSmartMounted } from '@varlet/use';
|
|
9
9
|
var {
|
|
10
|
+
name,
|
|
10
11
|
n,
|
|
11
12
|
classes
|
|
12
13
|
} = createNamespace('bottom-navigation');
|
|
@@ -40,7 +41,7 @@ function __render__(_ctx, _cache) {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
var __sfc__ = defineComponent({
|
|
43
|
-
name
|
|
44
|
+
name,
|
|
44
45
|
components: {
|
|
45
46
|
VarButton
|
|
46
47
|
},
|
|
@@ -59,25 +60,56 @@ var __sfc__ = defineComponent({
|
|
|
59
60
|
bottomNavigationItems,
|
|
60
61
|
bindBottomNavigationItem
|
|
61
62
|
} = useBottomNavigationItems();
|
|
62
|
-
var
|
|
63
|
-
|
|
63
|
+
var bottomNavigationProvider = {
|
|
64
|
+
active,
|
|
65
|
+
activeColor,
|
|
66
|
+
inactiveColor,
|
|
67
|
+
onToggle
|
|
68
|
+
};
|
|
69
|
+
bindBottomNavigationItem(bottomNavigationProvider);
|
|
70
|
+
watch(() => length.value, matchBoundary);
|
|
71
|
+
watch(() => props.fabProps, newValue => {
|
|
72
|
+
fabProps.value = _extends({}, defaultFabProps, newValue);
|
|
73
|
+
}, {
|
|
74
|
+
immediate: true,
|
|
75
|
+
deep: true
|
|
76
|
+
});
|
|
77
|
+
onSmartMounted(() => {
|
|
78
|
+
if (!slots.fab) {
|
|
64
79
|
return;
|
|
65
80
|
}
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
var matchName = () => bottomNavigationItems.find(_ref2 => {
|
|
69
|
-
var {
|
|
70
|
-
name
|
|
71
|
-
} = _ref2;
|
|
72
|
-
return active.value === name.value;
|
|
81
|
+
addMarginClass(length.value);
|
|
73
82
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
onUpdated(() => {
|
|
84
|
+
removeMarginClass();
|
|
85
|
+
if (!slots.fab) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
addMarginClass(length.value);
|
|
79
89
|
});
|
|
80
|
-
|
|
90
|
+
function matchBoundary() {
|
|
91
|
+
if (length.value === 0 || matchName() || matchIndex()) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
handleActiveIndex();
|
|
95
|
+
}
|
|
96
|
+
function matchName() {
|
|
97
|
+
return bottomNavigationItems.find(_ref2 => {
|
|
98
|
+
var {
|
|
99
|
+
name
|
|
100
|
+
} = _ref2;
|
|
101
|
+
return active.value === name.value;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function matchIndex() {
|
|
105
|
+
return bottomNavigationItems.find(_ref3 => {
|
|
106
|
+
var {
|
|
107
|
+
index
|
|
108
|
+
} = _ref3;
|
|
109
|
+
return active.value === index.value;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function handleActiveIndex() {
|
|
81
113
|
if (!isNumber(active.value)) {
|
|
82
114
|
return;
|
|
83
115
|
}
|
|
@@ -86,40 +118,40 @@ var __sfc__ = defineComponent({
|
|
|
86
118
|
} else if (active.value > length.value - 1) {
|
|
87
119
|
call(props['onUpdate:active'], length.value - 1);
|
|
88
120
|
}
|
|
89
|
-
}
|
|
90
|
-
|
|
121
|
+
}
|
|
122
|
+
function onToggle(changedValue) {
|
|
91
123
|
if (active.value === changedValue) {
|
|
92
124
|
return;
|
|
93
125
|
}
|
|
94
126
|
props.onBeforeChange ? handleBeforeChange(changedValue) : handleChange(changedValue);
|
|
95
|
-
}
|
|
96
|
-
|
|
127
|
+
}
|
|
128
|
+
function handleBeforeChange(changedValue) {
|
|
97
129
|
var results = normalizeToArray(call(props.onBeforeChange, changedValue));
|
|
98
130
|
Promise.all(results).then(results => {
|
|
99
131
|
if (results.every(Boolean)) {
|
|
100
132
|
handleChange(changedValue);
|
|
101
133
|
}
|
|
102
134
|
});
|
|
103
|
-
}
|
|
104
|
-
|
|
135
|
+
}
|
|
136
|
+
function handleChange(changedValue) {
|
|
105
137
|
call(props['onUpdate:active'], changedValue);
|
|
106
138
|
call(props.onChange, changedValue);
|
|
107
|
-
}
|
|
108
|
-
|
|
139
|
+
}
|
|
140
|
+
function removeMarginClass() {
|
|
109
141
|
var bottomNavigationItems = getBottomNavigationItems();
|
|
110
142
|
bottomNavigationItems.forEach(dom => {
|
|
111
143
|
dom.classList.remove(RIGHT_HALF_SPACE_CLASS, LEFT_HALF_SPACE_CLASS, RIGHT_SPACE_CLASS);
|
|
112
144
|
});
|
|
113
|
-
}
|
|
114
|
-
|
|
145
|
+
}
|
|
146
|
+
function addMarginClass(length) {
|
|
115
147
|
var bottomNavigationItems = getBottomNavigationItems();
|
|
116
148
|
var itemsNum = bottomNavigationItems.length;
|
|
117
149
|
var isEven = length % 2 === 0;
|
|
118
150
|
bottomNavigationItems.forEach((bottomNavigationItem, i) => {
|
|
119
151
|
handleMarginClass(isEven, bottomNavigationItem, i, itemsNum);
|
|
120
152
|
});
|
|
121
|
-
}
|
|
122
|
-
|
|
153
|
+
}
|
|
154
|
+
function handleMarginClass(isEven, dom, i, length) {
|
|
123
155
|
var isLast = i === length - 1;
|
|
124
156
|
if (!isEven && isLast) {
|
|
125
157
|
dom.classList.add(RIGHT_SPACE_CLASS);
|
|
@@ -132,45 +164,20 @@ var __sfc__ = defineComponent({
|
|
|
132
164
|
} else if (isFabRight) {
|
|
133
165
|
dom.classList.add(LEFT_HALF_SPACE_CLASS);
|
|
134
166
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
167
|
+
}
|
|
168
|
+
function getBottomNavigationItems() {
|
|
169
|
+
return Array.from(bottomNavigationDom.value.querySelectorAll("." + nItem()));
|
|
170
|
+
}
|
|
171
|
+
function handleFabClick() {
|
|
138
172
|
call(props.onFabClick);
|
|
139
|
-
}
|
|
140
|
-
var bottomNavigationProvider = {
|
|
141
|
-
active,
|
|
142
|
-
activeColor,
|
|
143
|
-
inactiveColor,
|
|
144
|
-
onToggle
|
|
145
|
-
};
|
|
146
|
-
bindBottomNavigationItem(bottomNavigationProvider);
|
|
147
|
-
watch(() => length.value, matchBoundary);
|
|
148
|
-
watch(() => props.fabProps, newValue => {
|
|
149
|
-
fabProps.value = _extends({}, defaultFabProps, newValue);
|
|
150
|
-
}, {
|
|
151
|
-
immediate: true,
|
|
152
|
-
deep: true
|
|
153
|
-
});
|
|
154
|
-
onSmartMounted(() => {
|
|
155
|
-
if (!slots.fab) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
addMarginClass(length.value);
|
|
159
|
-
});
|
|
160
|
-
onUpdated(() => {
|
|
161
|
-
removeMarginClass();
|
|
162
|
-
if (!slots.fab) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
addMarginClass(length.value);
|
|
166
|
-
});
|
|
173
|
+
}
|
|
167
174
|
return {
|
|
168
|
-
n,
|
|
169
|
-
classes,
|
|
170
175
|
length,
|
|
171
176
|
bottomNavigationDom,
|
|
172
|
-
|
|
173
|
-
|
|
177
|
+
fabProps,
|
|
178
|
+
n,
|
|
179
|
+
classes,
|
|
180
|
+
handleFabClick
|
|
174
181
|
};
|
|
175
182
|
}
|
|
176
183
|
});
|
|
@@ -6,6 +6,7 @@ import { props } from './props.mjs';
|
|
|
6
6
|
import { useBottomNavigation } from './provide.mjs';
|
|
7
7
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
8
8
|
var {
|
|
9
|
+
name,
|
|
9
10
|
n,
|
|
10
11
|
classes
|
|
11
12
|
} = createNamespace('bottom-navigation-item');
|
|
@@ -46,7 +47,7 @@ function __render__(_ctx, _cache) {
|
|
|
46
47
|
}, [_createTextVNode(_toDisplayString(_ctx.label), 1 /* TEXT */)], 64 /* STABLE_FRAGMENT */)) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "default")], 2 /* CLASS */)], 6 /* CLASS, STYLE */)), [[_directive_ripple]]);
|
|
47
48
|
}
|
|
48
49
|
var __sfc__ = defineComponent({
|
|
49
|
-
name
|
|
50
|
+
name,
|
|
50
51
|
components: {
|
|
51
52
|
VarBadge,
|
|
52
53
|
VarIcon
|
|
@@ -73,26 +74,28 @@ var __sfc__ = defineComponent({
|
|
|
73
74
|
name,
|
|
74
75
|
index
|
|
75
76
|
};
|
|
76
|
-
var computeColorStyle = () => active.value === name.value || active.value === index.value ? activeColor.value : inactiveColor.value;
|
|
77
|
-
var handleClick = () => {
|
|
78
|
-
var _name$value;
|
|
79
|
-
var active = (_name$value = name.value) != null ? _name$value : index.value;
|
|
80
|
-
call(props.onClick, active);
|
|
81
|
-
call(bottomNavigation.onToggle, active);
|
|
82
|
-
};
|
|
83
77
|
bindBottomNavigation(bottomNavigationItemProvider);
|
|
84
78
|
watch(() => badge.value, newValue => {
|
|
85
79
|
badgeProps.value = newValue === true ? defaultBadgeProps : badge.value;
|
|
86
80
|
}, {
|
|
87
81
|
immediate: true
|
|
88
82
|
});
|
|
83
|
+
function computeColorStyle() {
|
|
84
|
+
return active.value === name.value || active.value === index.value ? activeColor.value : inactiveColor.value;
|
|
85
|
+
}
|
|
86
|
+
function handleClick() {
|
|
87
|
+
var _name$value;
|
|
88
|
+
var active = (_name$value = name.value) != null ? _name$value : index.value;
|
|
89
|
+
call(props.onClick, active);
|
|
90
|
+
call(bottomNavigation.onToggle, active);
|
|
91
|
+
}
|
|
89
92
|
return {
|
|
90
|
-
n,
|
|
91
|
-
classes,
|
|
92
93
|
index,
|
|
93
94
|
active,
|
|
94
95
|
badge,
|
|
95
96
|
badgeProps,
|
|
97
|
+
n,
|
|
98
|
+
classes,
|
|
96
99
|
computeColorStyle,
|
|
97
100
|
handleClick
|
|
98
101
|
};
|
|
@@ -3,6 +3,7 @@ import { props } from './props.mjs';
|
|
|
3
3
|
import { useBreadcrumb } from './provide.mjs';
|
|
4
4
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n,
|
|
7
8
|
classes
|
|
8
9
|
} = createNamespace('breadcrumb');
|
|
@@ -26,7 +27,7 @@ function __render__(_ctx, _cache) {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
var __sfc__ = defineComponent({
|
|
29
|
-
name
|
|
30
|
+
name,
|
|
30
31
|
props,
|
|
31
32
|
setup(props) {
|
|
32
33
|
var {
|
|
@@ -36,13 +37,13 @@ var __sfc__ = defineComponent({
|
|
|
36
37
|
} = useBreadcrumb();
|
|
37
38
|
var isLast = computed(() => index.value === breadcrumb.length.value - 1);
|
|
38
39
|
var parentSeparator = computed(() => breadcrumb.separator.value);
|
|
39
|
-
|
|
40
|
+
bindBreadcrumb(null);
|
|
41
|
+
function handleClick(e) {
|
|
40
42
|
if (isLast.value) {
|
|
41
43
|
return;
|
|
42
44
|
}
|
|
43
45
|
call(props.onClick, e);
|
|
44
|
-
}
|
|
45
|
-
bindBreadcrumb(null);
|
|
46
|
+
}
|
|
46
47
|
return {
|
|
47
48
|
n,
|
|
48
49
|
classes,
|
|
@@ -3,6 +3,7 @@ import { props } from './props.mjs';
|
|
|
3
3
|
import { useBreadcrumbsList } from './provide.mjs';
|
|
4
4
|
import { createNamespace } from '../utils/components.mjs';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n
|
|
7
8
|
} = createNamespace('breadcrumbs');
|
|
8
9
|
import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
|
|
@@ -13,7 +14,7 @@ function __render__(_ctx, _cache) {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
var __sfc__ = defineComponent({
|
|
16
|
-
name
|
|
17
|
+
name,
|
|
17
18
|
props,
|
|
18
19
|
setup(props) {
|
|
19
20
|
var separator = computed(() => props.separator);
|
package/es/button/Button.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { call, createNamespace, formatElevation } from '../utils/components.mjs'
|
|
|
8
8
|
import { useButtonGroup } from './provide.mjs';
|
|
9
9
|
import { isArray } from '@varlet/shared';
|
|
10
10
|
var {
|
|
11
|
+
name,
|
|
11
12
|
n,
|
|
12
13
|
classes
|
|
13
14
|
} = createNamespace('button');
|
|
@@ -50,7 +51,7 @@ function __render__(_ctx, _cache) {
|
|
|
50
51
|
}], [_directive_hover, _ctx.handleHovering, "desktop"]]);
|
|
51
52
|
}
|
|
52
53
|
var __sfc__ = defineComponent({
|
|
53
|
-
name
|
|
54
|
+
name,
|
|
54
55
|
components: {
|
|
55
56
|
VarLoading,
|
|
56
57
|
VarHoverOverlay
|
|
@@ -98,7 +99,7 @@ var __sfc__ = defineComponent({
|
|
|
98
99
|
outline: mode.value === 'outline'
|
|
99
100
|
};
|
|
100
101
|
});
|
|
101
|
-
|
|
102
|
+
function attemptAutoLoading(result) {
|
|
102
103
|
if (props.autoLoading) {
|
|
103
104
|
pending.value = true;
|
|
104
105
|
result = isArray(result) ? result : [result];
|
|
@@ -108,8 +109,8 @@ var __sfc__ = defineComponent({
|
|
|
108
109
|
pending.value = false;
|
|
109
110
|
});
|
|
110
111
|
}
|
|
111
|
-
}
|
|
112
|
-
|
|
112
|
+
}
|
|
113
|
+
function handleClick(e) {
|
|
113
114
|
var {
|
|
114
115
|
loading,
|
|
115
116
|
disabled,
|
|
@@ -119,8 +120,8 @@ var __sfc__ = defineComponent({
|
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
121
122
|
attemptAutoLoading(call(onClick, e));
|
|
122
|
-
}
|
|
123
|
-
|
|
123
|
+
}
|
|
124
|
+
function handleTouchstart(e) {
|
|
124
125
|
var {
|
|
125
126
|
loading,
|
|
126
127
|
disabled,
|
|
@@ -130,13 +131,13 @@ var __sfc__ = defineComponent({
|
|
|
130
131
|
return;
|
|
131
132
|
}
|
|
132
133
|
attemptAutoLoading(call(onTouchstart, e));
|
|
133
|
-
}
|
|
134
|
+
}
|
|
134
135
|
return {
|
|
135
|
-
n,
|
|
136
|
-
classes,
|
|
137
136
|
pending,
|
|
138
137
|
states,
|
|
139
138
|
hovering,
|
|
139
|
+
n,
|
|
140
|
+
classes,
|
|
140
141
|
handleHovering,
|
|
141
142
|
handleClick,
|
|
142
143
|
handleTouchstart
|