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,459 @@
1
+ // @ts-nocheck
2
+ import Base from '../Base.js';
3
+
4
+ const stylesheet = `
5
+ :host {
6
+ --margin-right: 1rem;
7
+ --border-radius: 6px;
8
+ --border-size: 1px;
9
+ }
10
+
11
+ :host([href]) > a {
12
+ text-decoration: none;
13
+ }
14
+
15
+ :host-context(ea-button-group) {
16
+ --margin-right: 0;
17
+ --border-size: 0;
18
+ }
19
+
20
+ .__ea-button {
21
+ box-sizing: border-box;
22
+ padding: 0.5rem 1rem;
23
+ margin-right: var(--margin-right);
24
+ cursor: pointer;
25
+ font-size: 1rem;
26
+ line-height: 1.25;
27
+ font-weight: 500;
28
+ transition: background-color 0.1s, color 0.1s;
29
+ border-radius: var(--border-radius);
30
+ }
31
+ .__ea-button.normal {
32
+ border: var(--border-size) solid #dcdfe6;
33
+ color: #606266;
34
+ background-color: transparent;
35
+ /* ------- 按钮样式 ------- */
36
+ /* #region */
37
+ /* #endregion */
38
+ /* ------- end ------- */
39
+ /* ------- 按钮大小 ------- */
40
+ /* #region */
41
+ /* #endregion */
42
+ /* ------- end ------- */
43
+ }
44
+ .__ea-button.normal.disabled {
45
+ cursor: not-allowed !important;
46
+ background-image: none !important;
47
+ background-color: rgba(64, 64, 64, 0) !important;
48
+ border-color: white !important;
49
+ color: white !important;
50
+ pointer-events: none;
51
+ border-color: #ebedf1 !important;
52
+ color: #babcbe !important;
53
+ }
54
+ .__ea-button.normal.plain {
55
+ background-color: rgba(92, 92, 92, 0);
56
+ border: var(--border-size) solid white;
57
+ color: transparent;
58
+ background-color: transparent;
59
+ border: var(--border-size) solid #dcdfe6;
60
+ color: #606266;
61
+ }
62
+ .__ea-button.normal.plain:hover {
63
+ background-color: transparent;
64
+ }
65
+ .__ea-button.normal.round {
66
+ --border-radius: 999px;
67
+ }
68
+ .__ea-button.normal.medium {
69
+ font-size: 14px;
70
+ }
71
+ .__ea-button.normal.small {
72
+ font-size: 12px;
73
+ }
74
+ .__ea-button.normal.mini {
75
+ font-size: 10px;
76
+ }
77
+ .__ea-button.normal:hover {
78
+ border: var(--border-size) solid rgba(160, 207, 255, 0.4);
79
+ color: #3a9bff;
80
+ background-color: rgba(160, 207, 255, 0.05);
81
+ }
82
+ .__ea-button.normal:active {
83
+ background-color: rgba(7, 130, 255, 0.05);
84
+ border: var(--border-size) solid rgba(33, 143, 255, 0.4);
85
+ }
86
+ .__ea-button > i {
87
+ font-size: 1rem;
88
+ margin-right: 0.5rem;
89
+ }
90
+ .__ea-button.primary {
91
+ border: var(--border-size) solid #409eff;
92
+ color: #fff;
93
+ background-color: #409eff;
94
+ /* ------- 按钮样式 ------- */
95
+ /* #region */
96
+ /* #endregion */
97
+ /* ------- end ------- */
98
+ /* ------- 按钮大小 ------- */
99
+ /* #region */
100
+ /* #endregion */
101
+ /* ------- end ------- */
102
+ }
103
+ .__ea-button.primary.disabled {
104
+ cursor: not-allowed !important;
105
+ background-image: none !important;
106
+ background-color: #c0dfff !important;
107
+ border-color: #c0dfff !important;
108
+ color: white !important;
109
+ pointer-events: none;
110
+ }
111
+ .__ea-button.primary.plain {
112
+ background-color: #f8fbff;
113
+ border: var(--border-size) solid #c0dfff;
114
+ color: #409eff;
115
+ }
116
+ .__ea-button.primary.round {
117
+ --border-radius: 999px;
118
+ }
119
+ .__ea-button.primary.medium {
120
+ font-size: 14px;
121
+ }
122
+ .__ea-button.primary.small {
123
+ font-size: 12px;
124
+ }
125
+ .__ea-button.primary.mini {
126
+ font-size: 10px;
127
+ }
128
+ .__ea-button.primary:hover {
129
+ border: var(--border-size) solid #73b8ff;
130
+ color: white;
131
+ background-color: #73b8ff;
132
+ }
133
+ .__ea-button.primary:active {
134
+ background-color: #006bd9;
135
+ }
136
+ .__ea-button > i {
137
+ font-size: 1rem;
138
+ margin-right: 0.5rem;
139
+ }
140
+ .__ea-button.success {
141
+ border: var(--border-size) solid #67c23a;
142
+ color: #fff;
143
+ background-color: #67c23a;
144
+ /* ------- 按钮样式 ------- */
145
+ /* #region */
146
+ /* #endregion */
147
+ /* ------- end ------- */
148
+ /* ------- 按钮大小 ------- */
149
+ /* #region */
150
+ /* #endregion */
151
+ /* ------- end ------- */
152
+ }
153
+ .__ea-button.success.disabled {
154
+ cursor: not-allowed !important;
155
+ background-image: none !important;
156
+ background-color: #b2e19b !important;
157
+ border-color: #b2e19b !important;
158
+ color: white !important;
159
+ pointer-events: none;
160
+ }
161
+ .__ea-button.success.plain {
162
+ background-color: #d3eec6;
163
+ border: var(--border-size) solid #b2e19b;
164
+ color: #67c23a;
165
+ }
166
+ .__ea-button.success.round {
167
+ --border-radius: 999px;
168
+ }
169
+ .__ea-button.success.medium {
170
+ font-size: 14px;
171
+ }
172
+ .__ea-button.success.small {
173
+ font-size: 12px;
174
+ }
175
+ .__ea-button.success.mini {
176
+ font-size: 10px;
177
+ }
178
+ .__ea-button.success:hover {
179
+ border: var(--border-size) solid #85cf60;
180
+ color: white;
181
+ background-color: #85cf60;
182
+ }
183
+ .__ea-button.success:active {
184
+ background-color: #3d7323;
185
+ }
186
+ .__ea-button > i {
187
+ font-size: 1rem;
188
+ margin-right: 0.5rem;
189
+ }
190
+ .__ea-button.info {
191
+ border: var(--border-size) solid #909399;
192
+ color: #fff;
193
+ background-color: #909399;
194
+ /* ------- 按钮样式 ------- */
195
+ /* #region */
196
+ /* #endregion */
197
+ /* ------- end ------- */
198
+ /* ------- 按钮大小 ------- */
199
+ /* #region */
200
+ /* #endregion */
201
+ /* ------- end ------- */
202
+ }
203
+ .__ea-button.info.disabled {
204
+ cursor: not-allowed !important;
205
+ background-image: none !important;
206
+ background-color: #d2d4d6 !important;
207
+ border-color: #d2d4d6 !important;
208
+ color: white !important;
209
+ pointer-events: none;
210
+ }
211
+ .__ea-button.info.plain {
212
+ background-color: #f0f0f1;
213
+ border: var(--border-size) solid #d2d4d6;
214
+ color: #909399;
215
+ }
216
+ .__ea-button.info.round {
217
+ --border-radius: 999px;
218
+ }
219
+ .__ea-button.info.medium {
220
+ font-size: 14px;
221
+ }
222
+ .__ea-button.info.small {
223
+ font-size: 12px;
224
+ }
225
+ .__ea-button.info.mini {
226
+ font-size: 10px;
227
+ }
228
+ .__ea-button.info:hover {
229
+ border: var(--border-size) solid #abadb1;
230
+ color: white;
231
+ background-color: #abadb1;
232
+ }
233
+ .__ea-button.info:active {
234
+ background-color: #5d6066;
235
+ }
236
+ .__ea-button > i {
237
+ font-size: 1rem;
238
+ margin-right: 0.5rem;
239
+ }
240
+ .__ea-button.warning {
241
+ border: var(--border-size) solid #e6a23c;
242
+ color: #fff;
243
+ background-color: #e6a23c;
244
+ /* ------- 按钮样式 ------- */
245
+ /* #region */
246
+ /* #endregion */
247
+ /* ------- end ------- */
248
+ /* ------- 按钮大小 ------- */
249
+ /* #region */
250
+ /* #endregion */
251
+ /* ------- end ------- */
252
+ }
253
+ .__ea-button.warning.disabled {
254
+ cursor: not-allowed !important;
255
+ background-image: none !important;
256
+ background-color: #f4d8ad !important;
257
+ border-color: #f4d8ad !important;
258
+ color: white !important;
259
+ pointer-events: none;
260
+ }
261
+ .__ea-button.warning.plain {
262
+ background-color: #fbf0df;
263
+ border: var(--border-size) solid #f4d8ad;
264
+ color: #e6a23c;
265
+ }
266
+ .__ea-button.warning.round {
267
+ --border-radius: 999px;
268
+ }
269
+ .__ea-button.warning.medium {
270
+ font-size: 14px;
271
+ }
272
+ .__ea-button.warning.small {
273
+ font-size: 12px;
274
+ }
275
+ .__ea-button.warning.mini {
276
+ font-size: 10px;
277
+ }
278
+ .__ea-button.warning:hover {
279
+ border: var(--border-size) solid #ecb869;
280
+ color: white;
281
+ background-color: #ecb869;
282
+ }
283
+ .__ea-button.warning:active {
284
+ background-color: #a76d15;
285
+ }
286
+ .__ea-button > i {
287
+ font-size: 1rem;
288
+ margin-right: 0.5rem;
289
+ }
290
+ .__ea-button.danger {
291
+ border: var(--border-size) solid #f56c6c;
292
+ color: #fff;
293
+ background-color: #f56c6c;
294
+ /* ------- 按钮样式 ------- */
295
+ /* #region */
296
+ /* #endregion */
297
+ /* ------- end ------- */
298
+ /* ------- 按钮大小 ------- */
299
+ /* #region */
300
+ /* #endregion */
301
+ /* ------- end ------- */
302
+ }
303
+ .__ea-button.danger.disabled {
304
+ cursor: not-allowed !important;
305
+ background-image: none !important;
306
+ background-color: #fde3e3 !important;
307
+ border-color: #fde3e3 !important;
308
+ color: white !important;
309
+ pointer-events: none;
310
+ }
311
+ .__ea-button.danger.plain {
312
+ background-color: white;
313
+ border: var(--border-size) solid #fde3e3;
314
+ color: #f56c6c;
315
+ background-color: #fde8e8;
316
+ }
317
+ .__ea-button.danger.round {
318
+ --border-radius: 999px;
319
+ }
320
+ .__ea-button.danger.medium {
321
+ font-size: 14px;
322
+ }
323
+ .__ea-button.danger.small {
324
+ font-size: 12px;
325
+ }
326
+ .__ea-button.danger.mini {
327
+ font-size: 10px;
328
+ }
329
+ .__ea-button.danger:hover {
330
+ border: var(--border-size) solid #f89c9c;
331
+ color: white;
332
+ background-color: #f89c9c;
333
+ }
334
+ .__ea-button.danger:active {
335
+ background-color: #eb1010;
336
+ }
337
+ .__ea-button > i {
338
+ font-size: 1rem;
339
+ margin-right: 0.5rem;
340
+ }
341
+ .__ea-button.text {
342
+ border: var(--border-size) solid transparent;
343
+ color: #409eff;
344
+ background-color: transparent;
345
+ /* ------- 按钮样式 ------- */
346
+ /* #region */
347
+ /* #endregion */
348
+ /* ------- end ------- */
349
+ /* ------- 按钮大小 ------- */
350
+ /* #region */
351
+ /* #endregion */
352
+ /* ------- end ------- */
353
+ }
354
+ .__ea-button.text.disabled {
355
+ cursor: not-allowed !important;
356
+ background-image: none !important;
357
+ background-color: rgba(64, 64, 64, 0) !important;
358
+ border-color: rgba(64, 64, 64, 0) !important;
359
+ color: white !important;
360
+ pointer-events: none;
361
+ color: #c0c4cc !important;
362
+ }
363
+ .__ea-button.text.plain {
364
+ background-color: rgba(92, 92, 92, 0);
365
+ border: var(--border-size) solid rgba(64, 64, 64, 0);
366
+ color: transparent;
367
+ }
368
+ .__ea-button.text.round {
369
+ --border-radius: 999px;
370
+ }
371
+ .__ea-button.text.medium {
372
+ font-size: 14px;
373
+ }
374
+ .__ea-button.text.small {
375
+ font-size: 12px;
376
+ }
377
+ .__ea-button.text.mini {
378
+ font-size: 10px;
379
+ }
380
+ .__ea-button.text:hover {
381
+ border: var(--border-size) solid rgba(26, 26, 26, 0);
382
+ color: #73b8ff;
383
+ background-color: rgba(26, 26, 26, 0);
384
+ }
385
+ .__ea-button.text:active {
386
+ background-color: rgba(0, 0, 0, 0);
387
+ }
388
+ .__ea-button > i {
389
+ font-size: 1rem;
390
+ margin-right: 0.5rem;
391
+ }
392
+ .__ea-button.first-child {
393
+ border-radius: 4px 0 0 4px;
394
+ }
395
+ .__ea-button.middle-child {
396
+ border-radius: 0;
397
+ }
398
+ .__ea-button.last-child {
399
+ border-radius: 0 4px 4px 0;
400
+ }
401
+
402
+ .__ea-button-group {
403
+ display: flex;
404
+ align-items: center;
405
+ margin-right: 0.5rem;
406
+ }
407
+ .__ea-button-group ::slotted(ea-button:first-of-type) {
408
+ --border-radius: 4px 0 0 4px;
409
+ border-right: 1px solid rgba(255, 255, 255, 0.3);
410
+ }
411
+ .__ea-button-group ::slotted(ea-button:last-of-type) {
412
+ --border-radius: 0 4px 4px 0;
413
+ border-left: 1px solid rgba(255, 255, 255, 0.3);
414
+ }
415
+ .__ea-button-group ::slotted(ea-button) {
416
+ --margin-right: 0;
417
+ }
418
+ `;
419
+
420
+ export class EaButtonGroup extends Base {
421
+
422
+ constructor() {
423
+ super();
424
+
425
+ const shadowRoot = this.attachShadow({ mode: 'open' });
426
+
427
+ const dom = document.createElement('div');
428
+ shadowRoot.appendChild(dom);
429
+
430
+ const slot = document.createElement('slot');
431
+ dom.className = "__ea-button-group";
432
+ dom.appendChild(slot);
433
+
434
+ this.dom = dom;
435
+
436
+ this.build(shadowRoot, stylesheet);
437
+
438
+ shadowRoot.appendChild(dom);
439
+ }
440
+
441
+ // 指定各个按钮的样式
442
+ connectedCallback() {
443
+ Array.from(this.children).map((child, index, arr) => {
444
+ const button = !child.shadowRoot ? child : child.shadowRoot.querySelector('button');
445
+
446
+ if (index === 0) {
447
+ button.style.setProperty('--border-radius', '4px 0 0 4px');
448
+ } else if (index === arr.length - 1) {
449
+ button.style.setProperty('--border-radius', '0 4px 4px 0');
450
+ } else {
451
+ button.style.setProperty('--border-radius', '0');
452
+ }
453
+ })
454
+ }
455
+ }
456
+
457
+ if (!window.customElements.get("ea-button-group")) {
458
+ window.customElements.define("ea-button-group", EaButtonGroup);
459
+ }