@varlet/ui 2.16.2 → 2.16.3-alpha.1694361535255
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/snackbar/style/index.mjs +1 -1
- 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 +2365 -2102
- package/package.json +12 -14
- package/umd/varlet.js +4 -4
package/es/list/List.mjs
CHANGED
|
@@ -6,12 +6,12 @@ import { defineComponent, ref, nextTick, watch } from 'vue';
|
|
|
6
6
|
import { getParentScroller, toPxNum } from '../utils/elements.mjs';
|
|
7
7
|
import { props } from './props.mjs';
|
|
8
8
|
import { isNumber, getRect } from '@varlet/shared';
|
|
9
|
-
import { dt } from '../utils/shared.mjs';
|
|
10
9
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
11
10
|
import { pack } from '../locale/index.mjs';
|
|
12
11
|
import { onSmartMounted, onSmartUnmounted } from '@varlet/use';
|
|
13
12
|
import { useTabItem } from './provide.mjs';
|
|
14
13
|
var {
|
|
14
|
+
name,
|
|
15
15
|
n,
|
|
16
16
|
classes
|
|
17
17
|
} = createNamespace('list');
|
|
@@ -24,32 +24,41 @@ function __render__(_ctx, _cache) {
|
|
|
24
24
|
ref: "listEl"
|
|
25
25
|
}, [_renderSlot(_ctx.$slots, "default"), _ctx.loading ? _renderSlot(_ctx.$slots, "loading", {
|
|
26
26
|
key: 0
|
|
27
|
-
}, () =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
}, () => {
|
|
28
|
+
var _ctx$loadingText;
|
|
29
|
+
return [_createElementVNode("div", {
|
|
30
|
+
class: _normalizeClass(_ctx.n('loading'))
|
|
31
|
+
}, [_createElementVNode("div", {
|
|
32
|
+
class: _normalizeClass(_ctx.n('loading-text'))
|
|
33
|
+
}, _toDisplayString((_ctx$loadingText = _ctx.loadingText) != null ? _ctx$loadingText : _ctx.pack.listLoadingText), 3 /* TEXT, CLASS */), _createVNode(_component_var_loading, {
|
|
34
|
+
size: "mini",
|
|
35
|
+
radius: 10
|
|
36
|
+
})], 2 /* CLASS */)];
|
|
37
|
+
}) : _createCommentVNode("v-if", true), _ctx.finished ? _renderSlot(_ctx.$slots, "finished", {
|
|
35
38
|
key: 1
|
|
36
|
-
}, () =>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
}, () => {
|
|
40
|
+
var _ctx$finishedText;
|
|
41
|
+
return [_createElementVNode("div", {
|
|
42
|
+
class: _normalizeClass(_ctx.n('finished'))
|
|
43
|
+
}, _toDisplayString((_ctx$finishedText = _ctx.finishedText) != null ? _ctx$finishedText : _ctx.pack.listFinishedText), 3 /* TEXT, CLASS */)];
|
|
44
|
+
}) : _createCommentVNode("v-if", true), _ctx.error ? _renderSlot(_ctx.$slots, "error", {
|
|
39
45
|
key: 2
|
|
40
|
-
}, () =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
}, () => {
|
|
47
|
+
var _ctx$errorText;
|
|
48
|
+
return [_withDirectives((_openBlock(), _createElementBlock("div", {
|
|
49
|
+
class: _normalizeClass(_ctx.n('error')),
|
|
50
|
+
onClick: _cache[0] || (_cache[0] = function () {
|
|
51
|
+
return _ctx.load && _ctx.load(...arguments);
|
|
52
|
+
})
|
|
53
|
+
}, [_createTextVNode(_toDisplayString((_ctx$errorText = _ctx.errorText) != null ? _ctx$errorText : _ctx.pack.listErrorText), 1 /* TEXT */)], 2 /* CLASS */)), [[_directive_ripple]])];
|
|
54
|
+
}) : _createCommentVNode("v-if", true), _createElementVNode("div", {
|
|
46
55
|
class: _normalizeClass(_ctx.n('detector')),
|
|
47
56
|
ref: "detectorEl"
|
|
48
57
|
}, null, 2 /* CLASS */)], 2 /* CLASS */);
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
var __sfc__ = defineComponent({
|
|
52
|
-
name
|
|
61
|
+
name,
|
|
53
62
|
directives: {
|
|
54
63
|
Ripple
|
|
55
64
|
},
|
|
@@ -58,19 +67,32 @@ var __sfc__ = defineComponent({
|
|
|
58
67
|
},
|
|
59
68
|
props,
|
|
60
69
|
setup(props) {
|
|
70
|
+
var listEl = ref(null);
|
|
71
|
+
var detectorEl = ref(null);
|
|
61
72
|
var {
|
|
62
73
|
tabItem,
|
|
63
74
|
bindTabItem
|
|
64
75
|
} = useTabItem();
|
|
65
|
-
var listEl = ref(null);
|
|
66
|
-
var detectorEl = ref(null);
|
|
67
76
|
var scroller;
|
|
68
|
-
|
|
77
|
+
call(bindTabItem, {});
|
|
78
|
+
if (tabItem) {
|
|
79
|
+
watch(() => tabItem.current.value, check);
|
|
80
|
+
}
|
|
81
|
+
watch(() => [props.loading, props.error, props.finished], check);
|
|
82
|
+
onSmartMounted(() => {
|
|
83
|
+
scroller = getParentScroller(listEl.value);
|
|
84
|
+
scroller.addEventListener('scroll', check);
|
|
85
|
+
if (props.immediateCheck) {
|
|
86
|
+
check();
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
onSmartUnmounted(removeScrollerListener);
|
|
90
|
+
function load() {
|
|
69
91
|
call(props['onUpdate:error'], false);
|
|
70
92
|
call(props['onUpdate:loading'], true);
|
|
71
93
|
call(props.onLoad);
|
|
72
|
-
}
|
|
73
|
-
|
|
94
|
+
}
|
|
95
|
+
function isReachBottom() {
|
|
74
96
|
var {
|
|
75
97
|
bottom: containerBottom
|
|
76
98
|
} = getRect(scroller);
|
|
@@ -81,42 +103,29 @@ var __sfc__ = defineComponent({
|
|
|
81
103
|
// The fractional part of the detectorBottom when bottoming out overflows
|
|
82
104
|
// https://github.com/varletjs/varlet/issues/310
|
|
83
105
|
return Math.floor(detectorBottom) - toPxNum(props.offset) <= containerBottom;
|
|
84
|
-
}
|
|
85
|
-
|
|
106
|
+
}
|
|
107
|
+
function removeScrollerListener() {
|
|
86
108
|
scroller.removeEventListener('scroll', check);
|
|
87
|
-
}
|
|
109
|
+
}
|
|
88
110
|
|
|
89
111
|
// expose
|
|
90
|
-
|
|
91
|
-
|
|
112
|
+
function check() {
|
|
113
|
+
return _check.apply(this, arguments);
|
|
114
|
+
}
|
|
115
|
+
function _check() {
|
|
116
|
+
_check = _asyncToGenerator(function* () {
|
|
92
117
|
yield nextTick();
|
|
93
118
|
if (props.loading || props.finished || props.error || (tabItem == null ? void 0 : tabItem.current.value) === false || !isReachBottom()) {
|
|
94
119
|
return;
|
|
95
120
|
}
|
|
96
121
|
load();
|
|
97
122
|
});
|
|
98
|
-
return
|
|
99
|
-
return _ref.apply(this, arguments);
|
|
100
|
-
};
|
|
101
|
-
}();
|
|
102
|
-
call(bindTabItem, {});
|
|
103
|
-
if (tabItem) {
|
|
104
|
-
watch(() => tabItem.current.value, check);
|
|
123
|
+
return _check.apply(this, arguments);
|
|
105
124
|
}
|
|
106
|
-
watch(() => [props.loading, props.error, props.finished], check);
|
|
107
|
-
onSmartMounted(() => {
|
|
108
|
-
scroller = getParentScroller(listEl.value);
|
|
109
|
-
scroller.addEventListener('scroll', check);
|
|
110
|
-
if (props.immediateCheck) {
|
|
111
|
-
check();
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
onSmartUnmounted(removeScrollerListener);
|
|
115
125
|
return {
|
|
116
126
|
pack,
|
|
117
127
|
listEl,
|
|
118
128
|
detectorEl,
|
|
119
|
-
dt,
|
|
120
129
|
isNumber,
|
|
121
130
|
load,
|
|
122
131
|
check,
|
package/es/loading/Loading.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { props } from './props.mjs';
|
|
|
3
3
|
import { createNamespace, call } from '../utils/components.mjs';
|
|
4
4
|
import { multiplySizeUnit } from '../utils/elements.mjs';
|
|
5
5
|
var {
|
|
6
|
+
name,
|
|
6
7
|
n,
|
|
7
8
|
classes
|
|
8
9
|
} = createNamespace('loading');
|
|
@@ -64,28 +65,30 @@ function __render__(_ctx, _cache) {
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
var __sfc__ = defineComponent({
|
|
67
|
-
name
|
|
68
|
+
name,
|
|
68
69
|
props,
|
|
69
70
|
setup(props, _ref) {
|
|
70
71
|
var {
|
|
71
72
|
slots
|
|
72
73
|
} = _ref;
|
|
74
|
+
var isShow = computed(() => {
|
|
75
|
+
if (!call(slots.default)) {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
return props.loading;
|
|
79
|
+
});
|
|
73
80
|
var loadingTypeDict = {
|
|
74
81
|
wave: 5,
|
|
75
82
|
cube: 4,
|
|
76
83
|
rect: 8,
|
|
77
84
|
disappear: 3
|
|
78
85
|
};
|
|
79
|
-
var isShow = computed(() => {
|
|
80
|
-
if (!call(slots.default)) return true;
|
|
81
|
-
return props.loading;
|
|
82
|
-
});
|
|
83
86
|
return {
|
|
87
|
+
loadingTypeDict,
|
|
88
|
+
isShow,
|
|
84
89
|
n,
|
|
85
90
|
classes,
|
|
86
|
-
multiplySizeUnit
|
|
87
|
-
loadingTypeDict,
|
|
88
|
-
isShow
|
|
91
|
+
multiplySizeUnit
|
|
89
92
|
};
|
|
90
93
|
}
|
|
91
94
|
});
|
|
@@ -7,11 +7,12 @@ import { props } from './props.mjs';
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var {
|
|
10
|
+
name,
|
|
10
11
|
classes,
|
|
11
12
|
n
|
|
12
13
|
} = createNamespace('loading-bar');
|
|
13
14
|
export default defineComponent({
|
|
14
|
-
name
|
|
15
|
+
name,
|
|
15
16
|
props,
|
|
16
17
|
setup(props) {
|
|
17
18
|
return () => _createVNode("div", {
|
package/es/menu/Menu.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { props } from './props.mjs';
|
|
|
4
4
|
import { usePopover } from './usePopover.mjs';
|
|
5
5
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
6
6
|
var {
|
|
7
|
+
name,
|
|
7
8
|
n,
|
|
8
9
|
classes
|
|
9
10
|
} = createNamespace('menu');
|
|
@@ -50,7 +51,7 @@ function __render__(_ctx, _cache) {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
var __sfc__ = defineComponent({
|
|
53
|
-
name
|
|
54
|
+
name,
|
|
54
55
|
props,
|
|
55
56
|
setup(props) {
|
|
56
57
|
var {
|
package/es/option/Option.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { useSelect } from './provide.mjs';
|
|
|
7
7
|
import { createNamespace } from '../utils/components.mjs';
|
|
8
8
|
import { props } from './props.mjs';
|
|
9
9
|
var {
|
|
10
|
+
name,
|
|
10
11
|
n,
|
|
11
12
|
classes
|
|
12
13
|
} = createNamespace('option');
|
|
@@ -44,7 +45,7 @@ function __render__(_ctx, _cache) {
|
|
|
44
45
|
}, null, 8 /* PROPS */, ["hovering"])], 6 /* CLASS, STYLE */)), [[_directive_ripple], [_directive_hover, _ctx.handleHovering, "desktop"]]);
|
|
45
46
|
}
|
|
46
47
|
var __sfc__ = defineComponent({
|
|
47
|
-
name
|
|
48
|
+
name,
|
|
48
49
|
directives: {
|
|
49
50
|
Ripple,
|
|
50
51
|
Hover
|
|
@@ -73,16 +74,6 @@ var __sfc__ = defineComponent({
|
|
|
73
74
|
hovering,
|
|
74
75
|
handleHovering
|
|
75
76
|
} = useHoverOverlay();
|
|
76
|
-
var handleClick = () => {
|
|
77
|
-
if (multiple.value) {
|
|
78
|
-
optionSelected.value = !optionSelected.value;
|
|
79
|
-
}
|
|
80
|
-
onSelect(optionProvider);
|
|
81
|
-
};
|
|
82
|
-
var handleSelect = () => onSelect(optionProvider);
|
|
83
|
-
var sync = checked => {
|
|
84
|
-
optionSelected.value = checked;
|
|
85
|
-
};
|
|
86
77
|
var optionProvider = {
|
|
87
78
|
label,
|
|
88
79
|
value,
|
|
@@ -91,6 +82,18 @@ var __sfc__ = defineComponent({
|
|
|
91
82
|
};
|
|
92
83
|
watch([() => props.label, () => props.value], computeLabel);
|
|
93
84
|
bindSelect(optionProvider);
|
|
85
|
+
function handleClick() {
|
|
86
|
+
if (multiple.value) {
|
|
87
|
+
optionSelected.value = !optionSelected.value;
|
|
88
|
+
}
|
|
89
|
+
onSelect(optionProvider);
|
|
90
|
+
}
|
|
91
|
+
function handleSelect() {
|
|
92
|
+
return onSelect(optionProvider);
|
|
93
|
+
}
|
|
94
|
+
function sync(checked) {
|
|
95
|
+
optionSelected.value = checked;
|
|
96
|
+
}
|
|
94
97
|
return {
|
|
95
98
|
n,
|
|
96
99
|
classes,
|
package/es/overlay/Overlay.mjs
CHANGED
|
@@ -10,10 +10,11 @@ function _isSlot(s) {
|
|
|
10
10
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
|
|
11
11
|
}
|
|
12
12
|
var {
|
|
13
|
+
name,
|
|
13
14
|
n
|
|
14
15
|
} = createNamespace('overlay');
|
|
15
16
|
export default defineComponent({
|
|
16
|
-
name
|
|
17
|
+
name,
|
|
17
18
|
inheritAttrs: false,
|
|
18
19
|
props,
|
|
19
20
|
setup(props, _ref) {
|
|
@@ -27,29 +28,28 @@ export default defineComponent({
|
|
|
27
28
|
var {
|
|
28
29
|
disabled
|
|
29
30
|
} = useTeleport();
|
|
30
|
-
|
|
31
|
+
useLock(() => props.show, () => props.lockScroll);
|
|
32
|
+
function handleClickOverlay() {
|
|
31
33
|
call(props.onClick);
|
|
32
34
|
call(props['onUpdate:show'], false);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
show
|
|
46
|
-
} = props;
|
|
35
|
+
}
|
|
36
|
+
function renderOverlay() {
|
|
37
|
+
return _createVNode("div", _mergeProps({
|
|
38
|
+
"class": n(),
|
|
39
|
+
"style": {
|
|
40
|
+
zIndex: zIndex.value - 1
|
|
41
|
+
}
|
|
42
|
+
}, attrs, {
|
|
43
|
+
"onClick": handleClickOverlay
|
|
44
|
+
}), [call(slots.default)]);
|
|
45
|
+
}
|
|
46
|
+
function renderTransitionOverlay() {
|
|
47
47
|
return _createVNode(Transition, {
|
|
48
48
|
"name": n('--fade')
|
|
49
49
|
}, {
|
|
50
|
-
default: () => [show && renderOverlay()]
|
|
50
|
+
default: () => [props.show && renderOverlay()]
|
|
51
51
|
});
|
|
52
|
-
}
|
|
52
|
+
}
|
|
53
53
|
return () => {
|
|
54
54
|
var {
|
|
55
55
|
teleport
|
|
@@ -9,6 +9,7 @@ import { isNumber, toNumber } from '@varlet/shared';
|
|
|
9
9
|
import { pack } from '../locale/index.mjs';
|
|
10
10
|
import { call, createNamespace, formatElevation } from '../utils/components.mjs';
|
|
11
11
|
var {
|
|
12
|
+
name,
|
|
12
13
|
n,
|
|
13
14
|
classes
|
|
14
15
|
} = createNamespace('pagination');
|
|
@@ -111,7 +112,7 @@ function __render__(_ctx, _cache) {
|
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
var __sfc__ = defineComponent({
|
|
114
|
-
name
|
|
115
|
+
name,
|
|
115
116
|
components: {
|
|
116
117
|
VarMenu,
|
|
117
118
|
VarIcon,
|
|
@@ -139,69 +140,11 @@ var __sfc__ = defineComponent({
|
|
|
139
140
|
return [start, end];
|
|
140
141
|
});
|
|
141
142
|
var totalText = computed(() => {
|
|
142
|
-
if (!props.showTotal)
|
|
143
|
+
if (!props.showTotal) {
|
|
144
|
+
return '';
|
|
145
|
+
}
|
|
143
146
|
return props.showTotal(toNumber(props.total), range.value);
|
|
144
147
|
});
|
|
145
|
-
var isHideEllipsis = (item, index) => {
|
|
146
|
-
if (isNumber(item)) return false;
|
|
147
|
-
return index === 1 ? isHideEllipsisHead.value : isHideEllipsisTail.value;
|
|
148
|
-
};
|
|
149
|
-
var getMode = (item, index) => {
|
|
150
|
-
if (isNumber(item)) return 'basic';
|
|
151
|
-
return index === 1 ? 'head' : 'tail';
|
|
152
|
-
};
|
|
153
|
-
var clickItem = (item, index) => {
|
|
154
|
-
if (item === current.value || props.disabled) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (item === '...') {
|
|
158
|
-
current.value = index === 1 ? Math.max(current.value - props.maxPagerCount, 1) : Math.min(current.value + props.maxPagerCount, pageCount.value);
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
if (item === 'prev') {
|
|
162
|
-
current.value = ensureCurrentBoundary(current.value - 1);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
if (item === 'next') {
|
|
166
|
-
current.value = ensureCurrentBoundary(current.value + 1);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
if (isNumber(item)) {
|
|
170
|
-
current.value = item;
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
var showMenu = () => {
|
|
174
|
-
if (props.disabled) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
menuVisible.value = true;
|
|
178
|
-
};
|
|
179
|
-
var clickSize = option => {
|
|
180
|
-
size.value = option;
|
|
181
|
-
menuVisible.value = false;
|
|
182
|
-
var targetCurrent = ensureCurrentBoundary(current.value);
|
|
183
|
-
simpleCurrentValue.value = String(targetCurrent);
|
|
184
|
-
current.value = targetCurrent;
|
|
185
|
-
};
|
|
186
|
-
var ensureCurrentBoundary = targetCurrent => {
|
|
187
|
-
if (targetCurrent > pageCount.value) {
|
|
188
|
-
return pageCount.value;
|
|
189
|
-
}
|
|
190
|
-
if (targetCurrent < 1) {
|
|
191
|
-
return 1;
|
|
192
|
-
}
|
|
193
|
-
return targetCurrent;
|
|
194
|
-
};
|
|
195
|
-
var setPage = (type, page, event) => {
|
|
196
|
-
;
|
|
197
|
-
event.target.blur();
|
|
198
|
-
var targetCurrent = ensureCurrentBoundary(toNumber(page));
|
|
199
|
-
simpleCurrentValue.value = String(targetCurrent);
|
|
200
|
-
current.value = targetCurrent;
|
|
201
|
-
if (type === 'quick') {
|
|
202
|
-
quickJumperValue.value = '';
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
148
|
watch([() => props.current, () => props.size], _ref => {
|
|
206
149
|
var [newCurrent, newSize] = _ref;
|
|
207
150
|
current.value = toNumber(newCurrent) || 1;
|
|
@@ -266,9 +209,67 @@ var __sfc__ = defineComponent({
|
|
|
266
209
|
}, {
|
|
267
210
|
immediate: true
|
|
268
211
|
});
|
|
212
|
+
function isHideEllipsis(item, index) {
|
|
213
|
+
if (isNumber(item)) return false;
|
|
214
|
+
return index === 1 ? isHideEllipsisHead.value : isHideEllipsisTail.value;
|
|
215
|
+
}
|
|
216
|
+
function getMode(item, index) {
|
|
217
|
+
if (isNumber(item)) return 'basic';
|
|
218
|
+
return index === 1 ? 'head' : 'tail';
|
|
219
|
+
}
|
|
220
|
+
function clickItem(item, index) {
|
|
221
|
+
if (item === current.value || props.disabled) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (item === '...') {
|
|
225
|
+
current.value = index === 1 ? Math.max(current.value - props.maxPagerCount, 1) : Math.min(current.value + props.maxPagerCount, pageCount.value);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
if (item === 'prev') {
|
|
229
|
+
current.value = ensureCurrentBoundary(current.value - 1);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (item === 'next') {
|
|
233
|
+
current.value = ensureCurrentBoundary(current.value + 1);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (isNumber(item)) {
|
|
237
|
+
current.value = item;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function showMenu() {
|
|
241
|
+
if (props.disabled) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
menuVisible.value = true;
|
|
245
|
+
}
|
|
246
|
+
function clickSize(option) {
|
|
247
|
+
size.value = option;
|
|
248
|
+
menuVisible.value = false;
|
|
249
|
+
var targetCurrent = ensureCurrentBoundary(current.value);
|
|
250
|
+
simpleCurrentValue.value = String(targetCurrent);
|
|
251
|
+
current.value = targetCurrent;
|
|
252
|
+
}
|
|
253
|
+
function ensureCurrentBoundary(targetCurrent) {
|
|
254
|
+
if (targetCurrent > pageCount.value) {
|
|
255
|
+
return pageCount.value;
|
|
256
|
+
}
|
|
257
|
+
if (targetCurrent < 1) {
|
|
258
|
+
return 1;
|
|
259
|
+
}
|
|
260
|
+
return targetCurrent;
|
|
261
|
+
}
|
|
262
|
+
function setPage(type, page, event) {
|
|
263
|
+
;
|
|
264
|
+
event.target.blur();
|
|
265
|
+
var targetCurrent = ensureCurrentBoundary(toNumber(page));
|
|
266
|
+
simpleCurrentValue.value = String(targetCurrent);
|
|
267
|
+
current.value = targetCurrent;
|
|
268
|
+
if (type === 'quick') {
|
|
269
|
+
quickJumperValue.value = '';
|
|
270
|
+
}
|
|
271
|
+
}
|
|
269
272
|
return {
|
|
270
|
-
n,
|
|
271
|
-
classes,
|
|
272
273
|
pack,
|
|
273
274
|
current,
|
|
274
275
|
menuVisible,
|
|
@@ -278,6 +279,8 @@ var __sfc__ = defineComponent({
|
|
|
278
279
|
quickJumperValue,
|
|
279
280
|
simpleCurrentValue,
|
|
280
281
|
totalText,
|
|
282
|
+
n,
|
|
283
|
+
classes,
|
|
281
284
|
getMode,
|
|
282
285
|
isHideEllipsis,
|
|
283
286
|
clickItem,
|
package/es/paper/Paper.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { call, createNamespace, formatElevation } from '../utils/components.mjs'
|
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
import { toSizeUnit } from '../utils/elements.mjs';
|
|
6
6
|
var {
|
|
7
|
+
name,
|
|
7
8
|
n,
|
|
8
9
|
classes
|
|
9
10
|
} = createNamespace('paper');
|
|
@@ -25,15 +26,15 @@ function __render__(_ctx, _cache) {
|
|
|
25
26
|
}]]);
|
|
26
27
|
}
|
|
27
28
|
var __sfc__ = defineComponent({
|
|
28
|
-
name
|
|
29
|
+
name,
|
|
29
30
|
directives: {
|
|
30
31
|
Ripple
|
|
31
32
|
},
|
|
32
33
|
props,
|
|
33
34
|
setup(props) {
|
|
34
|
-
|
|
35
|
+
function handleClick(e) {
|
|
35
36
|
call(props.onClick, e);
|
|
36
|
-
}
|
|
37
|
+
}
|
|
37
38
|
return {
|
|
38
39
|
n,
|
|
39
40
|
classes,
|