easy-component-ui 0.0.1 → 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.
- package/components/Base.js +90 -0
- package/components/ea-alert/index.js +298 -0
- package/components/ea-avatar/index.js +277 -0
- package/components/ea-backtop/index.js +232 -0
- package/components/ea-badge/index.js +160 -0
- package/components/ea-button/index.js +584 -0
- package/components/ea-button-group/index.js +459 -0
- package/components/ea-calendar/index.js +409 -0
- package/components/ea-card/index.js +77 -0
- package/components/ea-carousel/index.js +434 -0
- package/components/ea-checkbox/index.js +314 -0
- package/components/ea-checkbox-group/index.js +107 -0
- package/components/ea-collapse/index.js +293 -0
- package/components/ea-descriptions/index.js +240 -0
- package/components/ea-descriptions-item/index.js +110 -0
- package/components/ea-empty/index.js +141 -0
- package/{icon → components/ea-icon}/config.json +1017 -1017
- package/{icon → components/ea-icon}/css/animation.css +85 -85
- package/{icon → components/ea-icon}/css/fontello.css +224 -224
- package/components/ea-icon/font/fontello.svg +683 -0
- package/components/ea-icon/index.css +2 -0
- package/components/ea-icon/index.js +47 -0
- package/components/ea-image/index.js +412 -0
- package/components/ea-infinite-scroll/index.js +170 -0
- package/components/ea-input/index.js +765 -0
- package/components/ea-input-number/index.js +458 -0
- package/components/ea-link/index.js +200 -0
- package/components/ea-loading/index.js +218 -0
- package/components/ea-message/MessageClass.js +71 -0
- package/components/ea-message/index.js +233 -0
- package/components/ea-message-box/EaMessageBoxClass.js +48 -0
- package/components/ea-message-box/index.js +202 -0
- package/components/ea-pagination/index.js +444 -0
- package/components/ea-progress/index.js +333 -0
- package/components/ea-radio/index.js +287 -0
- package/components/ea-radio-group/index.js +59 -0
- package/components/ea-rate/index.js +326 -0
- package/components/ea-result/index.js +167 -0
- package/components/ea-select/index.js +34 -0
- package/components/ea-skeleton/index.js +341 -0
- package/components/ea-switch/index.js +301 -0
- package/components/ea-tag/index.js +212 -0
- package/components/ea-textarea/index.js +333 -0
- package/components/ea-timeline/index.js +334 -0
- package/components/ea-ui-base-style.css +0 -0
- package/package.json +1 -1
- package/utils/createElement.js +30 -0
- package/utils/handleTemplate.js +19 -0
- package/utils/setStyle.js +8 -0
- package/icon/font/fontello.svg +0 -346
- package/icon/index.css +0 -2
- package/index.js +0 -1693
- /package/{icon → components/ea-icon}/css/fontello-codes.css +0 -0
- /package/{icon → components/ea-icon}/css/fontello-embedded.css +0 -0
- /package/{icon → components/ea-icon}/css/fontello-ie7-codes.css +0 -0
- /package/{icon → components/ea-icon}/css/fontello-ie7.css +0 -0
- /package/{icon → components/ea-icon}/font/fontello.eot +0 -0
- /package/{icon → components/ea-icon}/font/fontello.ttf +0 -0
- /package/{icon → components/ea-icon}/font/fontello.woff +0 -0
- /package/{icon → components/ea-icon}/font/fontello.woff2 +0 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import Base from '../Base.js';
|
|
3
|
+
|
|
4
|
+
const stylesheet = `
|
|
5
|
+
.ea-descriptions_wrap {
|
|
6
|
+
font-size: 14px;
|
|
7
|
+
}
|
|
8
|
+
.ea-descriptions_wrap .ea-descriptions_header {
|
|
9
|
+
font-size: 1rem;
|
|
10
|
+
font-weight: 700;
|
|
11
|
+
margin-bottom: 20px;
|
|
12
|
+
}
|
|
13
|
+
.ea-descriptions_wrap .ea-descriptions_body table {
|
|
14
|
+
width: 100%;
|
|
15
|
+
border-collapse: collapse;
|
|
16
|
+
table-layout: fixed;
|
|
17
|
+
}
|
|
18
|
+
.ea-descriptions_wrap .ea-descriptions_body table th {
|
|
19
|
+
background-color: #fafafa;
|
|
20
|
+
}
|
|
21
|
+
.ea-descriptions_wrap .ea-descriptions_body table td {
|
|
22
|
+
vertical-align: baseline;
|
|
23
|
+
}
|
|
24
|
+
.ea-descriptions_wrap .ea-descriptions-item_label,
|
|
25
|
+
.ea-descriptions_wrap .ea-descriptions-item_content {
|
|
26
|
+
font-weight: normal;
|
|
27
|
+
font-size: 14px;
|
|
28
|
+
vertical-align: middle;
|
|
29
|
+
}
|
|
30
|
+
.ea-descriptions_wrap .ea-descriptions-item_label.is-border,
|
|
31
|
+
.ea-descriptions_wrap .ea-descriptions-item_content.is-border {
|
|
32
|
+
border: 1px solid #ebeef5;
|
|
33
|
+
}
|
|
34
|
+
.ea-descriptions_wrap .ea-descriptions-item_cell {
|
|
35
|
+
text-align: left;
|
|
36
|
+
padding: 12px 10px;
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
const getThTemplate_normal = (label, content, colspan) => {
|
|
41
|
+
return `
|
|
42
|
+
<td class="ea-descriptions-item" colspan="${colspan}">
|
|
43
|
+
<span class="ea-descriptions-item_label">${label}:</span>
|
|
44
|
+
<span class="ea-descriptions-item_content">${content}</span>
|
|
45
|
+
</td>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const getTdTemplate_border = (label, content, colspan) => {
|
|
50
|
+
return `
|
|
51
|
+
<th class="ea-descriptions-item_label ea-descriptions-item_cell is-border" colspan="${1}">${label}</th>
|
|
52
|
+
<td class="ea-descriptions-item_content ea-descriptions-item_cell is-border" colspan="${colspan}">${content}</td>
|
|
53
|
+
`
|
|
54
|
+
}
|
|
55
|
+
const getThTemplate_direction = (label, hasBorder) => {
|
|
56
|
+
return `
|
|
57
|
+
<th class="ea-descriptions-item_label ea-descriptions-item_cell ${hasBorder ? 'is-border' : ''}" colspan="${1}">
|
|
58
|
+
${label}${hasBorder ? '' : ':'}
|
|
59
|
+
</th>`
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const getTdTemplate_direction = (text, hasBorder, colspan) => {
|
|
63
|
+
return `
|
|
64
|
+
<td class="ea-descriptions-item_content ea-descriptions-item_cell ${hasBorder ? 'is-border' : ''}" colspan="${colspan}">
|
|
65
|
+
${text}
|
|
66
|
+
</td>`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const contentTemplate = (item, colspan, hasBorder) => {
|
|
70
|
+
let label = item.getAttribute("label");
|
|
71
|
+
let content = item.innerHTML;
|
|
72
|
+
|
|
73
|
+
if (!label) label = item.querySelector('[slot="label"]')?.innerHTML || "";
|
|
74
|
+
|
|
75
|
+
return hasBorder ? getTdTemplate_border(label, content, colspan) : getThTemplate_normal(label, content, colspan);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export class EaDescriptions extends Base {
|
|
79
|
+
#wrap;
|
|
80
|
+
|
|
81
|
+
#table;
|
|
82
|
+
#tableHeader;
|
|
83
|
+
#tableBody;
|
|
84
|
+
|
|
85
|
+
#slot;
|
|
86
|
+
|
|
87
|
+
constructor() {
|
|
88
|
+
super();
|
|
89
|
+
|
|
90
|
+
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
91
|
+
const wrap = document.createElement('div');
|
|
92
|
+
wrap.className = 'ea-descriptions_wrap';
|
|
93
|
+
|
|
94
|
+
const header = document.createElement('div');
|
|
95
|
+
header.className = 'ea-descriptions_header';
|
|
96
|
+
wrap.appendChild(header);
|
|
97
|
+
|
|
98
|
+
const body = document.createElement('div');
|
|
99
|
+
const table = document.createElement('table');
|
|
100
|
+
const thead = document.createElement('thead');
|
|
101
|
+
|
|
102
|
+
const slot = document.createElement('slot');
|
|
103
|
+
body.className = 'ea-descriptions_body';
|
|
104
|
+
body.appendChild(table);
|
|
105
|
+
table.appendChild(thead);
|
|
106
|
+
wrap.appendChild(body);
|
|
107
|
+
|
|
108
|
+
this.#wrap = wrap;
|
|
109
|
+
this.#table = table;
|
|
110
|
+
this.#tableHeader = header;
|
|
111
|
+
this.#slot = slot;
|
|
112
|
+
|
|
113
|
+
this.build(shadowRoot, stylesheet);
|
|
114
|
+
this.shadowRoot.appendChild(wrap);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ------- title 设置标题 -------
|
|
118
|
+
// #region
|
|
119
|
+
get title() {
|
|
120
|
+
return this.getAttribute('title') || "";
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
set title(value) {
|
|
124
|
+
this.setAttribute('title', value);
|
|
125
|
+
|
|
126
|
+
this.#tableHeader.innerHTML = value;
|
|
127
|
+
}
|
|
128
|
+
// #endregion
|
|
129
|
+
// ------- end -------
|
|
130
|
+
|
|
131
|
+
// ------- col 一行显示多少个item -------
|
|
132
|
+
// #region
|
|
133
|
+
get col() {
|
|
134
|
+
return this.getAttrNumber('col') || 3;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
set col(value) {
|
|
138
|
+
this.setAttribute('col', value);
|
|
139
|
+
}
|
|
140
|
+
// #endregion
|
|
141
|
+
// ------- end -------
|
|
142
|
+
|
|
143
|
+
// ------- border 是否显示边框 -------
|
|
144
|
+
// #region
|
|
145
|
+
get border() {
|
|
146
|
+
return this.getAttrBoolean('border');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
set border(value) {
|
|
150
|
+
this.toggleAttr('border', value);
|
|
151
|
+
}
|
|
152
|
+
// #endregion
|
|
153
|
+
// ------- end -------
|
|
154
|
+
|
|
155
|
+
// ------- direction 显示方向 -------
|
|
156
|
+
// #region
|
|
157
|
+
get direction() {
|
|
158
|
+
return this.getAttribute('direction') || "horizontal";
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
set direction(value) {
|
|
162
|
+
this.setAttribute('direction', value);
|
|
163
|
+
}
|
|
164
|
+
// #endregion
|
|
165
|
+
// ------- end -------
|
|
166
|
+
|
|
167
|
+
initDescriptionsItem(colNumber, items, hasBorder, direction) {
|
|
168
|
+
const length = Number(items.length);
|
|
169
|
+
|
|
170
|
+
for (let i = 0; i < length; i += 3) {
|
|
171
|
+
let colspanCount = 0;
|
|
172
|
+
const tbody = document.createElement('tbody');
|
|
173
|
+
|
|
174
|
+
switch (direction) {
|
|
175
|
+
case "horizontal": {
|
|
176
|
+
const tr = document.createElement('tr');
|
|
177
|
+
|
|
178
|
+
for (let j = i; j < colNumber + i; j++) {
|
|
179
|
+
const colspan = Number(items[j]?.getAttribute("span")) || 1;
|
|
180
|
+
let temp = colspanCount + colspan;
|
|
181
|
+
|
|
182
|
+
if (temp > colNumber || !items[j]) break;
|
|
183
|
+
|
|
184
|
+
tr.innerHTML += contentTemplate(items[j], colspan, hasBorder);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
tbody.appendChild(tr);
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
case "vertical": {
|
|
191
|
+
const th_tr = document.createElement('tr');
|
|
192
|
+
const td_tr = document.createElement('tr');
|
|
193
|
+
|
|
194
|
+
for (let j = i; j < colNumber + i; j++) {
|
|
195
|
+
const colspan = Number(items[j]?.getAttribute("span")) || 1;
|
|
196
|
+
let temp = colspanCount + colspan;
|
|
197
|
+
|
|
198
|
+
if (temp > colNumber || !items[j]) break;
|
|
199
|
+
|
|
200
|
+
th_tr.innerHTML += getThTemplate_direction(items[j].getAttribute("label"), hasBorder);
|
|
201
|
+
td_tr.innerHTML += getTdTemplate_direction(items[j].innerHTML, hasBorder, colspan);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
tbody.appendChild(th_tr);
|
|
205
|
+
tbody.appendChild(td_tr);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
this.#table.appendChild(tbody);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
items.forEach(el => {
|
|
214
|
+
el.remove();
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
init() {
|
|
219
|
+
const that = this;
|
|
220
|
+
|
|
221
|
+
this.title = this.title;
|
|
222
|
+
|
|
223
|
+
this.col = this.col;
|
|
224
|
+
|
|
225
|
+
this.border = this.border;
|
|
226
|
+
|
|
227
|
+
this.direction = this.direction;
|
|
228
|
+
|
|
229
|
+
const items = this.querySelectorAll('ea-descriptions-item');
|
|
230
|
+
this.initDescriptionsItem(this.col, items, this.border, this.direction);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
connectedCallback() {
|
|
234
|
+
this.init();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (!customElements.get('ea-descriptions')) {
|
|
239
|
+
customElements.define('ea-descriptions', EaDescriptions);
|
|
240
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import Base from '../Base.js';
|
|
3
|
+
|
|
4
|
+
const stylesheet = `
|
|
5
|
+
@import url('/ea_ui_component/icon/index.css');
|
|
6
|
+
|
|
7
|
+
.ea-descriptions-item_wrap {
|
|
8
|
+
display: inline-flex;
|
|
9
|
+
text-align: left;
|
|
10
|
+
padding-bottom: 1rem;
|
|
11
|
+
line-height: 1.5;
|
|
12
|
+
}
|
|
13
|
+
.ea-descriptions-item_wrap .ea-descriptions-item_label {
|
|
14
|
+
margin-right: 10px;
|
|
15
|
+
}
|
|
16
|
+
.ea-descriptions-item_wrap .ea-descriptions-item_label::after {
|
|
17
|
+
content: ":";
|
|
18
|
+
}
|
|
19
|
+
.ea-descriptions-item_wrap .ea-descriptions-item_content {
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
flex: 1;
|
|
22
|
+
align-items: baseline;
|
|
23
|
+
}
|
|
24
|
+
.ea-descriptions-item_wrap .ea-descriptions-item_label.is-border,
|
|
25
|
+
.ea-descriptions-item_wrap .ea-descriptions-item_content.is-border {
|
|
26
|
+
border: 1px solid #ebeef5;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
|
|
30
|
+
export class EaDescriptionsItem extends Base {
|
|
31
|
+
#wrap;
|
|
32
|
+
|
|
33
|
+
#label;
|
|
34
|
+
|
|
35
|
+
#labelSlot;
|
|
36
|
+
|
|
37
|
+
constructor() {
|
|
38
|
+
super();
|
|
39
|
+
|
|
40
|
+
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
41
|
+
|
|
42
|
+
const wrap = document.createElement('td');
|
|
43
|
+
wrap.className = 'ea-descriptions-item_wrap';
|
|
44
|
+
wrap.colSpan = 1;
|
|
45
|
+
|
|
46
|
+
const label = document.createElement('span');
|
|
47
|
+
const labelSlot = document.createElement('slot');
|
|
48
|
+
label.className = 'ea-descriptions-item_label';
|
|
49
|
+
label.appendChild(labelSlot);
|
|
50
|
+
wrap.appendChild(label);
|
|
51
|
+
|
|
52
|
+
const content = document.createElement('span');
|
|
53
|
+
const slot = document.createElement('slot');
|
|
54
|
+
content.className = 'ea-descriptions-item_content';
|
|
55
|
+
labelSlot.name = 'label';
|
|
56
|
+
content.appendChild(slot);
|
|
57
|
+
wrap.appendChild(content);
|
|
58
|
+
|
|
59
|
+
this.#wrap = wrap;
|
|
60
|
+
this.#label = label;
|
|
61
|
+
this.#labelSlot = labelSlot;
|
|
62
|
+
|
|
63
|
+
this.build(shadowRoot, stylesheet);
|
|
64
|
+
this.shadowRoot.appendChild(wrap);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ------- label 该格的标题 -------
|
|
68
|
+
// #region
|
|
69
|
+
get label() {
|
|
70
|
+
return this.getAttribute('label') || '';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
set label(value) {
|
|
74
|
+
this.setAttribute('label', value);
|
|
75
|
+
|
|
76
|
+
this.#label.innerHTML = value;
|
|
77
|
+
}
|
|
78
|
+
// #endregion
|
|
79
|
+
// ------- end -------
|
|
80
|
+
|
|
81
|
+
// ------- span 该格的大小 -------
|
|
82
|
+
// #region
|
|
83
|
+
get span() {
|
|
84
|
+
return this.getAttrNumber('span') || 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
set span(value) {
|
|
88
|
+
this.setAttribute('span', value);
|
|
89
|
+
|
|
90
|
+
this.#wrap.colSpan = value;
|
|
91
|
+
}
|
|
92
|
+
// #endregion
|
|
93
|
+
// ------- end -------
|
|
94
|
+
|
|
95
|
+
init() {
|
|
96
|
+
const that = this;
|
|
97
|
+
|
|
98
|
+
this.label = this.label;
|
|
99
|
+
|
|
100
|
+
this.span = this.span;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
connectedCallback() {
|
|
104
|
+
this.init();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!customElements.get('ea-descriptions-item')) {
|
|
109
|
+
customElements.define('ea-descriptions-item', EaDescriptionsItem);
|
|
110
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
import Base from '../Base.js';
|
|
3
|
+
|
|
4
|
+
const stylesheet = `
|
|
5
|
+
.ea-empty_wrap {
|
|
6
|
+
padding: 40px 0;
|
|
7
|
+
display: flex;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
}
|
|
12
|
+
.ea-empty_wrap .ea-empty_image {
|
|
13
|
+
width: 8rem;
|
|
14
|
+
object-fit: cover;
|
|
15
|
+
}
|
|
16
|
+
.ea-empty_wrap .ea-empty_image svg,
|
|
17
|
+
.ea-empty_wrap .ea-empty_image img {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
.ea-empty_wrap .ea-empty_description {
|
|
22
|
+
margin-top: 20px;
|
|
23
|
+
}
|
|
24
|
+
.ea-empty_wrap .ea-empty_bottom {
|
|
25
|
+
margin-top: 20px;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const emptyStatusSVG = `
|
|
30
|
+
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
|
31
|
+
<path d="M30 50v21.5a2 2 0 0 0 1 1h39a2 2 0 0 0 1-1V50H61a10 10 0 0 1-20 0h-6.5z" fill="#6E6E6F" />
|
|
32
|
+
<path d="M30.5 50.5L34 39h32.5l4 11.5" fill="none" stroke="#6E6E6F" />
|
|
33
|
+
</svg>
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export class EaEmpty extends Base {
|
|
37
|
+
#wrap;
|
|
38
|
+
#imageWrap;
|
|
39
|
+
#descriptionWrap;
|
|
40
|
+
#slot;
|
|
41
|
+
|
|
42
|
+
constructor() {
|
|
43
|
+
super();
|
|
44
|
+
|
|
45
|
+
const shadowRoot = this.attachShadow({ mode: 'open' });
|
|
46
|
+
const wrap = document.createElement('div');
|
|
47
|
+
wrap.className = 'ea-empty_wrap';
|
|
48
|
+
|
|
49
|
+
const imageWrap = document.createElement('div');
|
|
50
|
+
imageWrap.className = 'ea-empty_image';
|
|
51
|
+
imageWrap.innerHTML = emptyStatusSVG;
|
|
52
|
+
wrap.appendChild(imageWrap);
|
|
53
|
+
|
|
54
|
+
const descriptionWrap = document.createElement('div');
|
|
55
|
+
descriptionWrap.className = 'ea-empty_description';
|
|
56
|
+
descriptionWrap.innerHTML = `暂无数据`;
|
|
57
|
+
wrap.appendChild(descriptionWrap);
|
|
58
|
+
|
|
59
|
+
const bottomWrap = document.createElement('div');
|
|
60
|
+
const slot = document.createElement('slot');
|
|
61
|
+
bottomWrap.className = 'ea-empty_bottom';
|
|
62
|
+
bottomWrap.appendChild(slot);
|
|
63
|
+
wrap.appendChild(bottomWrap);
|
|
64
|
+
|
|
65
|
+
this.#wrap = wrap;
|
|
66
|
+
this.#imageWrap = imageWrap;
|
|
67
|
+
this.#descriptionWrap = descriptionWrap;
|
|
68
|
+
this.#slot = slot;
|
|
69
|
+
|
|
70
|
+
this.build(shadowRoot, stylesheet);
|
|
71
|
+
this.shadowRoot.appendChild(wrap);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// ------- description 描述文字 -------
|
|
75
|
+
// #region
|
|
76
|
+
get description() {
|
|
77
|
+
return this.getAttribute('description') || "暂无数据";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
set description(value) {
|
|
81
|
+
this.setAttribute('description', value);
|
|
82
|
+
this.#descriptionWrap.innerHTML = value;
|
|
83
|
+
}
|
|
84
|
+
// #endregion
|
|
85
|
+
// ------- end -------
|
|
86
|
+
|
|
87
|
+
// ------- image 自定义图片 -------
|
|
88
|
+
// #region
|
|
89
|
+
get image() {
|
|
90
|
+
return this.getAttribute('image') || "";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
set image(value) {
|
|
94
|
+
if (!value) return;
|
|
95
|
+
|
|
96
|
+
this.setAttribute('image', value);
|
|
97
|
+
|
|
98
|
+
const image = new Image();
|
|
99
|
+
image.src = value;
|
|
100
|
+
image.onload = () => {
|
|
101
|
+
// this.#imageWrap.style.width = image.width + "px";
|
|
102
|
+
this.#imageWrap.innerHTML = `<img src="${value}" />`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
// #endregion
|
|
107
|
+
// ------- end -------
|
|
108
|
+
|
|
109
|
+
// ------- image-size 自定义图片大小 -------
|
|
110
|
+
// #region
|
|
111
|
+
get imageSize() {
|
|
112
|
+
return this.getAttribute('image-size') || "128";
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
set imageSize(value) {
|
|
116
|
+
if (!value) return;
|
|
117
|
+
|
|
118
|
+
this.setAttribute('image-size', value);
|
|
119
|
+
this.#imageWrap.style.width = value + "px";
|
|
120
|
+
}
|
|
121
|
+
// #endregion
|
|
122
|
+
// ------- end -------
|
|
123
|
+
|
|
124
|
+
init() {
|
|
125
|
+
const that = this;
|
|
126
|
+
|
|
127
|
+
this.description = this.description;
|
|
128
|
+
|
|
129
|
+
this.image = this.image;
|
|
130
|
+
|
|
131
|
+
this.imageSize = this.imageSize;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
connectedCallback() {
|
|
135
|
+
this.init();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (!customElements.get('ea-empty')) {
|
|
140
|
+
customElements.define('ea-empty', EaEmpty);
|
|
141
|
+
}
|