vue-devui 1.0.0-alpha.4 → 1.0.0-beta.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/accordion/index.d.ts +7 -0
- package/accordion/index.es.js +237 -1
- package/accordion/index.umd.js +1 -1
- package/accordion/style.css +1 -1
- package/alert/index.d.ts +7 -0
- package/alert/index.es.js +175 -1
- package/alert/index.umd.js +1 -1
- package/alert/style.css +1 -1
- package/anchor/index.d.ts +7 -0
- package/anchor/index.es.js +263 -1
- package/anchor/index.umd.js +1 -1
- package/avatar/index.d.ts +7 -0
- package/avatar/index.es.js +301 -1
- package/avatar/index.umd.js +1 -1
- package/back-top/index.d.ts +7 -0
- package/back-top/index.es.js +128 -0
- package/back-top/index.umd.js +1 -0
- package/back-top/package.json +7 -0
- package/back-top/style.css +1 -0
- package/badge/index.d.ts +7 -0
- package/badge/index.es.js +95 -1
- package/badge/index.umd.js +1 -1
- package/breadcrumb/index.d.ts +7 -0
- package/breadcrumb/index.es.js +127 -1
- package/breadcrumb/index.umd.js +1 -1
- package/breadcrumb/style.css +1 -1
- package/button/index.d.ts +7 -0
- package/button/index.es.js +190 -1
- package/button/index.umd.js +1 -1
- package/card/index.d.ts +7 -0
- package/card/index.es.js +61 -1
- package/card/index.umd.js +1 -1
- package/carousel/index.d.ts +7 -0
- package/carousel/index.es.js +329 -1
- package/carousel/index.umd.js +1 -1
- package/cascader/index.d.ts +7 -0
- package/cascader/index.es.js +1343 -1
- package/cascader/index.umd.js +1 -1
- package/cascader/style.css +1 -1
- package/checkbox/index.d.ts +7 -0
- package/checkbox/index.es.js +377 -1
- package/checkbox/index.umd.js +1 -1
- package/comment/index.d.ts +7 -0
- package/comment/index.es.js +85 -0
- package/comment/index.umd.js +1 -0
- package/comment/package.json +7 -0
- package/comment/style.css +1 -0
- package/countdown/index.d.ts +7 -0
- package/countdown/index.es.js +176 -0
- package/countdown/index.umd.js +1 -0
- package/countdown/package.json +7 -0
- package/countdown/style.css +1 -0
- package/date-picker/index.d.ts +7 -0
- package/date-picker/index.es.js +1172 -1
- package/date-picker/index.umd.js +1 -1
- package/date-picker/style.css +1 -1
- package/dragdrop/index.d.ts +7 -0
- package/dragdrop/index.es.js +32 -0
- package/dragdrop/index.umd.js +1 -0
- package/dragdrop/package.json +7 -0
- package/drawer/index.d.ts +7 -0
- package/drawer/index.es.js +288 -0
- package/drawer/index.umd.js +1 -0
- package/drawer/package.json +7 -0
- package/drawer/style.css +1 -0
- package/dropdown/index.d.ts +7 -0
- package/dropdown/index.es.js +527 -0
- package/dropdown/index.umd.js +1 -0
- package/dropdown/package.json +7 -0
- package/dropdown/style.css +1 -0
- package/editable-select/index.d.ts +7 -0
- package/editable-select/index.es.js +5793 -1
- package/editable-select/index.umd.js +27 -1
- package/editable-select/style.css +1 -1
- package/form/index.d.ts +7 -0
- package/form/index.es.js +2244 -0
- package/form/index.umd.js +1 -0
- package/form/package.json +7 -0
- package/form/style.css +1 -0
- package/fullscreen/index.d.ts +7 -0
- package/fullscreen/index.es.js +163 -1
- package/fullscreen/index.umd.js +1 -1
- package/gantt/index.d.ts +7 -0
- package/gantt/index.es.js +535 -0
- package/gantt/index.umd.js +1 -0
- package/gantt/package.json +7 -0
- package/gantt/style.css +1 -0
- package/grid/index.d.ts +7 -0
- package/grid/index.es.js +269 -0
- package/grid/index.umd.js +1 -0
- package/grid/package.json +7 -0
- package/grid/style.css +1 -0
- package/icon/index.d.ts +7 -0
- package/icon/index.es.js +75 -1
- package/icon/index.umd.js +1 -1
- package/image-preview/index.d.ts +7 -0
- package/image-preview/index.es.js +480 -1
- package/image-preview/index.umd.js +1 -1
- package/image-preview/style.css +1 -1
- package/index.d.ts +7 -0
- package/input/index.d.ts +7 -0
- package/input/index.es.js +190 -1
- package/input/index.umd.js +1 -1
- package/input-icon/index.d.ts +7 -0
- package/input-icon/index.es.js +332 -0
- package/input-icon/index.umd.js +1 -0
- package/input-icon/package.json +7 -0
- package/input-icon/style.css +1 -0
- package/input-number/index.d.ts +7 -0
- package/input-number/index.es.js +240 -1
- package/input-number/index.umd.js +1 -1
- package/input-number/style.css +1 -1
- package/layout/index.d.ts +7 -0
- package/layout/index.es.js +100 -0
- package/layout/index.umd.js +1 -0
- package/layout/package.json +7 -0
- package/layout/style.css +1 -0
- package/loading/index.d.ts +7 -0
- package/loading/index.es.js +256 -1
- package/loading/index.umd.js +1 -1
- package/modal/index.d.ts +7 -0
- package/modal/index.es.js +1027 -1
- package/modal/index.umd.js +1 -1
- package/modal/style.css +1 -1
- package/nav-sprite/index.d.ts +7 -0
- package/nav-sprite/index.es.js +742 -0
- package/nav-sprite/index.umd.js +1 -0
- package/nav-sprite/package.json +7 -0
- package/nuxt/components/Accordion.js +3 -0
- package/nuxt/components/Alert.js +3 -0
- package/nuxt/components/Anchor.js +3 -0
- package/nuxt/components/Aside.js +3 -0
- package/nuxt/components/Avatar.js +3 -0
- package/nuxt/components/BackTop.js +3 -0
- package/nuxt/components/Badge.js +3 -0
- package/nuxt/components/Breadcrumb.js +3 -0
- package/nuxt/components/Button.js +3 -0
- package/nuxt/components/Card.js +3 -0
- package/nuxt/components/Carousel.js +3 -0
- package/nuxt/components/Cascader.js +3 -0
- package/nuxt/components/Checkbox.js +3 -0
- package/nuxt/components/Col.js +3 -0
- package/nuxt/components/Column.js +3 -0
- package/nuxt/components/Comment.js +3 -0
- package/nuxt/components/Content.js +3 -0
- package/nuxt/components/Countdown.js +3 -0
- package/nuxt/components/DatePicker.js +3 -0
- package/nuxt/components/Drawer.js +3 -0
- package/nuxt/components/Dropdown.js +3 -0
- package/nuxt/components/EditableSelect.js +3 -0
- package/nuxt/components/FixedOverlay.js +3 -0
- package/nuxt/components/FlexibleOverlay.js +3 -0
- package/nuxt/components/Footer.js +3 -0
- package/nuxt/components/Form.js +3 -0
- package/nuxt/components/FormControl.js +3 -0
- package/nuxt/components/FormItem.js +3 -0
- package/nuxt/components/FormLabel.js +3 -0
- package/nuxt/components/FormOperation.js +3 -0
- package/nuxt/components/Fullscreen.js +3 -0
- package/nuxt/components/Gantt.js +3 -0
- package/nuxt/components/Header.js +3 -0
- package/nuxt/components/Icon.js +2 -0
- package/nuxt/components/ImagePreviewService.js +3 -0
- package/nuxt/components/Input.js +3 -0
- package/nuxt/components/InputIcon.js +3 -0
- package/nuxt/components/InputNumber.js +3 -0
- package/nuxt/components/Layout.js +3 -0
- package/nuxt/components/Loading.js +3 -0
- package/nuxt/components/LoadingService.js +3 -0
- package/nuxt/components/Modal.js +3 -0
- package/nuxt/components/MultiUpload.js +3 -0
- package/nuxt/components/NavSprite.js +2 -0
- package/nuxt/components/Pagination.js +3 -0
- package/nuxt/components/Panel.js +3 -0
- package/nuxt/components/Popover.js +3 -0
- package/nuxt/components/Progress.js +3 -0
- package/nuxt/components/QuadrantDiagram.js +3 -0
- package/nuxt/components/Radio.js +3 -0
- package/nuxt/components/RadioGroup.js +3 -0
- package/nuxt/components/Rate.js +3 -0
- package/nuxt/components/ReadTip.js +3 -0
- package/nuxt/components/Result.js +3 -0
- package/nuxt/components/Row.js +3 -0
- package/nuxt/components/Search.js +3 -0
- package/nuxt/components/Select.js +3 -0
- package/nuxt/components/Skeleton.js +3 -0
- package/nuxt/components/SkeletonItem.js +3 -0
- package/nuxt/components/Slider.js +3 -0
- package/nuxt/components/Splitter.js +3 -0
- package/nuxt/components/Statistic.js +3 -0
- package/nuxt/components/Status.js +3 -0
- package/nuxt/components/StepsGuide.js +3 -0
- package/nuxt/components/StickSlider.js +3 -0
- package/nuxt/components/Sticky.js +2 -0
- package/nuxt/components/Switch.js +3 -0
- package/nuxt/components/Table.js +3 -0
- package/nuxt/components/Tabs.js +3 -0
- package/nuxt/components/Tag.js +3 -0
- package/nuxt/components/TagInput.js +3 -0
- package/nuxt/components/Textarea.js +3 -0
- package/nuxt/components/TimeAxis.js +3 -0
- package/nuxt/components/TimeAxisItem.js +3 -0
- package/nuxt/components/TimePicker.js +3 -0
- package/nuxt/components/Toast.js +3 -0
- package/nuxt/components/ToastService.js +3 -0
- package/nuxt/components/Tooltip.js +3 -0
- package/nuxt/components/Transfer.js +3 -0
- package/nuxt/components/Tree.js +3 -0
- package/nuxt/components/TreeSelect.js +3 -0
- package/nuxt/components/Upload.js +3 -0
- package/nuxt/components/buttonProps.js +3 -0
- package/nuxt/index.js +13 -0
- package/overlay/index.d.ts +7 -0
- package/overlay/index.es.js +368 -1
- package/overlay/index.umd.js +1 -1
- package/overlay/style.css +1 -1
- package/package.json +8 -33
- package/pagination/index.d.ts +7 -0
- package/pagination/index.es.js +642 -1
- package/pagination/index.umd.js +1 -1
- package/panel/index.d.ts +7 -0
- package/panel/index.es.js +205 -1
- package/panel/index.umd.js +1 -1
- package/panel/style.css +1 -1
- package/popover/index.d.ts +7 -0
- package/popover/index.es.js +236 -1
- package/popover/index.umd.js +1 -1
- package/popover/style.css +1 -1
- package/progress/index.d.ts +7 -0
- package/progress/index.es.js +153 -1
- package/progress/index.umd.js +3 -1
- package/quadrant-diagram/index.d.ts +7 -0
- package/quadrant-diagram/index.es.js +489 -1
- package/quadrant-diagram/index.umd.js +1 -1
- package/radio/index.d.ts +7 -0
- package/radio/index.es.js +225 -1
- package/radio/index.umd.js +1 -1
- package/rate/index.d.ts +7 -0
- package/rate/index.es.js +220 -1
- package/rate/index.umd.js +1 -1
- package/read-tip/index.d.ts +7 -0
- package/read-tip/index.es.js +258 -0
- package/read-tip/index.umd.js +1 -0
- package/read-tip/package.json +7 -0
- package/read-tip/style.css +1 -0
- package/result/index.d.ts +7 -0
- package/result/index.es.js +119 -0
- package/result/index.umd.js +1 -0
- package/result/package.json +7 -0
- package/result/style.css +1 -0
- package/ripple/index.d.ts +7 -0
- package/ripple/index.es.js +181 -1
- package/ripple/index.umd.js +1 -1
- package/search/index.d.ts +7 -0
- package/search/index.es.js +543 -1
- package/search/index.umd.js +1 -1
- package/select/index.d.ts +7 -0
- package/select/index.es.js +706 -1
- package/select/index.umd.js +1 -1
- package/skeleton/index.d.ts +7 -0
- package/skeleton/index.es.js +297 -1
- package/skeleton/index.umd.js +1 -1
- package/skeleton/style.css +1 -1
- package/slider/index.d.ts +7 -0
- package/slider/index.es.js +199 -1
- package/slider/index.umd.js +1 -1
- package/slider/style.css +1 -1
- package/splitter/index.d.ts +7 -0
- package/splitter/index.es.js +636 -1
- package/splitter/index.umd.js +1 -1
- package/statistic/index.d.ts +7 -0
- package/statistic/index.es.js +280 -0
- package/statistic/index.umd.js +1 -0
- package/statistic/package.json +7 -0
- package/statistic/style.css +1 -0
- package/status/index.d.ts +7 -0
- package/status/index.es.js +42 -1
- package/status/index.umd.js +1 -1
- package/steps-guide/index.d.ts +7 -0
- package/steps-guide/index.es.js +239 -1
- package/steps-guide/index.umd.js +1 -1
- package/steps-guide/style.css +1 -1
- package/sticky/index.d.ts +7 -0
- package/sticky/index.es.js +197 -1
- package/sticky/index.umd.js +1 -1
- package/style.css +1 -1
- package/switch/index.d.ts +7 -0
- package/switch/index.es.js +100 -1
- package/switch/index.umd.js +1 -1
- package/switch/style.css +1 -1
- package/table/index.d.ts +7 -0
- package/table/index.es.js +1626 -1
- package/table/index.umd.js +1 -1
- package/table/style.css +1 -1
- package/tabs/index.d.ts +7 -0
- package/tabs/index.es.js +195 -1
- package/tabs/index.umd.js +1 -1
- package/tabs/style.css +1 -1
- package/tag/index.d.ts +7 -0
- package/tag/index.es.js +131 -0
- package/tag/index.umd.js +1 -0
- package/tag/package.json +7 -0
- package/tag/style.css +1 -0
- package/tag-input/index.d.ts +7 -0
- package/tag-input/index.es.js +329 -1
- package/tag-input/index.umd.js +1 -1
- package/textarea/index.d.ts +7 -0
- package/textarea/index.es.js +132 -0
- package/textarea/index.umd.js +1 -0
- package/textarea/package.json +7 -0
- package/textarea/style.css +1 -0
- package/time-axis/index.d.ts +7 -0
- package/time-axis/index.es.js +299 -0
- package/time-axis/index.umd.js +1 -0
- package/time-axis/package.json +7 -0
- package/time-axis/style.css +1 -0
- package/time-picker/index.d.ts +7 -0
- package/time-picker/index.es.js +1053 -1
- package/time-picker/index.umd.js +1 -1
- package/time-picker/style.css +1 -1
- package/toast/index.d.ts +7 -0
- package/toast/index.es.js +2060 -1
- package/toast/index.umd.js +1 -1
- package/toast/style.css +1 -1
- package/tooltip/index.d.ts +7 -0
- package/tooltip/index.es.js +171 -1
- package/tooltip/index.umd.js +1 -1
- package/transfer/index.d.ts +7 -0
- package/transfer/index.es.js +1725 -1
- package/transfer/index.umd.js +1 -1
- package/transfer/style.css +1 -1
- package/tree/index.d.ts +7 -0
- package/tree/index.es.js +907 -1
- package/tree/index.umd.js +1 -1
- package/tree/style.css +1 -1
- package/tree-select/index.d.ts +7 -0
- package/tree-select/index.es.js +528 -0
- package/tree-select/index.umd.js +1 -0
- package/tree-select/package.json +7 -0
- package/tree-select/style.css +1 -0
- package/upload/index.d.ts +7 -0
- package/upload/index.es.js +3179 -1
- package/upload/index.umd.js +1 -1
- package/upload/style.css +1 -1
- package/vue-devui.es.js +27755 -1
- package/vue-devui.umd.js +29 -1
package/pagination/index.es.js
CHANGED
|
@@ -1 +1,642 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent, ref, onMounted, onUnmounted, withDirectives, createVNode, createTextVNode, resolveDirective, toRefs, watch, resolveComponent, computed, Fragment, mergeProps, nextTick } from "vue";
|
|
2
|
+
const componentProps = {
|
|
3
|
+
pageSize: {
|
|
4
|
+
type: Number,
|
|
5
|
+
default: 10
|
|
6
|
+
},
|
|
7
|
+
total: {
|
|
8
|
+
type: Number,
|
|
9
|
+
default: 0
|
|
10
|
+
},
|
|
11
|
+
pageSizeOptions: {
|
|
12
|
+
type: Array,
|
|
13
|
+
default: () => [5, 10, 20, 50]
|
|
14
|
+
},
|
|
15
|
+
pageSizeDirection: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => ["centerDown", "centerUp"]
|
|
18
|
+
},
|
|
19
|
+
pageIndex: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 1
|
|
22
|
+
},
|
|
23
|
+
maxItems: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 10
|
|
26
|
+
},
|
|
27
|
+
preLink: {
|
|
28
|
+
type: String,
|
|
29
|
+
default: "<"
|
|
30
|
+
},
|
|
31
|
+
nextLink: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: ">"
|
|
34
|
+
},
|
|
35
|
+
size: {
|
|
36
|
+
type: String,
|
|
37
|
+
default: ""
|
|
38
|
+
},
|
|
39
|
+
canJumpPage: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: false
|
|
42
|
+
},
|
|
43
|
+
canChangePageSize: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
canViewTotal: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
totalItemText: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: "\u6240\u6709\u6761\u76EE"
|
|
54
|
+
},
|
|
55
|
+
goToText: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "\u8DF3\u81F3"
|
|
58
|
+
},
|
|
59
|
+
showJumpButton: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
showTruePageIndex: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
lite: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
showPageSelector: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
default: true
|
|
74
|
+
},
|
|
75
|
+
haveConfigMenu: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false
|
|
78
|
+
},
|
|
79
|
+
autoFixPageIndex: {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
default: true
|
|
82
|
+
},
|
|
83
|
+
autoHide: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false
|
|
86
|
+
},
|
|
87
|
+
"onUpdate:pageIndex": {
|
|
88
|
+
type: Function
|
|
89
|
+
},
|
|
90
|
+
"onUpdate:pageSize": {
|
|
91
|
+
type: Function
|
|
92
|
+
},
|
|
93
|
+
"onPageIndexChange": {
|
|
94
|
+
type: Function
|
|
95
|
+
},
|
|
96
|
+
"onPageSizeChange": {
|
|
97
|
+
type: Function
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const handlePages = (cursor, maxItems, totalPages) => {
|
|
101
|
+
const currentPage = cursor;
|
|
102
|
+
const maxPages = maxItems;
|
|
103
|
+
if (maxPages >= totalPages) {
|
|
104
|
+
return [2, totalPages];
|
|
105
|
+
}
|
|
106
|
+
const midPages = maxPages - 2;
|
|
107
|
+
let midStart = currentPage - (midPages >> 1);
|
|
108
|
+
let midEnd = currentPage + (midPages - 1 >> 1);
|
|
109
|
+
if (midStart < 2) {
|
|
110
|
+
midStart = 2;
|
|
111
|
+
midEnd = maxPages - 2;
|
|
112
|
+
}
|
|
113
|
+
if (midEnd > totalPages) {
|
|
114
|
+
midStart = totalPages - maxPages + 3;
|
|
115
|
+
midEnd = totalPages;
|
|
116
|
+
}
|
|
117
|
+
return [midStart, midEnd];
|
|
118
|
+
};
|
|
119
|
+
function liteSelectOptions(total) {
|
|
120
|
+
return new Array(total || 1).fill(0).map((v, index2) => {
|
|
121
|
+
return {
|
|
122
|
+
name: `${index2 + 1}/${total}`,
|
|
123
|
+
value: index2 + 1
|
|
124
|
+
};
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function on(element, eventName, handler) {
|
|
128
|
+
if (document.addEventListener) {
|
|
129
|
+
if (element && eventName && handler) {
|
|
130
|
+
element.addEventListener(eventName, handler, false);
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
if (element && eventName && handler) {
|
|
134
|
+
element.attachEvent("on" + eventName, handler);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function off(element, eventName, handler) {
|
|
139
|
+
if (document.removeEventListener) {
|
|
140
|
+
if (element && eventName && handler) {
|
|
141
|
+
element.removeEventListener(eventName, handler, false);
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
if (element && eventName && handler) {
|
|
145
|
+
element.detachEvent("on" + eventName, handler);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const inBrowser = typeof window !== "undefined";
|
|
150
|
+
const ctx = Symbol("@@clickoutside");
|
|
151
|
+
const nodeList = new Map();
|
|
152
|
+
let startClick;
|
|
153
|
+
let nid = 0;
|
|
154
|
+
let isFirst = true;
|
|
155
|
+
function createDocumentHandler(el, binding, vnode) {
|
|
156
|
+
if (inBrowser && isFirst) {
|
|
157
|
+
isFirst = false;
|
|
158
|
+
on(document, "mousedown", (e) => {
|
|
159
|
+
startClick = e;
|
|
160
|
+
});
|
|
161
|
+
on(document, "mouseup", (e) => {
|
|
162
|
+
for (const [id, node] of nodeList) {
|
|
163
|
+
node[ctx].documentHandler(e, startClick);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return function(mouseup, mousedown) {
|
|
168
|
+
if (!vnode || !binding.instance || !mouseup.target || !mousedown.target || el.contains(mouseup.target) || el.contains(mousedown.target) || el === mouseup.target) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
el[ctx].bindingFn && el[ctx].bindingFn();
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
const clickoutsideDirective = {
|
|
175
|
+
beforeMount: function(el, binding, vnode) {
|
|
176
|
+
nid++;
|
|
177
|
+
nodeList.set(nid, el);
|
|
178
|
+
el[ctx] = {
|
|
179
|
+
nid,
|
|
180
|
+
documentHandler: createDocumentHandler(el, binding, vnode),
|
|
181
|
+
bindingFn: binding.value
|
|
182
|
+
};
|
|
183
|
+
},
|
|
184
|
+
updated: function(el, binding, vnode) {
|
|
185
|
+
el[ctx].documentHandler = createDocumentHandler(el, binding, vnode);
|
|
186
|
+
el[ctx].bindingFn = binding.value;
|
|
187
|
+
},
|
|
188
|
+
unmounted: function(el) {
|
|
189
|
+
nodeList.delete(el[ctx].nid);
|
|
190
|
+
delete el[ctx];
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
var ConfigMenu = defineComponent({
|
|
194
|
+
directives: {
|
|
195
|
+
clickoutside: clickoutsideDirective
|
|
196
|
+
},
|
|
197
|
+
props: {
|
|
198
|
+
currentPageSize: Number,
|
|
199
|
+
pageSizeChange: Function,
|
|
200
|
+
pageSizeOptions: Array
|
|
201
|
+
},
|
|
202
|
+
setup() {
|
|
203
|
+
const paginationConfig = ref(null);
|
|
204
|
+
const isShowConfig = ref(false);
|
|
205
|
+
onMounted(() => {
|
|
206
|
+
on(paginationConfig.value, "click", closeConfigMenu);
|
|
207
|
+
});
|
|
208
|
+
onUnmounted(() => {
|
|
209
|
+
off(paginationConfig.value, "click", closeConfigMenu);
|
|
210
|
+
});
|
|
211
|
+
const closeConfigMenu = (e) => {
|
|
212
|
+
isShowConfig.value = isShowConfig.value ? false : !!e;
|
|
213
|
+
};
|
|
214
|
+
return {
|
|
215
|
+
paginationConfig,
|
|
216
|
+
isShowConfig,
|
|
217
|
+
closeConfigMenu
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
render() {
|
|
221
|
+
var _a;
|
|
222
|
+
const {
|
|
223
|
+
closeConfigMenu,
|
|
224
|
+
currentPageSize,
|
|
225
|
+
pageSizeChange,
|
|
226
|
+
pageSizeOptions,
|
|
227
|
+
isShowConfig,
|
|
228
|
+
$slots
|
|
229
|
+
} = this;
|
|
230
|
+
return withDirectives(createVNode("div", {
|
|
231
|
+
"class": "devui-pagination-config",
|
|
232
|
+
"ref": "paginationConfig"
|
|
233
|
+
}, [createVNode("div", {
|
|
234
|
+
"class": "devui-setup-icon"
|
|
235
|
+
}, [createVNode("i", {
|
|
236
|
+
"class": "icon-setting",
|
|
237
|
+
"style": "font-weight: bold;"
|
|
238
|
+
}, null)]), isShowConfig && createVNode("div", {
|
|
239
|
+
"class": "devui-config-container"
|
|
240
|
+
}, [(_a = $slots.default) == null ? void 0 : _a.call($slots), createVNode("div", {
|
|
241
|
+
"class": "pagination-config-item"
|
|
242
|
+
}, [createVNode("div", {
|
|
243
|
+
"class": "config-item-title"
|
|
244
|
+
}, [createTextVNode("\u6BCF\u9875\u6761\u6570")]), createVNode("div", {
|
|
245
|
+
"class": "devui-page-number"
|
|
246
|
+
}, [pageSizeOptions.map((v) => {
|
|
247
|
+
return createVNode("div", {
|
|
248
|
+
"class": {
|
|
249
|
+
choosed: v === currentPageSize
|
|
250
|
+
},
|
|
251
|
+
"key": v,
|
|
252
|
+
"onClick": pageSizeChange.bind(null, {
|
|
253
|
+
value: v
|
|
254
|
+
})
|
|
255
|
+
}, [v]);
|
|
256
|
+
})])])])]), [[resolveDirective("clickoutside"), closeConfigMenu]]);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
const jumpPageProps = {
|
|
260
|
+
goToText: String,
|
|
261
|
+
size: {
|
|
262
|
+
type: String,
|
|
263
|
+
default: ""
|
|
264
|
+
},
|
|
265
|
+
pageIndex: Number,
|
|
266
|
+
showJumpButton: Boolean,
|
|
267
|
+
totalPages: Number,
|
|
268
|
+
cursor: Number,
|
|
269
|
+
onChangeCursorEmit: Function
|
|
270
|
+
};
|
|
271
|
+
var JumpPage = defineComponent({
|
|
272
|
+
props: jumpPageProps,
|
|
273
|
+
emits: ["changeCursorEmit"],
|
|
274
|
+
setup(props, {
|
|
275
|
+
emit
|
|
276
|
+
}) {
|
|
277
|
+
const {
|
|
278
|
+
pageIndex,
|
|
279
|
+
totalPages,
|
|
280
|
+
cursor
|
|
281
|
+
} = toRefs(props);
|
|
282
|
+
const inputNum = ref(pageIndex.value);
|
|
283
|
+
watch(() => pageIndex.value, (val) => {
|
|
284
|
+
inputNum.value = val;
|
|
285
|
+
});
|
|
286
|
+
let curPage = pageIndex.value;
|
|
287
|
+
const jumpPageChange = (currentPage) => {
|
|
288
|
+
curPage = +currentPage;
|
|
289
|
+
inputNum.value = currentPage;
|
|
290
|
+
if (isNaN(currentPage)) {
|
|
291
|
+
setTimeout(() => {
|
|
292
|
+
inputNum.value = pageIndex.value;
|
|
293
|
+
}, 300);
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
const jump = (e) => {
|
|
297
|
+
if (curPage > totalPages.value) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if ((e === "btn" || e.key === "Enter") && cursor.value !== curPage) {
|
|
301
|
+
emit("changeCursorEmit", curPage);
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
return {
|
|
305
|
+
inputNum,
|
|
306
|
+
jumpPageChange,
|
|
307
|
+
jump
|
|
308
|
+
};
|
|
309
|
+
},
|
|
310
|
+
render() {
|
|
311
|
+
const {
|
|
312
|
+
goToText,
|
|
313
|
+
size,
|
|
314
|
+
inputNum,
|
|
315
|
+
jumpPageChange,
|
|
316
|
+
jump,
|
|
317
|
+
showJumpButton
|
|
318
|
+
} = this;
|
|
319
|
+
return createVNode("div", {
|
|
320
|
+
"class": "devui-jump-container"
|
|
321
|
+
}, [
|
|
322
|
+
goToText,
|
|
323
|
+
createVNode(resolveComponent("d-input"), {
|
|
324
|
+
"class": ["devui-pagination-input", size ? "devui-pagination-input-" + size : ""],
|
|
325
|
+
"size": size,
|
|
326
|
+
"modelValue": String(inputNum),
|
|
327
|
+
"onUpdate:modelValue": jumpPageChange,
|
|
328
|
+
"onKeydown": jump
|
|
329
|
+
}, null),
|
|
330
|
+
goToText === "\u8DF3\u81F3" && "\u9875",
|
|
331
|
+
showJumpButton && createVNode("div", {
|
|
332
|
+
"class": ["devui-jump-button", size ? "devui-jump-size-" + size : "devui-jump-size-default"],
|
|
333
|
+
"onClick": jump.bind(null, "btn"),
|
|
334
|
+
"title": goToText
|
|
335
|
+
}, [createVNode("div", {
|
|
336
|
+
"class": "devui-pagination-go"
|
|
337
|
+
}, null)])
|
|
338
|
+
]);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
const pageNumBtnProps = {
|
|
342
|
+
size: {
|
|
343
|
+
type: String,
|
|
344
|
+
default: ""
|
|
345
|
+
},
|
|
346
|
+
preLink: String,
|
|
347
|
+
nextLink: String,
|
|
348
|
+
lite: Boolean,
|
|
349
|
+
cursor: Number,
|
|
350
|
+
maxItems: Number,
|
|
351
|
+
totalPages: Number,
|
|
352
|
+
onChangeCursorEmit: Function,
|
|
353
|
+
showTruePageIndex: Boolean
|
|
354
|
+
};
|
|
355
|
+
var PageNumBtn = defineComponent({
|
|
356
|
+
props: pageNumBtnProps,
|
|
357
|
+
emits: ["changeCursorEmit"],
|
|
358
|
+
setup(props, {
|
|
359
|
+
emit
|
|
360
|
+
}) {
|
|
361
|
+
const showPageNum = computed(() => handlePages(props.cursor, props.maxItems, props.totalPages));
|
|
362
|
+
const changeCursor = (pageSize) => {
|
|
363
|
+
if (isNaN(pageSize))
|
|
364
|
+
return;
|
|
365
|
+
const page = pageSize < 1 ? 1 : pageSize > props.totalPages ? props.totalPages : pageSize | 0;
|
|
366
|
+
emit("changeCursorEmit", page);
|
|
367
|
+
};
|
|
368
|
+
const prevChange = (page) => {
|
|
369
|
+
if (props.cursor > 1) {
|
|
370
|
+
const toPage = page === -1 ? props.cursor - 1 : page;
|
|
371
|
+
emit("changeCursorEmit", toPage);
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
const nextChange = (page) => {
|
|
375
|
+
if (props.cursor < props.totalPages) {
|
|
376
|
+
const toPage = page === -1 ? props.cursor + 1 : page;
|
|
377
|
+
emit("changeCursorEmit", toPage);
|
|
378
|
+
}
|
|
379
|
+
};
|
|
380
|
+
return {
|
|
381
|
+
showPageNum,
|
|
382
|
+
changeCursor,
|
|
383
|
+
prevChange,
|
|
384
|
+
nextChange
|
|
385
|
+
};
|
|
386
|
+
},
|
|
387
|
+
render() {
|
|
388
|
+
const {
|
|
389
|
+
size,
|
|
390
|
+
preLink,
|
|
391
|
+
nextLink,
|
|
392
|
+
lite,
|
|
393
|
+
changeCursor,
|
|
394
|
+
cursor,
|
|
395
|
+
showPageNum,
|
|
396
|
+
prevChange,
|
|
397
|
+
totalPages,
|
|
398
|
+
nextChange,
|
|
399
|
+
showTruePageIndex
|
|
400
|
+
} = this;
|
|
401
|
+
return createVNode("ul", {
|
|
402
|
+
"class": ["devui-pagination-list", size ? "devui-pagination-" + size : ""]
|
|
403
|
+
}, [createVNode("li", {
|
|
404
|
+
"onClick": prevChange.bind(null, -1),
|
|
405
|
+
"class": {
|
|
406
|
+
"devui-pagination-item": true,
|
|
407
|
+
disabled: cursor <= 1
|
|
408
|
+
}
|
|
409
|
+
}, [createVNode("a", {
|
|
410
|
+
"innerHTML": preLink,
|
|
411
|
+
"class": "devui-pagination-link"
|
|
412
|
+
}, null)]), !lite && createVNode(Fragment, null, [
|
|
413
|
+
createVNode("li", {
|
|
414
|
+
"onClick": changeCursor.bind(null, 1),
|
|
415
|
+
"class": {
|
|
416
|
+
"devui-pagination-item": true,
|
|
417
|
+
active: cursor === 1
|
|
418
|
+
}
|
|
419
|
+
}, [createVNode("a", {
|
|
420
|
+
"class": "devui-pagination-link"
|
|
421
|
+
}, [createTextVNode("1")])]),
|
|
422
|
+
showPageNum[0] > 2 && createVNode("li", {
|
|
423
|
+
"onClick": prevChange.bind(null, showPageNum[0] - 1),
|
|
424
|
+
"class": "devui-pagination-item"
|
|
425
|
+
}, [createVNode("a", {
|
|
426
|
+
"class": "devui-pagination-link"
|
|
427
|
+
}, [createTextVNode("...")])]),
|
|
428
|
+
(() => {
|
|
429
|
+
const list = [];
|
|
430
|
+
for (let i = showPageNum[0]; i <= showPageNum[1]; i++) {
|
|
431
|
+
list.push(createVNode("li", {
|
|
432
|
+
"onClick": changeCursor.bind(null, i),
|
|
433
|
+
"key": i,
|
|
434
|
+
"class": {
|
|
435
|
+
"devui-pagination-item": true,
|
|
436
|
+
active: cursor === i
|
|
437
|
+
}
|
|
438
|
+
}, [createVNode("a", {
|
|
439
|
+
"class": "devui-pagination-link"
|
|
440
|
+
}, [i])]));
|
|
441
|
+
}
|
|
442
|
+
return list;
|
|
443
|
+
})(),
|
|
444
|
+
showPageNum[1] < totalPages - 1 && createVNode("li", {
|
|
445
|
+
"onClick": nextChange.bind(null, showPageNum[1] + 1),
|
|
446
|
+
"class": "devui-pagination-item"
|
|
447
|
+
}, [createVNode("a", {
|
|
448
|
+
"class": "devui-pagination-link"
|
|
449
|
+
}, [createTextVNode("...")])]),
|
|
450
|
+
showPageNum[1] < totalPages && createVNode("li", {
|
|
451
|
+
"onClick": changeCursor.bind(null, totalPages),
|
|
452
|
+
"class": {
|
|
453
|
+
"devui-pagination-item": true,
|
|
454
|
+
active: cursor === totalPages
|
|
455
|
+
}
|
|
456
|
+
}, [createVNode("a", {
|
|
457
|
+
"class": "devui-pagination-link"
|
|
458
|
+
}, [totalPages])]),
|
|
459
|
+
showTruePageIndex && cursor > totalPages && totalPages > 0 && createVNode(Fragment, null, [cursor > totalPages + 1 && createVNode("li", {
|
|
460
|
+
"class": "devui-pagination-item disabled"
|
|
461
|
+
}, [createVNode("a", {
|
|
462
|
+
"class": "devui-pagination-link"
|
|
463
|
+
}, [createTextVNode("...")])]), createVNode("li", {
|
|
464
|
+
"class": "devui-pagination-item disabled active"
|
|
465
|
+
}, [createVNode("a", {
|
|
466
|
+
"class": "devui-pagination-link"
|
|
467
|
+
}, [cursor])])])
|
|
468
|
+
]), createVNode("li", {
|
|
469
|
+
"onClick": nextChange.bind(null, -1),
|
|
470
|
+
"class": {
|
|
471
|
+
"devui-pagination-item": true,
|
|
472
|
+
disabled: cursor >= totalPages
|
|
473
|
+
}
|
|
474
|
+
}, [createVNode("a", {
|
|
475
|
+
"innerHTML": nextLink,
|
|
476
|
+
"class": "devui-pagination-link"
|
|
477
|
+
}, null)])]);
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
var pagination = "";
|
|
481
|
+
var Pagination = defineComponent({
|
|
482
|
+
name: "DPagination",
|
|
483
|
+
components: {
|
|
484
|
+
ConfigMenu,
|
|
485
|
+
JumpPage,
|
|
486
|
+
PageNumBtn
|
|
487
|
+
},
|
|
488
|
+
props: componentProps,
|
|
489
|
+
emits: ["pageIndexChange", "pageSizeChange", "update:pageSize", "update:pageIndex"],
|
|
490
|
+
setup(props, {
|
|
491
|
+
emit
|
|
492
|
+
}) {
|
|
493
|
+
const litePageOptions = computed(() => liteSelectOptions(totalPages.value));
|
|
494
|
+
const cursor = computed({
|
|
495
|
+
get() {
|
|
496
|
+
if (!props.showTruePageIndex && props.pageIndex > totalPages.value) {
|
|
497
|
+
emit("update:pageIndex", totalPages.value || 1);
|
|
498
|
+
return totalPages.value || 1;
|
|
499
|
+
}
|
|
500
|
+
return props.pageIndex || 1;
|
|
501
|
+
},
|
|
502
|
+
set(val) {
|
|
503
|
+
emit("update:pageIndex", val);
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
const currentPageSize = computed({
|
|
507
|
+
get() {
|
|
508
|
+
return props.pageSize;
|
|
509
|
+
},
|
|
510
|
+
set(val) {
|
|
511
|
+
emit("update:pageSize", val);
|
|
512
|
+
}
|
|
513
|
+
});
|
|
514
|
+
const totalPages = computed(() => Math.ceil(props.total / props.pageSize));
|
|
515
|
+
const changeCursorEmit = (val) => {
|
|
516
|
+
cursor.value = val;
|
|
517
|
+
emit("pageIndexChange", val);
|
|
518
|
+
};
|
|
519
|
+
const pageSizeChange = (val) => {
|
|
520
|
+
currentPageSize.value = val.value;
|
|
521
|
+
if (props.autoFixPageIndex) {
|
|
522
|
+
nextTick(() => {
|
|
523
|
+
if (cursor.value > totalPages.value) {
|
|
524
|
+
changeCursorEmit(totalPages.value);
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
emit("pageSizeChange", val.value);
|
|
529
|
+
};
|
|
530
|
+
const litePageIndexChange = (page) => {
|
|
531
|
+
changeCursorEmit(page.value);
|
|
532
|
+
};
|
|
533
|
+
return {
|
|
534
|
+
cursor,
|
|
535
|
+
totalPages,
|
|
536
|
+
changeCursorEmit,
|
|
537
|
+
currentPageSize,
|
|
538
|
+
pageSizeChange,
|
|
539
|
+
litePageOptions,
|
|
540
|
+
litePageIndexChange
|
|
541
|
+
};
|
|
542
|
+
},
|
|
543
|
+
render() {
|
|
544
|
+
const {
|
|
545
|
+
total,
|
|
546
|
+
pageIndex,
|
|
547
|
+
pageSizeOptions,
|
|
548
|
+
pageSizeDirection,
|
|
549
|
+
preLink,
|
|
550
|
+
nextLink,
|
|
551
|
+
size,
|
|
552
|
+
canJumpPage,
|
|
553
|
+
canChangePageSize,
|
|
554
|
+
canViewTotal,
|
|
555
|
+
totalItemText,
|
|
556
|
+
goToText,
|
|
557
|
+
maxItems,
|
|
558
|
+
showJumpButton,
|
|
559
|
+
showTruePageIndex,
|
|
560
|
+
lite,
|
|
561
|
+
showPageSelector,
|
|
562
|
+
haveConfigMenu,
|
|
563
|
+
autoHide,
|
|
564
|
+
$slots,
|
|
565
|
+
cursor,
|
|
566
|
+
totalPages,
|
|
567
|
+
currentPageSize,
|
|
568
|
+
pageSizeChange,
|
|
569
|
+
changeCursorEmit,
|
|
570
|
+
litePageOptions,
|
|
571
|
+
litePageIndexChange
|
|
572
|
+
} = this;
|
|
573
|
+
return autoHide && Math.min(...pageSizeOptions) > total ? null : createVNode("div", {
|
|
574
|
+
"class": "devui-pagination"
|
|
575
|
+
}, [
|
|
576
|
+
canChangePageSize && !lite && createVNode("div", {
|
|
577
|
+
"class": ["devui-page-size", size ? "devui-page-size-" + size : ""]
|
|
578
|
+
}, [createVNode(resolveComponent("d-select"), {
|
|
579
|
+
"options": pageSizeOptions,
|
|
580
|
+
"modelValue": currentPageSize,
|
|
581
|
+
"onValueChange": pageSizeChange,
|
|
582
|
+
"pageSizeDirection": pageSizeDirection
|
|
583
|
+
}, null)]),
|
|
584
|
+
(!lite || lite && showPageSelector) && canViewTotal && createVNode("div", {
|
|
585
|
+
"class": "devui-total-size"
|
|
586
|
+
}, [totalItemText, createTextVNode(": "), total]),
|
|
587
|
+
lite && showPageSelector && createVNode("div", {
|
|
588
|
+
"class": "devui-page-size"
|
|
589
|
+
}, [createVNode(resolveComponent("d-select"), {
|
|
590
|
+
"options": litePageOptions,
|
|
591
|
+
"disabled": total === 0,
|
|
592
|
+
"modelValue": cursor,
|
|
593
|
+
"onValueChange": litePageIndexChange,
|
|
594
|
+
"pageSizeDirection": pageSizeDirection
|
|
595
|
+
}, null)]),
|
|
596
|
+
createVNode(resolveComponent("page-num-btn"), mergeProps({
|
|
597
|
+
cursor,
|
|
598
|
+
totalPages,
|
|
599
|
+
size,
|
|
600
|
+
lite,
|
|
601
|
+
maxItems,
|
|
602
|
+
preLink,
|
|
603
|
+
nextLink,
|
|
604
|
+
showTruePageIndex
|
|
605
|
+
}, {
|
|
606
|
+
"onChangeCursorEmit": changeCursorEmit
|
|
607
|
+
}), null),
|
|
608
|
+
canJumpPage && !lite && createVNode(resolveComponent("jump-page"), mergeProps({
|
|
609
|
+
goToText,
|
|
610
|
+
size,
|
|
611
|
+
pageIndex,
|
|
612
|
+
totalPages,
|
|
613
|
+
cursor,
|
|
614
|
+
showJumpButton
|
|
615
|
+
}, {
|
|
616
|
+
"onChangeCursorEmit": changeCursorEmit
|
|
617
|
+
}), null),
|
|
618
|
+
lite && haveConfigMenu && createVNode(resolveComponent("config-menu"), {
|
|
619
|
+
currentPageSize,
|
|
620
|
+
pageSizeChange,
|
|
621
|
+
pageSizeOptions
|
|
622
|
+
}, {
|
|
623
|
+
default: () => {
|
|
624
|
+
var _a;
|
|
625
|
+
return [(_a = $slots.default) == null ? void 0 : _a.call($slots)];
|
|
626
|
+
}
|
|
627
|
+
})
|
|
628
|
+
]);
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
Pagination.install = (app) => {
|
|
632
|
+
app.component(Pagination.name, Pagination);
|
|
633
|
+
};
|
|
634
|
+
var index = {
|
|
635
|
+
title: "Pagination \u5206\u9875",
|
|
636
|
+
category: "\u5BFC\u822A",
|
|
637
|
+
status: "100%",
|
|
638
|
+
install(app) {
|
|
639
|
+
app.use(Pagination);
|
|
640
|
+
}
|
|
641
|
+
};
|
|
642
|
+
export { Pagination, index as default };
|