vue-amazing-ui 0.0.0

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/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # vue-amazing-ui
2
+
3
+ ## 安装插件
4
+
5
+ ```
6
+ npm install vue-amazing-ui
7
+ 或:yarn add vue-amazing-ui
8
+ ```
9
+
10
+ ## 引入并注册插件
11
+
12
+ ```
13
+ import VueAmazingUI from 'vue-amazing-ui'
14
+ import '../node_modules/vue-amazing-ui/dist/style.css'
15
+
16
+ app.use(VueUi)
17
+
18
+ // 或者
19
+ import { Pagination, Breadcrumb } from 'vue-amazing-ui'
20
+ import '../node_modules/vue-amazing-ui/dist/style.css'
21
+
22
+ app.use(Pagination).use(Breadcrumb)
23
+ ```
24
+
25
+ ## 在项目中使用(示例)
26
+
27
+ ```
28
+ <Breadcrumb :routes="routes" :height="60" />
29
+ ```
Binary file
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .m-pagination[data-v-7b04d407]{margin:16px 0}.hidden[data-v-7b04d407]{display:none}.left[data-v-7b04d407]{text-align:left}.center[data-v-7b04d407]{text-align:center}.right[data-v-7b04d407]{text-align:right}.m-pagination-wrap[data-v-7b04d407]{display:inline-block;height:32px;line-height:30px;font-size:14px;color:#000000a6;text-align:center}.m-pagination-wrap .mr8[data-v-7b04d407]{margin-right:8px}.m-pagination-wrap .u-item[data-v-7b04d407]{min-width:30px;height:30px;display:inline-block;user-select:none;border:1px solid #d9d9d9;border-radius:4px;cursor:pointer;transition:all .3s}.m-pagination-wrap .u-item[data-v-7b04d407]:hover{font-weight:500;color:#1890ff;border-color:#1890ff}.m-pagination-wrap .u-item:hover .u-arrow[data-v-7b04d407]{fill:#1890ff}.m-pagination-wrap .u-item .u-arrow[data-v-7b04d407]{fill:#000000a6;width:12px;height:12px;transition:all .3s}.m-pagination-wrap .u-item[data-v-7b04d407]:not(:last-child){margin-right:8px}.m-pagination-wrap .active[data-v-7b04d407]{font-weight:500;color:#1890ff;border-color:#1890ff}.m-pagination-wrap .active .u-arrow[data-v-7b04d407]{fill:#1890ff}.m-pagination-wrap .disabled[data-v-7b04d407]{color:#00000040;background:#fff;border-color:#d9d9d9;cursor:not-allowed}.m-pagination-wrap .disabled[data-v-7b04d407]:hover{font-weight:400;color:#000000a6;border-color:#d9d9d9}.m-pagination-wrap .disabled:hover .u-arrow[data-v-7b04d407],.m-pagination-wrap .disabled .u-arrow[data-v-7b04d407]{fill:#00000040}.m-pagination-wrap .m-arrow[data-v-7b04d407]{display:inline-block;vertical-align:middle;margin-right:8px;min-width:32px;height:32px;letter-spacing:2px;font-size:12px;color:#00000040;transition:all .3s;cursor:pointer}.m-pagination-wrap .m-arrow .u-ellipsis[data-v-7b04d407]{transition:all .3s}.m-pagination-wrap .m-arrow .u-icon[data-v-7b04d407]{fill:#1890ff;width:12px;height:12px}.m-pagination-wrap .u-jump-page[data-v-7b04d407]{margin-left:8px;line-height:32px;font-size:14px;color:#000000a6}.m-pagination-wrap .u-jump-page input[data-v-7b04d407]{vertical-align:top;width:26px;height:20px;padding:5px 11px;margin:0 8px;border:1px solid #d9d9d9;border-radius:4px;background:transparent;text-align:left;outline:none;transition:all .3s}.m-pagination-wrap .u-jump-page input[data-v-7b04d407]:hover{border-color:#1890ff}.m-pagination-wrap .u-jump-page input[data-v-7b04d407]:focus{border-color:#1890ff;box-shadow:0 0 0 2px #1890ff33}.m-breadcrumb .m-bread[data-v-988f5a63]{display:inline-block;vertical-align:middle}.m-breadcrumb .m-bread .u-route[data-v-988f5a63]{height:22px;font-size:16px;font-weight:400;line-height:22px;color:#333;display:inline-block;vertical-align:middle;max-width:240px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;cursor:pointer}.m-breadcrumb .m-bread .u-route[data-v-988f5a63]:hover{color:#1890ff}.m-breadcrumb .m-bread .active[data-v-988f5a63]{color:#1890ff;cursor:default}.m-breadcrumb .m-bread .u-separator[data-v-988f5a63]{display:inline-block;vertical-align:middle;margin:0 6px}.m-breadcrumb .m-bread .u-arrow[data-v-988f5a63]{display:inline-block;vertical-align:middle;margin:0 5px;width:12px;height:12px}.m-breadcrumb .assist[data-v-988f5a63]{height:100%;width:0;display:inline-block;vertical-align:middle}
@@ -0,0 +1,393 @@
1
+ import { openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, withDirectives, vShow, Fragment, renderList, createTextVNode, vModelText, pushScopeId, popScopeId, normalizeStyle } from "vue";
2
+ const Pagination_vue_vue_type_style_index_0_scoped_7b04d407_lang = "";
3
+ const _export_sfc = (sfc, props) => {
4
+ const target = sfc.__vccOpts || sfc;
5
+ for (const [key, val] of props) {
6
+ target[key] = val;
7
+ }
8
+ return target;
9
+ };
10
+ const _sfc_main$1 = {
11
+ name: "Pagination",
12
+ props: {
13
+ current: {
14
+ // 当前页数
15
+ type: Number,
16
+ default: 1
17
+ },
18
+ pageSize: {
19
+ // 每页条数
20
+ type: Number,
21
+ default: 10
22
+ },
23
+ total: {
24
+ // 数据总数
25
+ type: Number,
26
+ default: 0
27
+ },
28
+ pageListNum: {
29
+ // 显示的页码数组长度
30
+ type: Number,
31
+ default: 5
32
+ },
33
+ hideOnSinglePage: {
34
+ // 只有一页时是否隐藏分页器
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ showQuickJumper: {
39
+ // 是否可以快速跳转至某页
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ showTotal: {
44
+ // 是否显示当前页数和数据总量
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ placement: {
49
+ // 分页器展示位置,靠左,居中,靠右
50
+ type: String,
51
+ default: "right"
52
+ }
53
+ },
54
+ data() {
55
+ return {
56
+ currentPage: this.current,
57
+ // 当前页数
58
+ jumpNumber: "",
59
+ // 跳转的页码
60
+ forwardMore: false,
61
+ // 左省略号展示
62
+ backwardMore: false,
63
+ // 右省略号展示
64
+ forwardArrow: false,
65
+ // 左箭头展示
66
+ backwardArrow: false
67
+ // 右箭头展示
68
+ };
69
+ },
70
+ computed: {
71
+ totalPage() {
72
+ return Math.ceil(this.total / this.pageSize);
73
+ },
74
+ pageList() {
75
+ return this.dealPageList(this.currentPage).filter((n) => n !== 1 && n !== this.totalPage);
76
+ }
77
+ },
78
+ watch: {
79
+ current(to) {
80
+ this.currentPage = to;
81
+ },
82
+ currentPage(to) {
83
+ this.loading = true;
84
+ this.$emit("change", {
85
+ page: to,
86
+ pageSize: this.pageSize
87
+ });
88
+ }
89
+ },
90
+ created() {
91
+ document.onkeydown = (e) => {
92
+ const ev = e || window.event;
93
+ if (ev && ev.keyCode === 13 && this.jumpNumber) {
94
+ this.jumpPage(this.jumpNumber);
95
+ }
96
+ };
97
+ },
98
+ methods: {
99
+ dealPageList(curPage) {
100
+ var resList = [];
101
+ var offset = Math.floor(this.pageListNum / 2);
102
+ var pager = {
103
+ start: curPage - offset,
104
+ end: curPage + offset
105
+ };
106
+ if (pager.start < 1) {
107
+ pager.end = pager.end + (1 - pager.start);
108
+ pager.start = 1;
109
+ }
110
+ if (pager.end > this.totalPage) {
111
+ pager.start = pager.start - (pager.end - this.totalPage);
112
+ pager.end = this.totalPage;
113
+ }
114
+ if (pager.start < 1) {
115
+ pager.start = 1;
116
+ }
117
+ if (pager.start > 1) {
118
+ this.forwardMore = true;
119
+ } else {
120
+ this.forwardMore = false;
121
+ }
122
+ if (pager.end < this.totalPage) {
123
+ this.backwardMore = true;
124
+ } else {
125
+ this.backwardMore = false;
126
+ }
127
+ for (let i = pager.start; i <= pager.end; i++) {
128
+ resList.push(i);
129
+ }
130
+ return resList;
131
+ },
132
+ onForward() {
133
+ this.currentPage = this.currentPage - this.pageListNum > 0 ? this.currentPage - this.pageListNum : 1;
134
+ },
135
+ onBackward() {
136
+ this.currentPage = this.currentPage + this.pageListNum < this.totalPage ? this.currentPage + this.pageListNum : this.totalPage;
137
+ },
138
+ jumpPage(jumpNum) {
139
+ if (Number(jumpNum)) {
140
+ if (Number(jumpNum) < 1) {
141
+ jumpNum = 1;
142
+ }
143
+ if (Number(jumpNum) > this.totalPage) {
144
+ jumpNum = this.totalPage;
145
+ }
146
+ this.changePage(Number(jumpNum));
147
+ }
148
+ this.jumpNumber = "";
149
+ },
150
+ changePage(pageNum) {
151
+ if (pageNum === 0 || pageNum === this.totalPage + 1) {
152
+ return false;
153
+ }
154
+ if (this.currentPage !== pageNum) {
155
+ this.currentPage = pageNum;
156
+ }
157
+ }
158
+ }
159
+ };
160
+ const _withScopeId$1 = (n) => (pushScopeId("data-v-7b04d407"), n = n(), popScopeId(), n);
161
+ const _hoisted_1$1 = { class: "m-pagination-wrap" };
162
+ const _hoisted_2$1 = {
163
+ key: 0,
164
+ class: "mr8"
165
+ };
166
+ const _hoisted_3$1 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("svg", {
167
+ class: "u-arrow",
168
+ viewBox: "64 64 896 896",
169
+ "data-icon": "left",
170
+ "aria-hidden": "true",
171
+ focusable: "false"
172
+ }, [
173
+ /* @__PURE__ */ createElementVNode("path", { d: "M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z" })
174
+ ], -1));
175
+ const _hoisted_4$1 = [
176
+ _hoisted_3$1
177
+ ];
178
+ const _hoisted_5$1 = { class: "u-ellipsis" };
179
+ const _hoisted_6$1 = {
180
+ class: "u-icon",
181
+ viewBox: "64 64 896 896",
182
+ "data-icon": "double-left",
183
+ "aria-hidden": "true",
184
+ focusable: "false"
185
+ };
186
+ const _hoisted_7 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("path", { d: "M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 0 0 0 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 0 0 0 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z" }, null, -1));
187
+ const _hoisted_8 = [
188
+ _hoisted_7
189
+ ];
190
+ const _hoisted_9 = ["onClick"];
191
+ const _hoisted_10 = { class: "u-ellipsis" };
192
+ const _hoisted_11 = {
193
+ class: "u-icon",
194
+ viewBox: "64 64 896 896",
195
+ "data-icon": "double-right",
196
+ "aria-hidden": "true",
197
+ focusable: "false"
198
+ };
199
+ const _hoisted_12 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("path", { d: "M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 0 0 188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 0 0 492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z" }, null, -1));
200
+ const _hoisted_13 = [
201
+ _hoisted_12
202
+ ];
203
+ const _hoisted_14 = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ createElementVNode("svg", {
204
+ class: "u-arrow",
205
+ viewBox: "64 64 896 896",
206
+ "data-icon": "right",
207
+ "aria-hidden": "true",
208
+ focusable: "false"
209
+ }, [
210
+ /* @__PURE__ */ createElementVNode("path", { d: "M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z" })
211
+ ], -1));
212
+ const _hoisted_15 = [
213
+ _hoisted_14
214
+ ];
215
+ const _hoisted_16 = {
216
+ key: 1,
217
+ class: "u-jump-page"
218
+ };
219
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
220
+ return openBlock(), createElementBlock("div", {
221
+ class: normalizeClass([`m-pagination ${$props.placement}`, { hidden: $props.hideOnSinglePage && $props.total <= $props.pageSize }])
222
+ }, [
223
+ createElementVNode("div", _hoisted_1$1, [
224
+ $props.showTotal ? (openBlock(), createElementBlock("span", _hoisted_2$1, "共 " + toDisplayString($options.totalPage) + " 页 / " + toDisplayString($props.total) + " 条", 1)) : createCommentVNode("", true),
225
+ createElementVNode("span", {
226
+ class: normalizeClass(["u-item", { disabled: $data.currentPage === 1 }]),
227
+ onClick: _cache[0] || (_cache[0] = ($event) => $options.changePage($data.currentPage - 1))
228
+ }, _hoisted_4$1, 2),
229
+ createElementVNode("span", {
230
+ class: normalizeClass(["u-item", { active: $data.currentPage === 1 }]),
231
+ onClick: _cache[1] || (_cache[1] = ($event) => $options.changePage(1))
232
+ }, "1", 2),
233
+ withDirectives(createElementVNode("span", {
234
+ class: "m-arrow",
235
+ ref: "forward",
236
+ onClick: _cache[2] || (_cache[2] = (...args) => $options.onForward && $options.onForward(...args)),
237
+ onMouseenter: _cache[3] || (_cache[3] = ($event) => $data.forwardArrow = true),
238
+ onMouseleave: _cache[4] || (_cache[4] = ($event) => $data.forwardArrow = false)
239
+ }, [
240
+ withDirectives(createElementVNode("span", _hoisted_5$1, "•••", 512), [
241
+ [vShow, !$data.forwardArrow]
242
+ ]),
243
+ withDirectives((openBlock(), createElementBlock("svg", _hoisted_6$1, _hoisted_8, 512)), [
244
+ [vShow, $data.forwardArrow]
245
+ ])
246
+ ], 544), [
247
+ [vShow, $data.forwardMore && $options.pageList[0] - 1 > 1]
248
+ ]),
249
+ (openBlock(true), createElementBlock(Fragment, null, renderList($options.pageList, (page, index) => {
250
+ return openBlock(), createElementBlock("span", {
251
+ class: normalizeClass(["u-item", { active: $data.currentPage === page }]),
252
+ key: index,
253
+ onClick: ($event) => $options.changePage(page)
254
+ }, toDisplayString(page), 11, _hoisted_9);
255
+ }), 128)),
256
+ withDirectives(createElementVNode("span", {
257
+ class: "m-arrow",
258
+ ref: "backward",
259
+ onClick: _cache[5] || (_cache[5] = (...args) => $options.onBackward && $options.onBackward(...args)),
260
+ onMouseenter: _cache[6] || (_cache[6] = ($event) => $data.backwardArrow = true),
261
+ onMouseleave: _cache[7] || (_cache[7] = ($event) => $data.backwardArrow = false)
262
+ }, [
263
+ withDirectives(createElementVNode("span", _hoisted_10, "•••", 512), [
264
+ [vShow, !$data.backwardArrow]
265
+ ]),
266
+ withDirectives((openBlock(), createElementBlock("svg", _hoisted_11, _hoisted_13, 512)), [
267
+ [vShow, $data.backwardArrow]
268
+ ])
269
+ ], 544), [
270
+ [vShow, $data.backwardMore && $options.pageList[$options.pageList.length - 1] + 1 < $options.totalPage]
271
+ ]),
272
+ withDirectives(createElementVNode("span", {
273
+ class: normalizeClass(["u-item", { active: $data.currentPage === $options.totalPage }]),
274
+ onClick: _cache[8] || (_cache[8] = ($event) => $options.changePage($options.totalPage))
275
+ }, toDisplayString($options.totalPage), 3), [
276
+ [vShow, $options.totalPage !== 1]
277
+ ]),
278
+ createElementVNode("span", {
279
+ class: normalizeClass(["u-item", { disabled: $data.currentPage === $options.totalPage }]),
280
+ onClick: _cache[9] || (_cache[9] = ($event) => $options.changePage($data.currentPage + 1))
281
+ }, _hoisted_15, 2),
282
+ $props.showQuickJumper ? (openBlock(), createElementBlock("span", _hoisted_16, [
283
+ createTextVNode("跳至"),
284
+ withDirectives(createElementVNode("input", {
285
+ type: "text",
286
+ "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => $data.jumpNumber = $event)
287
+ }, null, 512), [
288
+ [vModelText, $data.jumpNumber]
289
+ ]),
290
+ createTextVNode("页")
291
+ ])) : createCommentVNode("", true)
292
+ ])
293
+ ], 2);
294
+ }
295
+ const Pagination = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1], ["__scopeId", "data-v-7b04d407"]]);
296
+ Pagination.install = (app) => {
297
+ app.component(Pagination.name, Pagination);
298
+ };
299
+ const Breadcrumb_vue_vue_type_style_index_0_scoped_988f5a63_lang = "";
300
+ const _sfc_main = {
301
+ name: "Breadcrumb",
302
+ props: {
303
+ routes: {
304
+ // router的路由数组
305
+ type: Array,
306
+ required: true,
307
+ default: () => {
308
+ return [];
309
+ }
310
+ },
311
+ height: {
312
+ // 面包屑高度
313
+ type: Number,
314
+ default: 60
315
+ },
316
+ separator: {
317
+ // 自定义分隔符
318
+ type: String,
319
+ default: ""
320
+ }
321
+ },
322
+ computed: {
323
+ len() {
324
+ return this.routes.length;
325
+ }
326
+ },
327
+ methods: {
328
+ goRouter(route) {
329
+ this.$router.push({ path: route.path, query: route.query || {} });
330
+ }
331
+ }
332
+ };
333
+ const _withScopeId = (n) => (pushScopeId("data-v-988f5a63"), n = n(), popScopeId(), n);
334
+ const _hoisted_1 = ["onClick", "title"];
335
+ const _hoisted_2 = {
336
+ key: 0,
337
+ class: "u-separator"
338
+ };
339
+ const _hoisted_3 = {
340
+ key: 1,
341
+ class: "u-arrow",
342
+ viewBox: "64 64 896 896",
343
+ "data-icon": "right",
344
+ "aria-hidden": "true",
345
+ focusable: "false"
346
+ };
347
+ const _hoisted_4 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("path", { d: "M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z" }, null, -1));
348
+ const _hoisted_5 = [
349
+ _hoisted_4
350
+ ];
351
+ const _hoisted_6 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("div", { class: "assist" }, null, -1));
352
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
353
+ return openBlock(), createElementBlock("div", {
354
+ class: "m-breadcrumb",
355
+ style: normalizeStyle(`height: ${$props.height}px;`)
356
+ }, [
357
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.routes, (route, index) => {
358
+ return openBlock(), createElementBlock("div", {
359
+ class: "m-bread",
360
+ key: index
361
+ }, [
362
+ createElementVNode("a", {
363
+ class: normalizeClass(["u-route", { active: index === $options.len - 1 }]),
364
+ onClick: ($event) => index === $options.len - 1 ? (e) => e.preventDefault() : $options.goRouter(route),
365
+ title: route.name
366
+ }, toDisplayString(route.name || "--"), 11, _hoisted_1),
367
+ index !== $options.len - 1 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
368
+ $props.separator ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString($props.separator), 1)) : (openBlock(), createElementBlock("svg", _hoisted_3, _hoisted_5))
369
+ ], 64)) : createCommentVNode("", true)
370
+ ]);
371
+ }), 128)),
372
+ _hoisted_6
373
+ ], 4);
374
+ }
375
+ const Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-988f5a63"]]);
376
+ Breadcrumb.install = (app) => {
377
+ app.component(Breadcrumb.name, Breadcrumb);
378
+ };
379
+ const components = [
380
+ Pagination,
381
+ Breadcrumb
382
+ ];
383
+ const install = (app) => {
384
+ components.forEach((component) => app.component(component.name, component));
385
+ };
386
+ const VueAmazingUI = {
387
+ install
388
+ };
389
+ export {
390
+ Breadcrumb,
391
+ Pagination,
392
+ VueAmazingUI as default
393
+ };
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).VueAmazingUI={},e.Vue)}(this,(function(e,t){"use strict";const a=(e,t)=>{const a=e.__vccOpts||e;for(const[r,o]of t)a[r]=o;return a},r={name:"Pagination",props:{current:{type:Number,default:1},pageSize:{type:Number,default:10},total:{type:Number,default:0},pageListNum:{type:Number,default:5},hideOnSinglePage:{type:Boolean,default:!1},showQuickJumper:{type:Boolean,default:!1},showTotal:{type:Boolean,default:!1},placement:{type:String,default:"right"}},data(){return{currentPage:this.current,jumpNumber:"",forwardMore:!1,backwardMore:!1,forwardArrow:!1,backwardArrow:!1}},computed:{totalPage(){return Math.ceil(this.total/this.pageSize)},pageList(){return this.dealPageList(this.currentPage).filter((e=>1!==e&&e!==this.totalPage))}},watch:{current(e){this.currentPage=e},currentPage(e){this.loading=!0,this.$emit("change",{page:e,pageSize:this.pageSize})}},created(){document.onkeydown=e=>{const t=e||window.event;t&&13===t.keyCode&&this.jumpNumber&&this.jumpPage(this.jumpNumber)}},methods:{dealPageList(e){var t=[],a=Math.floor(this.pageListNum/2),r={start:e-a,end:e+a};r.start<1&&(r.end=r.end+(1-r.start),r.start=1),r.end>this.totalPage&&(r.start=r.start-(r.end-this.totalPage),r.end=this.totalPage),r.start<1&&(r.start=1),r.start>1?this.forwardMore=!0:this.forwardMore=!1,r.end<this.totalPage?this.backwardMore=!0:this.backwardMore=!1;for(let o=r.start;o<=r.end;o++)t.push(o);return t},onForward(){this.currentPage=this.currentPage-this.pageListNum>0?this.currentPage-this.pageListNum:1},onBackward(){this.currentPage=this.currentPage+this.pageListNum<this.totalPage?this.currentPage+this.pageListNum:this.totalPage},jumpPage(e){Number(e)&&(Number(e)<1&&(e=1),Number(e)>this.totalPage&&(e=this.totalPage),this.changePage(Number(e))),this.jumpNumber=""},changePage(e){if(0===e||e===this.totalPage+1)return!1;this.currentPage!==e&&(this.currentPage=e)}}},o=e=>(t.pushScopeId("data-v-7b04d407"),e=e(),t.popScopeId(),e),n={class:"m-pagination-wrap"},l={key:0,class:"mr8"},c=[o((()=>t.createElementVNode("svg",{class:"u-arrow",viewBox:"64 64 896 896","data-icon":"left","aria-hidden":"true",focusable:"false"},[t.createElementVNode("path",{d:"M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 0 0 0 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"})],-1)))],s={class:"u-ellipsis"},i={class:"u-icon",viewBox:"64 64 896 896","data-icon":"double-left","aria-hidden":"true",focusable:"false"},u=[o((()=>t.createElementVNode("path",{d:"M272.9 512l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L186.8 492.3a31.99 31.99 0 0 0 0 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H532c6.7 0 10.4-7.7 6.3-12.9L272.9 512zm304 0l265.4-339.1c4.1-5.2.4-12.9-6.3-12.9h-77.3c-4.9 0-9.6 2.3-12.6 6.1L490.8 492.3a31.99 31.99 0 0 0 0 39.5l255.3 326.1c3 3.9 7.7 6.1 12.6 6.1H836c6.7 0 10.4-7.7 6.3-12.9L576.9 512z"},null,-1)))],d=["onClick"],p={class:"u-ellipsis"},m={class:"u-icon",viewBox:"64 64 896 896","data-icon":"double-right","aria-hidden":"true",focusable:"false"},g=[o((()=>t.createElementVNode("path",{d:"M533.2 492.3L277.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H188c-6.7 0-10.4 7.7-6.3 12.9L447.1 512 181.7 851.1A7.98 7.98 0 0 0 188 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5zm304 0L581.9 166.1c-3-3.9-7.7-6.1-12.6-6.1H492c-6.7 0-10.4 7.7-6.3 12.9L751.1 512 485.7 851.1A7.98 7.98 0 0 0 492 864h77.3c4.9 0 9.6-2.3 12.6-6.1l255.3-326.1c9.1-11.7 9.1-27.9 0-39.5z"},null,-1)))],h=[o((()=>t.createElementVNode("svg",{class:"u-arrow",viewBox:"64 64 896 896","data-icon":"right","aria-hidden":"true",focusable:"false"},[t.createElementVNode("path",{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"})],-1)))],w={key:1,class:"u-jump-page"};const f=a(r,[["render",function(e,a,r,o,f,k){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([`m-pagination ${r.placement}`,{hidden:r.hideOnSinglePage&&r.total<=r.pageSize}])},[t.createElementVNode("div",n,[r.showTotal?(t.openBlock(),t.createElementBlock("span",l,"共 "+t.toDisplayString(k.totalPage)+" 页 / "+t.toDisplayString(r.total)+" 条",1)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass(["u-item",{disabled:1===f.currentPage}]),onClick:a[0]||(a[0]=e=>k.changePage(f.currentPage-1))},c,2),t.createElementVNode("span",{class:t.normalizeClass(["u-item",{active:1===f.currentPage}]),onClick:a[1]||(a[1]=e=>k.changePage(1))},"1",2),t.withDirectives(t.createElementVNode("span",{class:"m-arrow",ref:"forward",onClick:a[2]||(a[2]=(...e)=>k.onForward&&k.onForward(...e)),onMouseenter:a[3]||(a[3]=e=>f.forwardArrow=!0),onMouseleave:a[4]||(a[4]=e=>f.forwardArrow=!1)},[t.withDirectives(t.createElementVNode("span",s,"•••",512),[[t.vShow,!f.forwardArrow]]),t.withDirectives((t.openBlock(),t.createElementBlock("svg",i,u,512)),[[t.vShow,f.forwardArrow]])],544),[[t.vShow,f.forwardMore&&k.pageList[0]-1>1]]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.pageList,((e,a)=>(t.openBlock(),t.createElementBlock("span",{class:t.normalizeClass(["u-item",{active:f.currentPage===e}]),key:a,onClick:t=>k.changePage(e)},t.toDisplayString(e),11,d)))),128)),t.withDirectives(t.createElementVNode("span",{class:"m-arrow",ref:"backward",onClick:a[5]||(a[5]=(...e)=>k.onBackward&&k.onBackward(...e)),onMouseenter:a[6]||(a[6]=e=>f.backwardArrow=!0),onMouseleave:a[7]||(a[7]=e=>f.backwardArrow=!1)},[t.withDirectives(t.createElementVNode("span",p,"•••",512),[[t.vShow,!f.backwardArrow]]),t.withDirectives((t.openBlock(),t.createElementBlock("svg",m,g,512)),[[t.vShow,f.backwardArrow]])],544),[[t.vShow,f.backwardMore&&k.pageList[k.pageList.length-1]+1<k.totalPage]]),t.withDirectives(t.createElementVNode("span",{class:t.normalizeClass(["u-item",{active:f.currentPage===k.totalPage}]),onClick:a[8]||(a[8]=e=>k.changePage(k.totalPage))},t.toDisplayString(k.totalPage),3),[[t.vShow,1!==k.totalPage]]),t.createElementVNode("span",{class:t.normalizeClass(["u-item",{disabled:f.currentPage===k.totalPage}]),onClick:a[9]||(a[9]=e=>k.changePage(f.currentPage+1))},h,2),r.showQuickJumper?(t.openBlock(),t.createElementBlock("span",w,[t.createTextVNode("跳至"),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":a[10]||(a[10]=e=>f.jumpNumber=e)},null,512),[[t.vModelText,f.jumpNumber]]),t.createTextVNode("页")])):t.createCommentVNode("",!0)])],2)}],["__scopeId","data-v-7b04d407"]]);f.install=e=>{e.component(f.name,f)};const k={name:"Breadcrumb",props:{routes:{type:Array,required:!0,default:()=>[]},height:{type:Number,default:60},separator:{type:String,default:""}},computed:{len(){return this.routes.length}},methods:{goRouter(e){this.$router.push({path:e.path,query:e.query||{}})}}},P=e=>(t.pushScopeId("data-v-988f5a63"),e=e(),t.popScopeId(),e),v=["onClick","title"],b={key:0,class:"u-separator"},N={key:1,class:"u-arrow",viewBox:"64 64 896 896","data-icon":"right","aria-hidden":"true",focusable:"false"},B=[P((()=>t.createElementVNode("path",{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 0 0 302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 0 0 0-50.4z"},null,-1)))],y=P((()=>t.createElementVNode("div",{class:"assist"},null,-1)));const E=a(k,[["render",function(e,a,r,o,n,l){return t.openBlock(),t.createElementBlock("div",{class:"m-breadcrumb",style:t.normalizeStyle(`height: ${r.height}px;`)},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.routes,((e,a)=>(t.openBlock(),t.createElementBlock("div",{class:"m-bread",key:a},[t.createElementVNode("a",{class:t.normalizeClass(["u-route",{active:a===l.len-1}]),onClick:t=>a===l.len-1?e=>e.preventDefault():l.goRouter(e),title:e.name},t.toDisplayString(e.name||"--"),11,v),a!==l.len-1?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[r.separator?(t.openBlock(),t.createElementBlock("span",b,t.toDisplayString(r.separator),1)):(t.openBlock(),t.createElementBlock("svg",N,B))],64)):t.createCommentVNode("",!0)])))),128)),y],4)}],["__scopeId","data-v-988f5a63"]]);E.install=e=>{e.component(E.name,E)};const V=[f,E],S={install:e=>{V.forEach((t=>e.component(t.name,t)))}};e.Breadcrumb=E,e.Pagination=f,e.default=S,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "vue-amazing-ui",
3
+ "version": "0.0.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/vue-amazing-ui.umd.cjs",
10
+ "module": "./dist/vue-amazing-ui.js",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/vue-amazing-ui.js",
14
+ "require": "./dist/vue-amazing-ui.umd.cjs"
15
+ }
16
+ },
17
+ "scripts": {
18
+ "dev": "vite --port 9000 --open --force",
19
+ "build": "run-p type-check build-only",
20
+ "preview": "vite preview",
21
+ "build-only": "vite build --watch",
22
+ "type-check": "vue-tsc --noEmit",
23
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
24
+ },
25
+ "dependencies": {
26
+ "vue": "^3.2.45"
27
+ },
28
+ "devDependencies": {
29
+ "@rushstack/eslint-patch": "^1.1.4",
30
+ "@types/node": "^18.11.12",
31
+ "@vitejs/plugin-vue": "^4.0.0",
32
+ "@vue/eslint-config-typescript": "^11.0.0",
33
+ "@vue/tsconfig": "^0.1.3",
34
+ "eslint": "^8.22.0",
35
+ "eslint-plugin-vue": "^9.3.0",
36
+ "less": "^4.1.3",
37
+ "npm-run-all": "^4.1.5",
38
+ "terser": "^5.16.4",
39
+ "typescript": "~4.7.4",
40
+ "vite": "^4.0.0",
41
+ "vue-tsc": "^1.0.12"
42
+ },
43
+ "description": "This template should help get you started developing with Vue 3 in Vite.",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "git+https://github.com/themusecatcher/vue-amazing-ui.git"
47
+ },
48
+ "keywords": [
49
+ "Vue3",
50
+ "TS",
51
+ "Vite",
52
+ "UI",
53
+ "components"
54
+ ],
55
+ "author": "theMuseCatcher",
56
+ "license": "ISC",
57
+ "bugs": {
58
+ "url": "https://github.com/themusecatcher/vue-amazing-ui/issues"
59
+ },
60
+ "homepage": "https://github.com/themusecatcher/vue-amazing-ui#readme"
61
+ }