easy-component-ui 0.0.2 → 1.0.3

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 (60) hide show
  1. package/components/Base.js +90 -0
  2. package/components/ea-alert/index.js +298 -0
  3. package/components/ea-avatar/index.js +277 -0
  4. package/components/ea-backtop/index.js +232 -0
  5. package/components/ea-badge/index.js +160 -0
  6. package/components/ea-button/index.js +584 -0
  7. package/components/ea-button-group/index.js +459 -0
  8. package/components/ea-calendar/index.js +409 -0
  9. package/components/ea-card/index.js +77 -0
  10. package/components/ea-carousel/index.js +434 -0
  11. package/components/ea-checkbox/index.js +314 -0
  12. package/components/ea-checkbox-group/index.js +107 -0
  13. package/components/ea-collapse/index.js +293 -0
  14. package/components/ea-descriptions/index.js +240 -0
  15. package/components/ea-descriptions-item/index.js +110 -0
  16. package/components/ea-empty/index.js +141 -0
  17. package/{icon → components/ea-icon}/config.json +1017 -1017
  18. package/{icon → components/ea-icon}/css/animation.css +85 -85
  19. package/{icon → components/ea-icon}/css/fontello.css +224 -224
  20. package/components/ea-icon/font/fontello.svg +683 -0
  21. package/components/ea-icon/index.css +2 -0
  22. package/components/ea-icon/index.js +47 -0
  23. package/components/ea-image/index.js +412 -0
  24. package/components/ea-infinite-scroll/index.js +170 -0
  25. package/components/ea-input/index.js +765 -0
  26. package/components/ea-input-number/index.js +458 -0
  27. package/components/ea-link/index.js +200 -0
  28. package/components/ea-loading/index.js +218 -0
  29. package/components/ea-message/MessageClass.js +71 -0
  30. package/components/ea-message/index.js +233 -0
  31. package/components/ea-message-box/EaMessageBoxClass.js +48 -0
  32. package/components/ea-message-box/index.js +202 -0
  33. package/components/ea-pagination/index.js +444 -0
  34. package/components/ea-progress/index.js +333 -0
  35. package/components/ea-radio/index.js +287 -0
  36. package/components/ea-radio-group/index.js +59 -0
  37. package/components/ea-rate/index.js +326 -0
  38. package/components/ea-result/index.js +167 -0
  39. package/components/ea-select/index.js +34 -0
  40. package/components/ea-skeleton/index.js +341 -0
  41. package/components/ea-switch/index.js +301 -0
  42. package/components/ea-tag/index.js +212 -0
  43. package/components/ea-textarea/index.js +333 -0
  44. package/components/ea-timeline/index.js +334 -0
  45. package/components/ea-ui-base-style.css +0 -0
  46. package/package.json +1 -1
  47. package/utils/createElement.js +30 -0
  48. package/utils/handleTemplate.js +19 -0
  49. package/utils/setStyle.js +8 -0
  50. package/icon/font/fontello.svg +0 -346
  51. package/icon/index.css +0 -2
  52. package/index.js +0 -1693
  53. /package/{icon → components/ea-icon}/css/fontello-codes.css +0 -0
  54. /package/{icon → components/ea-icon}/css/fontello-embedded.css +0 -0
  55. /package/{icon → components/ea-icon}/css/fontello-ie7-codes.css +0 -0
  56. /package/{icon → components/ea-icon}/css/fontello-ie7.css +0 -0
  57. /package/{icon → components/ea-icon}/font/fontello.eot +0 -0
  58. /package/{icon → components/ea-icon}/font/fontello.ttf +0 -0
  59. /package/{icon → components/ea-icon}/font/fontello.woff +0 -0
  60. /package/{icon → components/ea-icon}/font/fontello.woff2 +0 -0
@@ -0,0 +1,202 @@
1
+ // @ts-nocheck
2
+ import Base from '../Base.js';
3
+ import { createElement } from "../../utils/createElement.js"
4
+
5
+ const stylesheet = `
6
+ .ea-dialog_wrap {
7
+ position: fixed;
8
+ top: 0;
9
+ left: 0;
10
+ width: 100%;
11
+ height: 100%;
12
+ background-color: rgba(0, 0, 0, 0.5);
13
+ z-index: 2024;
14
+ }
15
+ .ea-dialog_wrap .ea-dialog_board {
16
+ position: absolute;
17
+ left: 50%;
18
+ top: 50%;
19
+ transform: translate(-50%, -50%);
20
+ background-color: aliceblue;
21
+ width: 420px;
22
+ padding-bottom: 10px;
23
+ border-radius: 4px;
24
+ border: 1px solid #ebeef5;
25
+ box-sizing: 0 2px 12px 0;
26
+ font-size: 18px;
27
+ text-align: left;
28
+ overflow: hidden;
29
+ backface-visibility: hidden;
30
+ }
31
+ .ea-dialog_wrap .ea-dialog_board .ea-dialog_header {
32
+ padding: 15px 15px 10px;
33
+ display: flex;
34
+ justify-content: space-between;
35
+ align-items: center;
36
+ }
37
+ .ea-dialog_wrap .ea-dialog_board .ea-dialog_header .ea-dialog_header-title {
38
+ font-size: 18px;
39
+ line-height: 1;
40
+ color: #303133;
41
+ }
42
+ .ea-dialog_wrap .ea-dialog_board .ea-dialog_header .ea-dialog_header-close {
43
+ display: inline-block;
44
+ font-size: 16px;
45
+ color: #909399;
46
+ cursor: pointer;
47
+ }
48
+ .ea-dialog_wrap .ea-dialog_board .ea-dialog_content {
49
+ padding: 10px 15px;
50
+ color: #606266;
51
+ font-size: 14px;
52
+ }
53
+ .ea-dialog_wrap .ea-dialog_board .ea-dialog_footer {
54
+ padding: 5px 15px 0;
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: flex-end;
58
+ }
59
+ .ea-dialog_wrap .ea-dialog_board .ea-dialog_footer :first-child {
60
+ margin-right: 0.5rem;
61
+ }
62
+ `;
63
+
64
+ export class EaMessageBoxElement extends Base {
65
+ #wrap;
66
+
67
+ #headerWrap;
68
+ #contentWrap;
69
+ #footerWrap;
70
+
71
+ #confirmButton;
72
+ #cancelButton;
73
+
74
+ constructor() {
75
+ super();
76
+
77
+ const shadowRoot = this.attachShadow({ mode: 'open' });
78
+ const wrap = document.createElement('div');
79
+ wrap.className = 'ea-dialog_wrap';
80
+ wrap.role = 'dialog';
81
+
82
+ const headerTitle = createElement('span', 'ea-dialog_header-title');
83
+ const headerClose = createElement('i', 'ea-dialog_header-close icon-cancel');
84
+ headerClose.addEventListener('click', () => {
85
+ this.dispatchEvent(new CustomEvent('cancel'));
86
+ });
87
+ const header = createElement('div', 'ea-dialog_header', [headerTitle, headerClose]);
88
+
89
+ const content = createElement('div', 'ea-dialog_content');
90
+
91
+ const confirmButton = createElement('div', 'ea-dialog_footer-confirm-button');
92
+ const cancelButton = createElement('div', 'ea-dialog_footer-cancel-button');
93
+ const footer = createElement('div', 'ea-dialog_footer', [cancelButton, confirmButton]);
94
+
95
+ const board = createElement('div', 'ea-dialog_board', [header, content, footer]);
96
+ wrap.appendChild(board);
97
+
98
+ this.#wrap = wrap;
99
+ this.#headerWrap = headerTitle;
100
+ this.#contentWrap = content;
101
+ this.#footerWrap = footer;
102
+
103
+ this.#confirmButton = confirmButton;
104
+ this.#cancelButton = cancelButton;
105
+
106
+ this.build(shadowRoot, stylesheet);
107
+ this.shadowRoot.appendChild(wrap);
108
+ }
109
+
110
+ // ------- open 是否显示 -------
111
+ // #region
112
+ get open() {
113
+ return this.getAttrBoolean('open');
114
+ }
115
+
116
+ set open(flag) {
117
+ this.toggleAttr('open', flag);
118
+ this.#wrap.style.display = flag ? 'block' : 'none';
119
+ }
120
+ // #endregion
121
+ // ------- end -------
122
+
123
+ // ------- content 文字区域 -------
124
+ // #region
125
+ get content() {
126
+ return this.getAttribute('content');
127
+ }
128
+
129
+ set content(content) {
130
+ this.#contentWrap.innerHTML = content;
131
+ }
132
+ // #endregion
133
+ // ------- end -------
134
+
135
+ // ------- title 标题 -------
136
+ // #region
137
+ get title() {
138
+ return this.getAttribute('title');
139
+ }
140
+
141
+ set title(title) {
142
+ this.#headerWrap.innerHTML = title;
143
+ }
144
+ // #endregion
145
+ // ------- end -------
146
+
147
+ // ------- confirmButtonText 确认按钮文本 -------
148
+ // #region
149
+ get confirmButtonText() {
150
+ return this.getAttribute('confirmButtonText');
151
+ }
152
+
153
+ set confirmButtonText(val) {
154
+ const that = this;
155
+ this.setAttribute('confirmButtonText', val);
156
+
157
+ if (val || val !== '') {
158
+ this.#confirmButton.innerHTML = `<ea-button size="medium" type="primary">${val}</ea-button>`;
159
+
160
+ this.#confirmButton.addEventListener('click', () => {
161
+ that.dispatchEvent(new CustomEvent('confirm'));
162
+ });
163
+ }
164
+ }
165
+ // #endregion
166
+ // ------- end -------
167
+
168
+ // ------- cancelButtonText 取消按钮文本 -------
169
+ // #region
170
+ get cancelButtonText() {
171
+ return this.getAttribute('cancelButtonText');
172
+ }
173
+
174
+ set cancelButtonText(val) {
175
+ const that = this;
176
+ this.setAttribute('cancelButtonText', val);
177
+
178
+ if (val || val !== '') {
179
+ this.#cancelButton.innerHTML = `<ea-button size="medium">${val}</ea-button>`;
180
+
181
+ this.#cancelButton.addEventListener('click', () => {
182
+ that.dispatchEvent(new CustomEvent('cancel'));
183
+ });
184
+ }
185
+ }
186
+ // #endregion
187
+ // ------- end -------
188
+
189
+ init() {
190
+ const that = this;
191
+
192
+ this
193
+ }
194
+
195
+ connectedCallback() {
196
+ this.init();
197
+ }
198
+ }
199
+
200
+ if (!customElements.get('ea-message-box')) {
201
+ customElements.define('ea-message-box', EaMessageBoxElement);
202
+ }
@@ -0,0 +1,444 @@
1
+ // @ts-nocheck
2
+ import Base from '../Base.js';
3
+
4
+ const stylesheet = `
5
+ .ea-pagination_wrap {
6
+ display: flex;
7
+ align-items: center;
8
+ font-size: 0.9rem;
9
+ }
10
+ .ea-pagination_wrap .ea-pagination_item_wrap {
11
+ display: flex;
12
+ align-items: center;
13
+ }
14
+ .ea-pagination_wrap .ea-pagination_item_wrap .ea-pagination_item,
15
+ .ea-pagination_wrap .ea-pagination_item_wrap .ea-pagination_more {
16
+ cursor: pointer;
17
+ box-sizing: border-box;
18
+ margin: 0 5px;
19
+ padding: 0 4px;
20
+ min-width: 30px;
21
+ height: 28px;
22
+ line-height: 28px;
23
+ font-size: 13px;
24
+ text-align: center;
25
+ }
26
+ .ea-pagination_wrap .ea-pagination_item_wrap .ea-pagination_item.ea-pagination_item--active {
27
+ color: #409eff;
28
+ }
29
+ .ea-pagination_wrap .ea-pagination_item_wrap .ea-pagination_more {
30
+ cursor: pointer;
31
+ user-select: none;
32
+ }
33
+ .ea-pagination_wrap .ea-pagination_item_wrap .ea-pagination_more.ea-pagination_more--active {
34
+ color: #409eff;
35
+ }
36
+ .ea-pagination_wrap .ea-pagination_arrow {
37
+ user-select: none;
38
+ cursor: pointer;
39
+ padding: 0 10px;
40
+ }
41
+ .ea-pagination_wrap .ea-pagination_arrow.disabled {
42
+ cursor: default;
43
+ pointer-events: none;
44
+ color: #c0c4cc;
45
+ }
46
+ .ea-pagination_wrap .ea-pagination_arrow:first-child {
47
+ margin-right: 0.25rem;
48
+ }
49
+ .ea-pagination_wrap .ea-pagination_arrow:last-child {
50
+ margin-left: 0.25rem;
51
+ }
52
+ .ea-pagination_wrap .ea-pagination_item.background,
53
+ .ea-pagination_wrap .ea-pagination_more.background,
54
+ .ea-pagination_wrap .ea-pagination_arrow.background {
55
+ background-color: #f4f4f5;
56
+ border-radius: 3px;
57
+ }
58
+ .ea-pagination_wrap .ea-pagination_item.background:hover,
59
+ .ea-pagination_wrap .ea-pagination_more.background:hover,
60
+ .ea-pagination_wrap .ea-pagination_arrow.background:hover {
61
+ color: #409eff;
62
+ }
63
+ .ea-pagination_wrap .ea-pagination_item.background.active,
64
+ .ea-pagination_wrap .ea-pagination_more.background.active,
65
+ .ea-pagination_wrap .ea-pagination_arrow.background.active {
66
+ background-color: #409eff;
67
+ color: #f4f4f5;
68
+ }
69
+ .ea-pagination_wrap .ea-pagination_show_total {
70
+ margin-right: 0.5rem;
71
+ font-size: 13px;
72
+ }
73
+ `;
74
+
75
+
76
+ const getPaginationWrap = () => {
77
+ const paginationWrap = document.createElement('div');
78
+ paginationWrap.className = 'ea-pagination_item_wrap';
79
+
80
+ return paginationWrap;
81
+ }
82
+
83
+ const getPageItem = (page, hasBgc) => {
84
+ const pageItem = document.createElement('span');
85
+ pageItem.className = 'ea-pagination_item';
86
+ pageItem.innerText = page;
87
+ pageItem.setAttribute('data-page', page);
88
+
89
+ if (hasBgc) pageItem.classList.add('background');
90
+
91
+ return pageItem;
92
+ };
93
+
94
+ const getArrowItem = (arrow, hasBgc) => {
95
+ const arrowItem = document.createElement('span');
96
+ arrowItem.className = 'ea-pagination_arrow';
97
+ arrowItem.innerHTML = arrow === "prev" ? '&lt;' : '&gt;';
98
+
99
+ if (hasBgc) arrowItem.classList.add('background');
100
+
101
+ return arrowItem;
102
+ }
103
+
104
+ const getMoreItem = (arrow, hasBgc) => {
105
+ const moreItem = document.createElement('span');
106
+ moreItem.className = 'ea-pagination_more';
107
+ moreItem.innerHTML = '···';
108
+
109
+ if (hasBgc) moreItem.classList.add('background');
110
+
111
+ moreItem.addEventListener('mouseenter', function (e) {
112
+ moreItem.classList.add('ea-pagination_more--active');
113
+ moreItem.innerHTML = arrow === "prev" ? '&lt;&lt;' : '&gt;&gt;';
114
+ })
115
+
116
+ moreItem.addEventListener('mouseleave', function (e) {
117
+ moreItem.classList.remove('ea-pagination_more--active');
118
+ moreItem.innerHTML = '···';
119
+ })
120
+
121
+ return moreItem;
122
+ }
123
+
124
+ const getShowTotalItem = () => {
125
+ const showTotalItem = document.createElement('span');
126
+ showTotalItem.className = 'ea-pagination_show_total';
127
+
128
+ return showTotalItem;
129
+ }
130
+
131
+ export class EaPagination extends Base {
132
+ #container;
133
+
134
+ // 页码元素的容器
135
+ #paginationWrap;
136
+
137
+ // 箭头
138
+ #prevArrow;
139
+ #nextArrow;
140
+
141
+ constructor() {
142
+ super();
143
+
144
+ const shadowRoot = this.attachShadow({ mode: 'open' });
145
+ const wrap = document.createElement('div');
146
+ wrap.className = 'ea-pagination_wrap';
147
+
148
+ this.#container = wrap;
149
+
150
+ const prevArrow = getArrowItem('prev', this.background);
151
+ const pageItemWrap = getPaginationWrap();
152
+ const nextArrow = getArrowItem('next', this.background);
153
+
154
+ this.#container.appendChild(prevArrow);
155
+ this.#container.appendChild(pageItemWrap);
156
+ this.#container.appendChild(nextArrow);
157
+
158
+ this.#prevArrow = prevArrow;
159
+ this.#paginationWrap = pageItemWrap;
160
+ this.#nextArrow = nextArrow;
161
+
162
+ this.build(shadowRoot, stylesheet);
163
+ this.shadowRoot.appendChild(wrap);
164
+ }
165
+
166
+ // ------- layout 布局(前一页, 页码, 后一页) -------
167
+ // #region
168
+ get layout() {
169
+ const arr = this.getAttribute('layout').split(',').map(item => item.trim());
170
+
171
+ return arr || ['prev', 'pager', 'next'];
172
+ }
173
+
174
+ set layout(value) {
175
+ this.setAttribute('layout', value);
176
+ }
177
+ // #endregion
178
+ // ------- end -------
179
+
180
+ // ------- sizes 分页中每页多少记录 -------
181
+ // #region
182
+ get sizes() {
183
+ return this.getAttrNumber('sizes') || 10;
184
+ }
185
+
186
+ set sizes(value) {
187
+ this.setAttribute('sizes', value);
188
+ }
189
+ // #endregion
190
+ // ------- end -------
191
+
192
+ // ------- current-page 当前页码 -------
193
+ // #region
194
+ get currentPage() {
195
+ return this.getAttrNumber('current-page') || 1;
196
+ }
197
+
198
+ set currentPage(value) {
199
+ this.setAttribute('current-page', value);
200
+ }
201
+ // #endregion
202
+ // ------- end -------
203
+
204
+ // ------- page-count 总显示的页码数量 -------
205
+ // #region
206
+ get pageCount() {
207
+ return this.getAttrNumber('page-count') || 6;
208
+ }
209
+
210
+ set pageCount(value) {
211
+ this.setAttribute('page-count', value);
212
+ }
213
+ // #endregion
214
+ // ------- end -------
215
+
216
+ // ------- total 总记录数 -------
217
+ // #region
218
+
219
+ get total() {
220
+ return this.getAttrNumber('total');
221
+ }
222
+
223
+ set total(value) {
224
+ this.setAttribute('total', value);
225
+ }
226
+ // #endregion
227
+ // ------- end -------
228
+
229
+ // ------- paginationCount 分页总数 -------
230
+ // #region
231
+ get paginationCount() {
232
+ return Math.ceil(this.total / this.sizes);
233
+ }
234
+ // #endregion
235
+ // ------- end -------
236
+
237
+ // ------- background 背景颜色 -------
238
+ // #region
239
+ get background() {
240
+ return this.getAttrBoolean('background');
241
+ }
242
+
243
+ set background(value) {
244
+ this.setAttribute('background', value);
245
+ }
246
+ // #endregion
247
+ // ------- end -------
248
+
249
+ handleDispatchEvent(event, options) {
250
+ this.dispatchEvent(new CustomEvent(event, options));
251
+ }
252
+
253
+ // 初始化箭头元素
254
+ initArrowItem() {
255
+ const that = this;
256
+
257
+ this.handleArrowStatus();
258
+
259
+ if (this.layout.includes('prev')) {
260
+ this.#prevArrow.addEventListener('click', () => {
261
+ if (that.currentPage <= 1) return;
262
+
263
+ that.currentPage--;
264
+ that.handlePaginationChange();
265
+
266
+ that.handleDispatchEvent("change", { detail: { currentPage: that.currentPage } });
267
+ })
268
+ } else {
269
+ this.#prevArrow.style.display = 'none';
270
+ }
271
+
272
+ if (this.layout.includes('next')) {
273
+ this.#nextArrow.addEventListener('click', () => {
274
+ if (that.currentPage >= that.paginationCount) return;
275
+
276
+ that.currentPage++;
277
+ that.handlePaginationChange();
278
+
279
+ that.handleDispatchEvent("change", { detail: { currentPage: that.currentPage } });
280
+ })
281
+ } else {
282
+ this.#nextArrow.style.display = 'none';
283
+ }
284
+ }
285
+
286
+ // 处理箭头状态
287
+ handleArrowStatus() {
288
+ if (!this.layout.includes('prev') && !this.layout.includes('next')) return;
289
+
290
+ if (this.currentPage === 1 && this.layout.includes('prev')) this.#prevArrow.classList.add('disabled');
291
+ else if (this.currentPage >= this.paginationCount && this.layout.includes('next')) this.#nextArrow.classList.add('disabled');
292
+ else {
293
+ this.#prevArrow.classList.remove('disabled');
294
+ this.#nextArrow.classList.remove('disabled');
295
+ }
296
+ }
297
+
298
+ // 处理分页点击事件
299
+ handlePaginationClick(pageItem, index) {
300
+ const that = this;
301
+
302
+ pageItem.addEventListener('click', function (e) {
303
+ that.currentPage = index;
304
+ that.handlePaginationChange();
305
+
306
+ that.handleDispatchEvent('change', {
307
+ detail: {
308
+ currentPage: that.currentPage
309
+ }
310
+ });
311
+ })
312
+ }
313
+
314
+ // 处理更多按钮点击事件
315
+ handleMoreItemClick(moreItem, arrow) {
316
+ const that = this;
317
+
318
+ moreItem.addEventListener('click', function (e) {
319
+
320
+ // 跳转到指定页码
321
+ that.currentPage += arrow === "prev" ? -5 : 5;
322
+
323
+ /**
324
+ * 边界处理:
325
+ * 页码数量小于1, 跳转到第一页
326
+ * 页码数量大于总页数, 跳转到最后一页
327
+ */
328
+ if (that.currentPage < 1) that.currentPage = 1;
329
+ else if (that.currentPage > that.paginationCount) that.currentPage = that.paginationCount;
330
+
331
+ that.handlePaginationChange();
332
+
333
+ that.handleDispatchEvent('change', {
334
+ detail: {
335
+ currentPage: that.currentPage
336
+ }
337
+ });
338
+ })
339
+ }
340
+
341
+ // 处理分页的页码
342
+ handlePaginationItemChange() {
343
+ const that = this;
344
+
345
+ if (!this.layout.includes('pager')) return;
346
+
347
+ this.#paginationWrap.innerHTML = '';
348
+
349
+ const interval = Math.floor(this.pageCount / 2);
350
+ let start = this.currentPage - interval;
351
+ let end = this.currentPage + interval;
352
+
353
+ // 边界处理
354
+ if (start <= 1) {
355
+ start = 1;
356
+ end = this.pageCount < this.paginationCount ? this.pageCount : this.paginationCount;
357
+ } else if (end >= this.paginationCount) {
358
+ start = this.paginationCount - this.pageCount + 1;
359
+ end = this.paginationCount;
360
+ } else {
361
+ end--;
362
+ }
363
+
364
+ // 添加页码
365
+ for (let i = start; i <= end; i++) {
366
+ const pageItem = getPageItem(i, this.background);
367
+ this.#paginationWrap.appendChild(pageItem);
368
+
369
+ // 设置当前页码选中后的样式
370
+ if (i === this.currentPage) {
371
+ pageItem.classList.add('ea-pagination_item--active');
372
+ if (this.background) pageItem.classList.add('active');
373
+ }
374
+
375
+ // 添加点击事件
376
+ that.handlePaginationClick(pageItem, i);
377
+ }
378
+
379
+ // 添加 更多(左) + 第一页
380
+ if (this.total > this.pageCount && this.currentPage >= this.pageCount && this.paginationCount !== this.pageCount) {
381
+ const more = getMoreItem('prev', this.background);
382
+ that.handleMoreItemClick(more, 'prev');
383
+
384
+ const firstPage = getPageItem(1, this.background);
385
+ this.handlePaginationClick(firstPage, 1);
386
+
387
+ this.#paginationWrap.insertBefore(more, this.#paginationWrap.firstChild);
388
+ this.#paginationWrap.insertBefore(firstPage, this.#paginationWrap.firstChild);
389
+ }
390
+
391
+ // 添加 更多(右) + 最后一页
392
+ if (this.total > this.pageCount && this.currentPage < this.paginationCount - interval && this.paginationCount !== this.pageCount) {
393
+ const more = getMoreItem('next', this.background);
394
+ that.handleMoreItemClick(more, 'next');
395
+
396
+ const lastPage = getPageItem(this.paginationCount, this.background);
397
+ this.handlePaginationClick(lastPage, this.paginationCount);
398
+
399
+ this.#paginationWrap.appendChild(more);
400
+ this.#paginationWrap.appendChild(lastPage);
401
+ }
402
+ }
403
+
404
+ // 处理分页变化
405
+ handlePaginationChange() {
406
+ this.handleArrowStatus();
407
+ this.handlePaginationItemChange();
408
+ }
409
+
410
+ // 处理显示总数
411
+ initTotalShow() {
412
+ if (!this.layout.includes('total')) return;
413
+
414
+ const totalItem = getShowTotalItem();
415
+ totalItem.innerHTML = `共 ${this.total} 条`;
416
+
417
+ this.#container.insertBefore(totalItem, this.#container.firstChild);
418
+ }
419
+
420
+ init() {
421
+ const that = this;
422
+
423
+ // 设置sizes
424
+ this.sizes = this.sizes;
425
+
426
+ // 设置current-page
427
+ this.currentPage = this.currentPage;
428
+
429
+ // 设置total
430
+ this.total = this.total;
431
+
432
+ this.initArrowItem();
433
+ this.handlePaginationItemChange();
434
+ this.initTotalShow();
435
+ }
436
+
437
+ connectedCallback() {
438
+ this.init();
439
+ }
440
+ }
441
+
442
+ if (!customElements.get('ea-pagination')) {
443
+ customElements.define('ea-pagination', EaPagination);
444
+ }