@zkwq/business 0.0.4 → 0.0.6

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.
Files changed (227) hide show
  1. package/package.json +2 -2
  2. package/src/components/base/ui/alert/Alert.vue +0 -94
  3. package/src/components/base/ui/autocomplete/autocomplete-suggestions.vue +0 -77
  4. package/src/components/base/ui/autocomplete/autocomplete.vue +0 -305
  5. package/src/components/base/ui/backtop/main.vue +0 -112
  6. package/src/components/base/ui/button/Button.vue +0 -84
  7. package/src/components/base/ui/button/ButtonGroup.vue +0 -10
  8. package/src/components/base/ui/carousel/Carousel.vue +0 -304
  9. package/src/components/base/ui/carousel/CarouselItem.vue +0 -137
  10. package/src/components/base/ui/cascader/cascader.vue +0 -650
  11. package/src/components/base/ui/cascader-panel/cascader-menu.vue +0 -138
  12. package/src/components/base/ui/cascader-panel/cascader-node.vue +0 -246
  13. package/src/components/base/ui/cascader-panel/cascader-panel.vue +0 -382
  14. package/src/components/base/ui/cascader-panel/node.js +0 -166
  15. package/src/components/base/ui/cascader-panel/store.js +0 -62
  16. package/src/components/base/ui/checkbox/checkbox-button.vue +0 -199
  17. package/src/components/base/ui/checkbox/checkbox-group.vue +0 -48
  18. package/src/components/base/ui/checkbox/checkbox.vue +0 -222
  19. package/src/components/base/ui/col/col.js +0 -71
  20. package/src/components/base/ui/collapse/collapse-item.vue +0 -180
  21. package/src/components/base/ui/collapse/collapse.vue +0 -73
  22. package/src/components/base/ui/color-picker/color.js +0 -317
  23. package/src/components/base/ui/color-picker/components/alpha-slider.vue +0 -132
  24. package/src/components/base/ui/color-picker/components/hue-slider.vue +0 -123
  25. package/src/components/base/ui/color-picker/components/picker-dropdown.vue +0 -119
  26. package/src/components/base/ui/color-picker/components/predefine.vue +0 -61
  27. package/src/components/base/ui/color-picker/components/sv-panel.vue +0 -100
  28. package/src/components/base/ui/color-picker/draggable.js +0 -36
  29. package/src/components/base/ui/color-picker/index.js +0 -2
  30. package/src/components/base/ui/color-picker/main.vue +0 -188
  31. package/src/components/base/ui/date-picker/basic/date-table.vue +0 -441
  32. package/src/components/base/ui/date-picker/basic/month-table.vue +0 -254
  33. package/src/components/base/ui/date-picker/basic/time-spinner.vue +0 -304
  34. package/src/components/base/ui/date-picker/basic/year-table.vue +0 -101
  35. package/src/components/base/ui/date-picker/panel/date-range.vue +0 -680
  36. package/src/components/base/ui/date-picker/panel/date.vue +0 -597
  37. package/src/components/base/ui/date-picker/panel/month-range.vue +0 -289
  38. package/src/components/base/ui/date-picker/panel/time-range.vue +0 -248
  39. package/src/components/base/ui/date-picker/panel/time-select.vue +0 -178
  40. package/src/components/base/ui/date-picker/panel/time.vue +0 -186
  41. package/src/components/base/ui/date-picker/picker/date-picker.js +0 -43
  42. package/src/components/base/ui/date-picker/picker/time-picker.js +0 -39
  43. package/src/components/base/ui/date-picker/picker/time-select.js +0 -21
  44. package/src/components/base/ui/date-picker/picker.vue +0 -942
  45. package/src/components/base/ui/dialog/Index.vue +0 -212
  46. package/src/components/base/ui/directive/repeat-click.js +0 -24
  47. package/src/components/base/ui/directive/ripple.js +0 -303
  48. package/src/components/base/ui/divider/Divider.vue +0 -37
  49. package/src/components/base/ui/drawer/Drawer.vue +0 -202
  50. package/src/components/base/ui/dropdown/dropdown-item.vue +0 -39
  51. package/src/components/base/ui/dropdown/dropdown-menu.vue +0 -63
  52. package/src/components/base/ui/dropdown/dropdown.vue +0 -308
  53. package/src/components/base/ui/form/Form.vue +0 -167
  54. package/src/components/base/ui/form/FormItem.vue +0 -334
  55. package/src/components/base/ui/form/LabelWrap.vue +0 -69
  56. package/src/components/base/ui/icon/icon.vue +0 -13
  57. package/src/components/base/ui/image/image-viewer.vue +0 -302
  58. package/src/components/base/ui/image/main.vue +0 -248
  59. package/src/components/base/ui/index.js +0 -189
  60. package/src/components/base/ui/input/Input.vue +0 -438
  61. package/src/components/base/ui/input/calcTextareaHeight.js +0 -104
  62. package/src/components/base/ui/input-number/input-number.vue +0 -285
  63. package/src/components/base/ui/locale/format.js +0 -32
  64. package/src/components/base/ui/locale/index.js +0 -48
  65. package/src/components/base/ui/locale/lang/zh-CN.js +0 -120
  66. package/src/components/base/ui/menu/menu-item-group.vue +0 -45
  67. package/src/components/base/ui/menu/menu-item.vue +0 -112
  68. package/src/components/base/ui/menu/menu-mixin.js +0 -44
  69. package/src/components/base/ui/menu/menu.vue +0 -312
  70. package/src/components/base/ui/menu/submenu.vue +0 -408
  71. package/src/components/base/ui/message/index.js +0 -2
  72. package/src/components/base/ui/message/main.js +0 -87
  73. package/src/components/base/ui/message/main.vue +0 -110
  74. package/src/components/base/ui/message-box/main.js +0 -216
  75. package/src/components/base/ui/message-box/main.vue +0 -323
  76. package/src/components/base/ui/mixin/emitter.js +0 -31
  77. package/src/components/base/ui/mixin/focus.js +0 -9
  78. package/src/components/base/ui/mixin/locale.js +0 -9
  79. package/src/components/base/ui/mixin/migrating.js +0 -33
  80. package/src/components/base/ui/pagination/pager.vue +0 -163
  81. package/src/components/base/ui/pagination/pagination.jsx +0 -391
  82. package/src/components/base/ui/popover/directive.js +0 -20
  83. package/src/components/base/ui/popover/index.js +0 -14
  84. package/src/components/base/ui/popover/main.vue +0 -236
  85. package/src/components/base/ui/progress/Progress.vue +0 -227
  86. package/src/components/base/ui/radio/radio-button.vue +0 -114
  87. package/src/components/base/ui/radio/radio-group.vue +0 -111
  88. package/src/components/base/ui/radio/radio.vue +0 -134
  89. package/src/components/base/ui/row/row.js +0 -47
  90. package/src/components/base/ui/scrollbar/bar.jsx +0 -91
  91. package/src/components/base/ui/scrollbar/index.jsx +0 -203
  92. package/src/components/base/ui/scrollbar/util.js +0 -32
  93. package/src/components/base/ui/select/Option.vue +0 -168
  94. package/src/components/base/ui/select/OptionGroup.vue +0 -60
  95. package/src/components/base/ui/select/Select.vue +0 -920
  96. package/src/components/base/ui/select/SelectDropdown.vue +0 -74
  97. package/src/components/base/ui/select/navigation-mixin.js +0 -54
  98. package/src/components/base/ui/skeleton/index.js +0 -8
  99. package/src/components/base/ui/skeleton/src/img-placeholder.vue +0 -16
  100. package/src/components/base/ui/skeleton/src/index.vue +0 -80
  101. package/src/components/base/ui/skeleton/src/item.vue +0 -22
  102. package/src/components/base/ui/skeleton-item/index.js +0 -8
  103. package/src/components/base/ui/slider/button.vue +0 -238
  104. package/src/components/base/ui/slider/main.vue +0 -427
  105. package/src/components/base/ui/slider/marker.js +0 -18
  106. package/src/components/base/ui/style/alert.scss +0 -147
  107. package/src/components/base/ui/style/animations.scss +0 -65
  108. package/src/components/base/ui/style/autocomplete.scss +0 -81
  109. package/src/components/base/ui/style/backtop.scss +0 -20
  110. package/src/components/base/ui/style/button-group.scss +0 -0
  111. package/src/components/base/ui/style/button.scss +0 -380
  112. package/src/components/base/ui/style/carousel-item.scss +0 -50
  113. package/src/components/base/ui/style/carousel.scss +0 -161
  114. package/src/components/base/ui/style/cascader-panel.scss +0 -120
  115. package/src/components/base/ui/style/cascader.scss +0 -185
  116. package/src/components/base/ui/style/checkbox-button.scss +0 -0
  117. package/src/components/base/ui/style/checkbox-group.scss +0 -0
  118. package/src/components/base/ui/style/checkbox.scss +0 -360
  119. package/src/components/base/ui/style/col.scss +0 -156
  120. package/src/components/base/ui/style/collapse-item.scss +0 -0
  121. package/src/components/base/ui/style/collapse.scss +0 -114
  122. package/src/components/base/ui/style/color-picker.scss +0 -387
  123. package/src/components/base/ui/style/config.scss +0 -4
  124. package/src/components/base/ui/style/date-picker/date-picker.scss +0 -97
  125. package/src/components/base/ui/style/date-picker/date-range-picker.scss +0 -101
  126. package/src/components/base/ui/style/date-picker/date-table.scss +0 -151
  127. package/src/components/base/ui/style/date-picker/month-table.scss +0 -82
  128. package/src/components/base/ui/style/date-picker/picker-panel.scss +0 -117
  129. package/src/components/base/ui/style/date-picker/picker.scss +0 -197
  130. package/src/components/base/ui/style/date-picker/time-picker.scss +0 -85
  131. package/src/components/base/ui/style/date-picker/time-range-picker.scss +0 -31
  132. package/src/components/base/ui/style/date-picker/time-spinner.scss +0 -110
  133. package/src/components/base/ui/style/date-picker/year-table.scss +0 -51
  134. package/src/components/base/ui/style/date-picker.scss +0 -12
  135. package/src/components/base/ui/style/dialog.scss +0 -123
  136. package/src/components/base/ui/style/divider.scss +0 -47
  137. package/src/components/base/ui/style/drawer.scss +0 -218
  138. package/src/components/base/ui/style/dropdown-item.scss +0 -0
  139. package/src/components/base/ui/style/dropdown-menu.scss +0 -0
  140. package/src/components/base/ui/style/dropdown.scss +0 -185
  141. package/src/components/base/ui/style/form-item.scss +0 -0
  142. package/src/components/base/ui/style/form.scss +0 -203
  143. package/src/components/base/ui/style/function.scss +0 -43
  144. package/src/components/base/ui/style/icon.scss +0 -1167
  145. package/src/components/base/ui/style/image.scss +0 -184
  146. package/src/components/base/ui/style/index.scss +0 -57
  147. package/src/components/base/ui/style/input-number.scss +0 -187
  148. package/src/components/base/ui/style/input.scss +0 -477
  149. package/src/components/base/ui/style/menu-item-group.scss +0 -0
  150. package/src/components/base/ui/style/menu-item.scss +0 -0
  151. package/src/components/base/ui/style/menu.scss +0 -294
  152. package/src/components/base/ui/style/message-box.scss +0 -231
  153. package/src/components/base/ui/style/message.scss +0 -120
  154. package/src/components/base/ui/style/mixins.scss +0 -196
  155. package/src/components/base/ui/style/option-group.scss +0 -42
  156. package/src/components/base/ui/style/option.scss +0 -36
  157. package/src/components/base/ui/style/pagination.scss +0 -295
  158. package/src/components/base/ui/style/popover.scss +0 -40
  159. package/src/components/base/ui/style/popper.scss +0 -102
  160. package/src/components/base/ui/style/popup.scss +0 -42
  161. package/src/components/base/ui/style/progress.scss +0 -141
  162. package/src/components/base/ui/style/radio-button.scss +0 -113
  163. package/src/components/base/ui/style/radio-group.scss +0 -9
  164. package/src/components/base/ui/style/radio.scss +0 -203
  165. package/src/components/base/ui/style/ripple.scss +0 -35
  166. package/src/components/base/ui/style/row.scss +0 -39
  167. package/src/components/base/ui/style/scrollbar.scss +0 -75
  168. package/src/components/base/ui/style/select-dropdown.scss +0 -59
  169. package/src/components/base/ui/style/select.scss +0 -154
  170. package/src/components/base/ui/style/skeleton-item.scss +0 -84
  171. package/src/components/base/ui/style/skeleton.scss +0 -40
  172. package/src/components/base/ui/style/slider.scss +0 -250
  173. package/src/components/base/ui/style/switch.scss +0 -116
  174. package/src/components/base/ui/style/tabs.scss +0 -602
  175. package/src/components/base/ui/style/tag.scss +0 -174
  176. package/src/components/base/ui/style/tooltip.scss +0 -146
  177. package/src/components/base/ui/style/transition.scss +0 -138
  178. package/src/components/base/ui/style/upload.scss +0 -603
  179. package/src/components/base/ui/style/utils.scss +0 -39
  180. package/src/components/base/ui/style/var.scss +0 -1011
  181. package/src/components/base/ui/switch/index.vue +0 -174
  182. package/src/components/base/ui/tabs/tab-bar.vue +0 -57
  183. package/src/components/base/ui/tabs/tab-nav.vue +0 -294
  184. package/src/components/base/ui/tabs/tab-pane.vue +0 -56
  185. package/src/components/base/ui/tabs/tabs.vue +0 -191
  186. package/src/components/base/ui/tag/Tag.vue +0 -60
  187. package/src/components/base/ui/tooltip/tooltip.jsx +0 -234
  188. package/src/components/base/ui/upload/Index.vue +0 -340
  189. package/src/components/base/ui/upload/Upload.vue +0 -216
  190. package/src/components/base/ui/upload/UploadDragger.vue +0 -70
  191. package/src/components/base/ui/upload/UploadList.vue +0 -100
  192. package/src/components/base/ui/upload/ajax.js +0 -85
  193. package/src/components/base/ui/util/aria-dialog.js +0 -90
  194. package/src/components/base/ui/util/aria-utils.js +0 -122
  195. package/src/components/base/ui/util/clickoutside.js +0 -76
  196. package/src/components/base/ui/util/date-util.js +0 -292
  197. package/src/components/base/ui/util/date.js +0 -355
  198. package/src/components/base/ui/util/debounce.js +0 -21
  199. package/src/components/base/ui/util/deepmerge.js +0 -100
  200. package/src/components/base/ui/util/dom.js +0 -215
  201. package/src/components/base/ui/util/index.js +0 -262
  202. package/src/components/base/ui/util/menu/aria-menubar.js +0 -14
  203. package/src/components/base/ui/util/menu/aria-menuitem.js +0 -49
  204. package/src/components/base/ui/util/menu/aria-submenu.js +0 -59
  205. package/src/components/base/ui/util/merge.js +0 -14
  206. package/src/components/base/ui/util/popper.js +0 -1235
  207. package/src/components/base/ui/util/popup/index.js +0 -218
  208. package/src/components/base/ui/util/popup/popup-manager.js +0 -194
  209. package/src/components/base/ui/util/resize-events.js +0 -32
  210. package/src/components/base/ui/util/scroll-into-view.js +0 -27
  211. package/src/components/base/ui/util/scrollbar-width.js +0 -29
  212. package/src/components/base/ui/util/shared.js +0 -7
  213. package/src/components/base/ui/util/throttle.js +0 -91
  214. package/src/components/base/ui/util/types.js +0 -24
  215. package/src/components/base/ui/util/vdom.js +0 -5
  216. package/src/components/base/ui/util/vue-popper.js +0 -188
  217. package/src/components/normal/AggsItemH.vue +0 -145
  218. package/src/index.js +0 -10
  219. package/src/static/base-icons.ttf +0 -0
  220. package/src/static/base-icons.woff +0 -0
  221. package/src/static/label_bg.png +0 -0
  222. package/src/static/term-label-bg.png +0 -0
  223. package/src/style/app-article.scss +0 -698
  224. package/src/style/app-comment.scss +0 -259
  225. package/src/style/app-recommend.scss +0 -48
  226. package/src/style/app-richtext.scss +0 -176
  227. package/src/style/index.scss +0 -523
@@ -1,163 +0,0 @@
1
- <template>
2
- <ul @click="onPagerClick" class="base-pager">
3
- <li
4
- :class="{ active: currentPage === 1, disabled }"
5
- v-if="pageCount > 0"
6
- class="number">1</li>
7
- <li
8
- class="base-icon more btn-quickprev"
9
- :class="[quickprevIconClass, { disabled }]"
10
- v-if="showPrevMore"
11
- @mouseenter="onMouseenter('left')"
12
- @mouseleave="quickprevIconClass = 'base-icon-more'">
13
- </li>
14
- <li
15
- v-for="pager in pagers"
16
- :key="pager"
17
- :class="{ active: currentPage === pager, disabled }"
18
- class="number">{{ pager }}</li>
19
- <li
20
- class="base-icon more btn-quicknext"
21
- :class="[quicknextIconClass, { disabled }]"
22
- v-if="showNextMore"
23
- @mouseenter="onMouseenter('right')"
24
- @mouseleave="quicknextIconClass = 'base-icon-more'">
25
- </li>
26
- <li
27
- :class="{ active: currentPage === pageCount, disabled }"
28
- class="number"
29
- v-if="pageCount > 1">{{ pageCount }}</li>
30
- </ul>
31
- </template>
32
-
33
- <script type="text/babel">
34
- export default {
35
- name: 'BasePager',
36
-
37
- props: {
38
- currentPage: Number,
39
-
40
- pageCount: Number,
41
-
42
- pagerCount: Number,
43
-
44
- disabled: Boolean
45
- },
46
-
47
- watch: {
48
- showPrevMore(val) {
49
- if (!val) this.quickprevIconClass = 'base-icon-more';
50
- },
51
-
52
- showNextMore(val) {
53
- if (!val) this.quicknextIconClass = 'base-icon-more';
54
- }
55
- },
56
-
57
- methods: {
58
- onPagerClick(event) {
59
- const target = event.target;
60
- if (target.tagName === 'UL' || this.disabled) {
61
- return;
62
- }
63
-
64
- let newPage = Number(event.target.textContent);
65
- const pageCount = this.pageCount;
66
- const currentPage = this.currentPage;
67
- const pagerCountOffset = this.pagerCount - 2;
68
-
69
- if (target.className.indexOf('more') !== -1) {
70
- if (target.className.indexOf('quickprev') !== -1) {
71
- newPage = currentPage - pagerCountOffset;
72
- } else if (target.className.indexOf('quicknext') !== -1) {
73
- newPage = currentPage + pagerCountOffset;
74
- }
75
- }
76
-
77
- /* istanbul ignore if */
78
- if (!isNaN(newPage)) {
79
- if (newPage < 1) {
80
- newPage = 1;
81
- }
82
-
83
- if (newPage > pageCount) {
84
- newPage = pageCount;
85
- }
86
- }
87
-
88
- if (newPage !== currentPage) {
89
- this.$emit('change', newPage);
90
- }
91
- },
92
-
93
- onMouseenter(direction) {
94
- if (this.disabled) return;
95
- if (direction === 'left') {
96
- this.quickprevIconClass = 'base-icon-d-arrow-left';
97
- } else {
98
- this.quicknextIconClass = 'base-icon-d-arrow-right';
99
- }
100
- }
101
- },
102
-
103
- computed: {
104
- pagers() {
105
- const pagerCount = this.pagerCount;
106
- const halfPagerCount = (pagerCount - 1) / 2;
107
-
108
- const currentPage = Number(this.currentPage);
109
- const pageCount = Number(this.pageCount);
110
-
111
- let showPrevMore = false;
112
- let showNextMore = false;
113
-
114
- if (pageCount > pagerCount) {
115
- if (currentPage > pagerCount - halfPagerCount) {
116
- showPrevMore = true;
117
- }
118
-
119
- if (currentPage < pageCount - halfPagerCount) {
120
- showNextMore = true;
121
- }
122
- }
123
-
124
- const array = [];
125
-
126
- if (showPrevMore && !showNextMore) {
127
- const startPage = pageCount - (pagerCount - 2);
128
- for (let i = startPage; i < pageCount; i++) {
129
- array.push(i);
130
- }
131
- } else if (!showPrevMore && showNextMore) {
132
- for (let i = 2; i < pagerCount; i++) {
133
- array.push(i);
134
- }
135
- } else if (showPrevMore && showNextMore) {
136
- const offset = Math.floor(pagerCount / 2) - 1;
137
- for (let i = currentPage - offset ; i <= currentPage + offset; i++) {
138
- array.push(i);
139
- }
140
- } else {
141
- for (let i = 2; i < pageCount; i++) {
142
- array.push(i);
143
- }
144
- }
145
-
146
- this.showPrevMore = showPrevMore;
147
- this.showNextMore = showNextMore;
148
-
149
- return array;
150
- }
151
- },
152
-
153
- data() {
154
- return {
155
- current: null,
156
- showPrevMore: false,
157
- showNextMore: false,
158
- quicknextIconClass: 'base-icon-more',
159
- quickprevIconClass: 'base-icon-more'
160
- };
161
- }
162
- };
163
- </script>
@@ -1,391 +0,0 @@
1
- import Pager from './pager.vue';
2
- import BaseSelect from '../select/Select';
3
- import BaseOption from '../select/Option';
4
- import BaseInput from '../input/Input';
5
- import Locale from '../mixin/locale';
6
- import { valueEquals } from '../util/index';
7
-
8
- export default {
9
- name: 'BasePagination',
10
-
11
- props: {
12
- pageSize: {
13
- type: Number,
14
- default: 10
15
- },
16
-
17
- small: Boolean,
18
-
19
- total: Number,
20
-
21
- pageCount: Number,
22
-
23
- pagerCount: {
24
- type: Number,
25
- validator(value) {
26
- return (value | 0) === value && value > 4 && value < 22 && (value % 2) === 1;
27
- },
28
- default: 7
29
- },
30
-
31
- currentPage: {
32
- type: Number,
33
- default: 1
34
- },
35
-
36
- layout: {
37
- default: 'prev, pager, next, jumper, ->, total'
38
- },
39
-
40
- pageSizes: {
41
- type: Array,
42
- default() {
43
- return [10, 20, 30, 40, 50, 100];
44
- }
45
- },
46
-
47
- popperClass: String,
48
-
49
- prevText: String,
50
-
51
- nextText: String,
52
-
53
- background: Boolean,
54
-
55
- disabled: Boolean,
56
-
57
- hideOnSinglePage: Boolean,
58
-
59
- unitText: {
60
- type: String,
61
- default: '条'
62
- }
63
- },
64
-
65
- data() {
66
- return {
67
- internalCurrentPage: 1,
68
- internalPageSize: 0,
69
- lastEmittedPage: -1,
70
- userChangePageSize: false
71
- };
72
- },
73
-
74
- render(h) {
75
- const layout = this.layout;
76
- if (!layout) return null;
77
- if (this.hideOnSinglePage && (!this.internalPageCount || this.internalPageCount === 1)) return null;
78
-
79
- let template = <div class={['base-pagination', {
80
- 'is-background': this.background,
81
- 'base-pagination--small': this.small
82
- }] }></div>;
83
- const TEMPLATE_MAP = {
84
- prev: <prev></prev>,
85
- jumper: <jumper></jumper>,
86
- pager: <pager currentPage={ this.internalCurrentPage } pageCount={ this.internalPageCount } pagerCount={ this.pagerCount } on-change={ this.handleCurrentChange } disabled={ this.disabled }></pager>,
87
- next: <next></next>,
88
- sizes: <sizes pageSizes={ this.pageSizes }></sizes>,
89
- slot: <slot>{ this.$slots.default ? this.$slots.default : '' }</slot>,
90
- total: <total></total>
91
- };
92
- const components = layout.split(',').map((item) => item.trim());
93
- const rightWrapper = <div class="base-pagination__rightwrapper"></div>;
94
- let haveRightWrapper = false;
95
-
96
- template.children = template.children || [];
97
- rightWrapper.children = rightWrapper.children || [];
98
- components.forEach(compo => {
99
- if (compo === '->') {
100
- haveRightWrapper = true;
101
- return;
102
- }
103
-
104
- if (!haveRightWrapper) {
105
- template.children.push(TEMPLATE_MAP[compo]);
106
- } else {
107
- rightWrapper.children.push(TEMPLATE_MAP[compo]);
108
- }
109
- });
110
-
111
- if (haveRightWrapper) {
112
- template.children.unshift(rightWrapper);
113
- }
114
-
115
- return template;
116
- },
117
-
118
- components: {
119
- Prev: {
120
- render(h) {
121
- return (
122
- <button
123
- type="button"
124
- class="btn-prev"
125
- disabled={ this.$parent.disabled || this.$parent.internalCurrentPage <= 1 }
126
- on-click={ this.$parent.prev }>
127
- {
128
- this.$parent.prevText
129
- ? <span>{ this.$parent.prevText }</span>
130
- : <i class="base-icon base-icon-arrow-left"></i>
131
- }
132
- </button>
133
- );
134
- }
135
- },
136
-
137
- Next: {
138
- render(h) {
139
- return (
140
- <button
141
- type="button"
142
- class="btn-next"
143
- disabled={ this.$parent.disabled || this.$parent.internalCurrentPage === this.$parent.internalPageCount || this.$parent.internalPageCount === 0 }
144
- on-click={ this.$parent.next }>
145
- {
146
- this.$parent.nextText
147
- ? <span>{ this.$parent.nextText }</span>
148
- : <i class="base-icon base-icon-arrow-right"></i>
149
- }
150
- </button>
151
- );
152
- }
153
- },
154
-
155
- Sizes: {
156
- mixins: [Locale],
157
-
158
- props: {
159
- pageSizes: Array
160
- },
161
-
162
- watch: {
163
- pageSizes: {
164
- immediate: true,
165
- handler(newVal, oldVal) {
166
- if (valueEquals(newVal, oldVal)) return;
167
- if (Array.isArray(newVal)) {
168
- this.$parent.internalPageSize = newVal.indexOf(this.$parent.pageSize) > -1
169
- ? this.$parent.pageSize
170
- : this.pageSizes[0];
171
- }
172
- }
173
- }
174
- },
175
-
176
- render(h) {
177
- return (
178
- <span class="base-pagination__sizes">
179
- <base-select
180
- value={ this.$parent.internalPageSize }
181
- popperClass={ this.$parent.popperClass || '' }
182
- size="mini"
183
- on-input={ this.handleChange }
184
- disabled={ this.$parent.disabled }>
185
- {
186
- this.pageSizes.map(item =>
187
- <base-option
188
- value={ item }
189
- label={ item + this.t('base.pagination.pagesize') }>
190
- </base-option>
191
- )
192
- }
193
- </base-select>
194
- </span>
195
- );
196
- },
197
-
198
- components: {
199
- BaseSelect,
200
- BaseOption
201
- },
202
-
203
- methods: {
204
- handleChange(val) {
205
- if (val !== this.$parent.internalPageSize) {
206
- this.$parent.internalPageSize = val = parseInt(val, 10);
207
- this.$parent.userChangePageSize = true;
208
- this.$parent.$emit('update:pageSize', val);
209
- this.$parent.$emit('size-change', val);
210
- }
211
- }
212
- }
213
- },
214
-
215
- Jumper: {
216
- mixins: [Locale],
217
-
218
- components: { BaseInput },
219
-
220
- data() {
221
- return {
222
- userInput: null
223
- };
224
- },
225
-
226
- watch: {
227
- '$parent.internalCurrentPage'() {
228
- this.userInput = null;
229
- }
230
- },
231
-
232
- methods: {
233
- handleKeyup({ keyCode, target }) {
234
- // Chrome, Safari, Firefox triggers change event on Enter
235
- // Hack for IE: https://github.com/ElemeFE/element/issues/11710
236
- // Drop this method when we no longer supports IE
237
- if (keyCode === 13) {
238
- this.handleChange(target.value);
239
- }
240
- },
241
- handleInput(value) {
242
- this.userInput = value;
243
- },
244
- handleChange(value) {
245
- this.$parent.internalCurrentPage = this.$parent.getValidCurrentPage(value);
246
- this.$parent.emitChange();
247
- this.userInput = null;
248
- }
249
- },
250
-
251
- render(h) {
252
- return (
253
- <span class="base-pagination__jump">
254
- { this.t('base.pagination.goto') }
255
- <base-input
256
- class="base-pagination__editor is-in-pagination"
257
- min={ 1 }
258
- max={ this.$parent.internalPageCount }
259
- value={ this.userInput !== null ? this.userInput : this.$parent.internalCurrentPage }
260
- type="number"
261
- disabled={ this.$parent.disabled }
262
- nativeOnKeyup={ this.handleKeyup }
263
- onInput={ this.handleInput }
264
- onChange={ this.handleChange }/>
265
- { this.t('base.pagination.pageClassifier') }
266
- </span>
267
- );
268
- }
269
- },
270
-
271
- Total: {
272
- mixins: [Locale],
273
-
274
- render(h) {
275
- return (
276
- typeof this.$parent.total === 'number'
277
- ? <span class="base-pagination__total">{ this.t('base.pagination.total', { total: this.$parent.total,unitText: this.$parent.unitText }) }</span>
278
- : ''
279
- );
280
- }
281
- },
282
-
283
- Pager
284
- },
285
-
286
- methods: {
287
- handleCurrentChange(val) {
288
- this.internalCurrentPage = this.getValidCurrentPage(val);
289
- this.userChangePageSize = true;
290
- this.emitChange();
291
- },
292
-
293
- prev() {
294
- if (this.disabled) return;
295
- const newVal = this.internalCurrentPage - 1;
296
- this.internalCurrentPage = this.getValidCurrentPage(newVal);
297
- this.$emit('prev-click', this.internalCurrentPage);
298
- this.emitChange();
299
- },
300
-
301
- next() {
302
- if (this.disabled) return;
303
- const newVal = this.internalCurrentPage + 1;
304
- this.internalCurrentPage = this.getValidCurrentPage(newVal);
305
- this.$emit('next-click', this.internalCurrentPage);
306
- this.emitChange();
307
- },
308
-
309
- getValidCurrentPage(value) {
310
- value = parseInt(value, 10);
311
-
312
- const havePageCount = typeof this.internalPageCount === 'number';
313
-
314
- let resetValue;
315
- if (!havePageCount) {
316
- if (isNaN(value) || value < 1) resetValue = 1;
317
- } else {
318
- if (value < 1) {
319
- resetValue = 1;
320
- } else if (value > this.internalPageCount) {
321
- resetValue = this.internalPageCount;
322
- }
323
- }
324
-
325
- if (resetValue === undefined && isNaN(value)) {
326
- resetValue = 1;
327
- } else if (resetValue === 0) {
328
- resetValue = 1;
329
- }
330
-
331
- return resetValue === undefined ? value : resetValue;
332
- },
333
-
334
- emitChange() {
335
- this.$nextTick(() => {
336
- if (this.internalCurrentPage !== this.lastEmittedPage || this.userChangePageSize) {
337
- this.$emit('current-change', this.internalCurrentPage);
338
- this.lastEmittedPage = this.internalCurrentPage;
339
- this.userChangePageSize = false;
340
- }
341
- });
342
- }
343
- },
344
-
345
- computed: {
346
- internalPageCount() {
347
- if (typeof this.total === 'number') {
348
- return Math.max(1, Math.ceil(this.total / this.internalPageSize));
349
- } else if (typeof this.pageCount === 'number') {
350
- return Math.max(1, this.pageCount);
351
- }
352
- return null;
353
- }
354
- },
355
-
356
- watch: {
357
- currentPage: {
358
- immediate: true,
359
- handler(val) {
360
- this.internalCurrentPage = this.getValidCurrentPage(val);
361
- }
362
- },
363
-
364
- pageSize: {
365
- immediate: true,
366
- handler(val) {
367
- this.internalPageSize = isNaN(val) ? 10 : val;
368
- }
369
- },
370
-
371
- internalCurrentPage: {
372
- immediate: true,
373
- handler(newVal) {
374
- this.$emit('update:currentPage', newVal);
375
- this.lastEmittedPage = -1;
376
- }
377
- },
378
-
379
- internalPageCount(newVal) {
380
- /* istanbul ignore if */
381
- const oldPage = this.internalCurrentPage;
382
- if (newVal > 0 && oldPage === 0) {
383
- this.internalCurrentPage = 1;
384
- } else if (oldPage > newVal) {
385
- this.internalCurrentPage = newVal === 0 ? 1 : newVal;
386
- this.userChangePageSize && this.emitChange();
387
- }
388
- this.userChangePageSize = false;
389
- }
390
- }
391
- };
@@ -1,20 +0,0 @@
1
- const getReference = (el, binding, vnode) => {
2
- const _ref = binding.expression ? binding.value : binding.arg;
3
- const popper = vnode.context.$refs[_ref];
4
- if (popper) {
5
- if (Array.isArray(popper)) {
6
- popper[0].$refs.reference = el;
7
- } else {
8
- popper.$refs.reference = el;
9
- }
10
- }
11
- };
12
-
13
- export default {
14
- bind(el, binding, vnode) {
15
- getReference(el, binding, vnode);
16
- },
17
- inserted(el, binding, vnode) {
18
- getReference(el, binding, vnode);
19
- }
20
- };
@@ -1,14 +0,0 @@
1
- import Popover from './main';
2
- import directive from './directive';
3
- import Vue from 'vue';
4
-
5
- Vue.directive('popover', directive);
6
-
7
- /* istanbul ignore next */
8
- Popover.install = function(Vue) {
9
- Vue.directive('popover', directive);
10
- Vue.component(Popover.name, Popover);
11
- };
12
- Popover.directive = directive;
13
-
14
- export default Popover;