easy-component-ui 3.0.13 → 3.0.14
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 +162 -162
- package/package.json +8 -2
- package/dist/assets/icon.css +0 -1
- package/dist/components/Base.js +0 -874
- package/dist/components/ea-alert.js +0 -213
- package/dist/components/ea-avatar.js +0 -164
- package/dist/components/ea-backtop.js +0 -136
- package/dist/components/ea-badge.js +0 -144
- package/dist/components/ea-breadcrumb.js +0 -148
- package/dist/components/ea-button.js +0 -266
- package/dist/components/ea-calendar.js +0 -10
- package/dist/components/ea-calendar2.js +0 -673
- package/dist/components/ea-card.js +0 -121
- package/dist/components/ea-carousel.js +0 -415
- package/dist/components/ea-checkbox.js +0 -446
- package/dist/components/ea-collapse.js +0 -313
- package/dist/components/ea-color-picker.js +0 -888
- package/dist/components/ea-container.js +0 -206
- package/dist/components/ea-countdown.js +0 -142
- package/dist/components/ea-date-picker.js +0 -649
- package/dist/components/ea-descriptions.js +0 -474
- package/dist/components/ea-dialog.js +0 -249
- package/dist/components/ea-drawer.js +0 -216
- package/dist/components/ea-dropdown.js +0 -228
- package/dist/components/ea-empty.js +0 -93
- package/dist/components/ea-icon.js +0 -158
- package/dist/components/ea-image-preview.js +0 -532
- package/dist/components/ea-image.js +0 -327
- package/dist/components/ea-infinite-scroll.js +0 -109
- package/dist/components/ea-input-number.js +0 -367
- package/dist/components/ea-input.js +0 -588
- package/dist/components/ea-layout.js +0 -132
- package/dist/components/ea-link.js +0 -101
- package/dist/components/ea-menu.js +0 -433
- package/dist/components/ea-message-box.js +0 -624
- package/dist/components/ea-message.js +0 -314
- package/dist/components/ea-notification.js +0 -331
- package/dist/components/ea-overlay.js +0 -168
- package/dist/components/ea-page-header.js +0 -108
- package/dist/components/ea-pagination.js +0 -481
- package/dist/components/ea-popconfirm.js +0 -275
- package/dist/components/ea-popover.js +0 -147
- package/dist/components/ea-popper.js +0 -203
- package/dist/components/ea-progress.js +0 -286
- package/dist/components/ea-radio.js +0 -364
- package/dist/components/ea-rate.js +0 -241
- package/dist/components/ea-result.js +0 -100
- package/dist/components/ea-scrollbar.js +0 -235
- package/dist/components/ea-segmented.js +0 -215
- package/dist/components/ea-select.js +0 -609
- package/dist/components/ea-skeleton.js +0 -263
- package/dist/components/ea-slider.js +0 -430
- package/dist/components/ea-space.js +0 -123
- package/dist/components/ea-splitter.js +0 -233
- package/dist/components/ea-statistic.js +0 -74
- package/dist/components/ea-steps.js +0 -346
- package/dist/components/ea-switch.js +0 -271
- package/dist/components/ea-table.js +0 -1135
- package/dist/components/ea-tabs.js +0 -501
- package/dist/components/ea-tag.js +0 -228
- package/dist/components/ea-text.js +0 -113
- package/dist/components/ea-time-picker.js +0 -510
- package/dist/components/ea-timeline.js +0 -185
- package/dist/components/ea-tooltip.js +0 -161
- package/dist/components/ea-tour.js +0 -544
- package/dist/components/ea-transfer.js +0 -949
- package/dist/components/ea-tree.js +0 -1125
- package/dist/components/index.js +0 -60
- package/dist/core/FormBase.js +0 -238
- package/dist/css/ea-alert.style.js +0 -4
- package/dist/css/ea-aside.style.js +0 -4
- package/dist/css/ea-avatar.style.js +0 -4
- package/dist/css/ea-backtop.style.js +0 -4
- package/dist/css/ea-badge.style.js +0 -4
- package/dist/css/ea-breadcrumb-item.style.js +0 -4
- package/dist/css/ea-breadcrumb.style.js +0 -4
- package/dist/css/ea-button-group.style.js +0 -4
- package/dist/css/ea-button.style.js +0 -4
- package/dist/css/ea-calendar.style.js +0 -4
- package/dist/css/ea-card.style.js +0 -4
- package/dist/css/ea-carousel-item.style.js +0 -4
- package/dist/css/ea-carousel.style.js +0 -4
- package/dist/css/ea-check-tag.style.js +0 -4
- package/dist/css/ea-checkbox-group.style.js +0 -4
- package/dist/css/ea-checkbox.style.js +0 -4
- package/dist/css/ea-col.style.js +0 -4
- package/dist/css/ea-collapse-item.style.js +0 -4
- package/dist/css/ea-collapse.style.js +0 -4
- package/dist/css/ea-color-picker-panel.style.js +0 -4
- package/dist/css/ea-color-picker.style.js +0 -4
- package/dist/css/ea-container.style.js +0 -4
- package/dist/css/ea-date-picker.style.js +0 -4
- package/dist/css/ea-descriptions-item.style.js +0 -4
- package/dist/css/ea-descriptions.style.js +0 -4
- package/dist/css/ea-dialog.style.js +0 -4
- package/dist/css/ea-drawer.style.js +0 -4
- package/dist/css/ea-dropdown-item.style.js +0 -4
- package/dist/css/ea-dropdown-menu.style.js +0 -4
- package/dist/css/ea-dropdown.style.js +0 -4
- package/dist/css/ea-empty.style.js +0 -4
- package/dist/css/ea-footer.style.js +0 -4
- package/dist/css/ea-header.style.js +0 -4
- package/dist/css/ea-icon.style.js +0 -4
- package/dist/css/ea-image-preview.style.js +0 -4
- package/dist/css/ea-image.style.js +0 -4
- package/dist/css/ea-infinite-scroll.style.js +0 -4
- package/dist/css/ea-input-number.style.js +0 -4
- package/dist/css/ea-input.style.js +0 -4
- package/dist/css/ea-link.style.js +0 -4
- package/dist/css/ea-main.style.js +0 -4
- package/dist/css/ea-menu-item-group.style.js +0 -4
- package/dist/css/ea-menu-item.style.js +0 -4
- package/dist/css/ea-menu.style.js +0 -4
- package/dist/css/ea-message-box.style.js +0 -4
- package/dist/css/ea-message.style.js +0 -4
- package/dist/css/ea-notification.style.js +0 -4
- package/dist/css/ea-option-gropu.style.js +0 -4
- package/dist/css/ea-option.style.js +0 -4
- package/dist/css/ea-overlay.style.js +0 -4
- package/dist/css/ea-page-header.style.js +0 -4
- package/dist/css/ea-pagination.style.js +0 -4
- package/dist/css/ea-popconfirm.style.js +0 -4
- package/dist/css/ea-popover.style.js +0 -4
- package/dist/css/ea-popper.style.js +0 -4
- package/dist/css/ea-progress.style.js +0 -4
- package/dist/css/ea-radio-group.style.js +0 -4
- package/dist/css/ea-radio.style.js +0 -4
- package/dist/css/ea-rate.style.js +0 -4
- package/dist/css/ea-result.style.js +0 -4
- package/dist/css/ea-row.style.js +0 -4
- package/dist/css/ea-scrollbar.style.js +0 -4
- package/dist/css/ea-segmented.style.js +0 -4
- package/dist/css/ea-select.style.js +0 -4
- package/dist/css/ea-skeleton-item.style.js +0 -4
- package/dist/css/ea-skeleton.style.js +0 -4
- package/dist/css/ea-slider.style.js +0 -4
- package/dist/css/ea-space.style.js +0 -4
- package/dist/css/ea-splitter-bar.style.js +0 -4
- package/dist/css/ea-splitter-panel.style.js +0 -4
- package/dist/css/ea-splitter.style.js +0 -4
- package/dist/css/ea-statistic.style.js +0 -4
- package/dist/css/ea-step.style.js +0 -4
- package/dist/css/ea-steps.style.js +0 -4
- package/dist/css/ea-sub-menu.style.js +0 -4
- package/dist/css/ea-switch.style.js +0 -4
- package/dist/css/ea-tab-panel.style.js +0 -4
- package/dist/css/ea-tab.style.js +0 -4
- package/dist/css/ea-table-column.style.js +0 -4
- package/dist/css/ea-table.style.js +0 -4
- package/dist/css/ea-tabs.style.js +0 -4
- package/dist/css/ea-tag.style.js +0 -4
- package/dist/css/ea-text.style.js +0 -4
- package/dist/css/ea-time-picker.style.js +0 -4
- package/dist/css/ea-timeline-item.style.js +0 -4
- package/dist/css/ea-timeline.style.js +0 -4
- package/dist/css/ea-tooltip.style.js +0 -4
- package/dist/css/ea-tour-step.style.js +0 -4
- package/dist/css/ea-tour.style.js +0 -4
- package/dist/css/ea-transfer.style.js +0 -5
- package/dist/css/ea-tree.style.js +0 -6
- package/dist/css/ea-ui-component.style.js +0 -4
- package/dist/favicon.ico +0 -0
- package/dist/utils/Color.js +0 -439
- package/dist/utils/I18nManager.js +0 -218
- package/dist/utils/Utils.js +0 -65
- package/dist/utils/Variables.js +0 -12
- package/dist/utils/parseTime.js +0 -73
- package/dist/utils/timeout.js +0 -9
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
var A = Object.defineProperty;
|
|
2
|
-
var _ = (s) => {
|
|
3
|
-
throw TypeError(s);
|
|
4
|
-
};
|
|
5
|
-
var S = (s, i, t) => i in s ? A(s, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[i] = t;
|
|
6
|
-
var C = (s, i, t) => S(s, typeof i != "symbol" ? i + "" : i, t), x = (s, i, t) => i.has(s) || _("Cannot " + t);
|
|
7
|
-
var e = (s, i, t) => (x(s, i, "read from private field"), t ? t.call(s) : i.get(s)), n = (s, i, t) => i.has(s) ? _("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, t), b = (s, i, t, a) => (x(s, i, "write to private field"), a ? a.call(s, t) : i.set(s, t), t);
|
|
8
|
-
import { F as V } from "../core/FormBase.js";
|
|
9
|
-
import { s as L } from "../css/ea-rate.style.js";
|
|
10
|
-
import { E as M } from "../utils/Variables.js";
|
|
11
|
-
var r, p, d, u, v, c, m, y, f, g;
|
|
12
|
-
class R extends V {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
/** @type {HTMLElement} */
|
|
16
|
-
n(this, r);
|
|
17
|
-
/** @type {HTMLElement} */
|
|
18
|
-
n(this, p);
|
|
19
|
-
/** @type {AbortController} */
|
|
20
|
-
n(this, d, new AbortController());
|
|
21
|
-
/** @type {AbortController} */
|
|
22
|
-
n(this, u, new AbortController());
|
|
23
|
-
C(this, "state", this.properties({
|
|
24
|
-
label: {
|
|
25
|
-
type: String,
|
|
26
|
-
default: "",
|
|
27
|
-
observer: async (t) => {
|
|
28
|
-
e(this, p).textContent = t;
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
value: {
|
|
32
|
-
type: Number,
|
|
33
|
-
default: 0,
|
|
34
|
-
observer: (t) => {
|
|
35
|
-
this.setValue(t), e(this, c).call(this, t - 1);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
max: {
|
|
39
|
-
type: Number,
|
|
40
|
-
default: 5,
|
|
41
|
-
observer: () => {
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
size: {
|
|
45
|
-
type: M,
|
|
46
|
-
default: "",
|
|
47
|
-
observer: () => {
|
|
48
|
-
this.updateContainerClasslist();
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
readonly: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: !1,
|
|
54
|
-
observer: () => {
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
disabled: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
default: !1,
|
|
60
|
-
observer: () => {
|
|
61
|
-
this.updateContainerClasslist();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}));
|
|
65
|
-
C(this, "funcStates", this.properties({
|
|
66
|
-
getSymbol: {
|
|
67
|
-
props: !0,
|
|
68
|
-
type: Function,
|
|
69
|
-
rawFunction: !0,
|
|
70
|
-
/**
|
|
71
|
-
* 获取图标
|
|
72
|
-
* @param {string} [value]
|
|
73
|
-
* @param {boolean} [isSelected]
|
|
74
|
-
* @returns {string}
|
|
75
|
-
*/
|
|
76
|
-
default: () => () => '<ea-icon name="star" part="icon"></ea-icon>',
|
|
77
|
-
/** @param {Function} cb */
|
|
78
|
-
observer: (t) => {
|
|
79
|
-
!t || typeof t != "function" || (e(this, r).innerHTML = e(this, v).call(this, t), e(this, c).call(this, this.value - 1));
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}));
|
|
83
|
-
/**
|
|
84
|
-
* 渲染 rate 元素
|
|
85
|
-
* @param {(value: Number, isSelected: Boolean) => String} renderer
|
|
86
|
-
* @param {Number} activeValue
|
|
87
|
-
* @return {String}
|
|
88
|
-
*/
|
|
89
|
-
n(this, v, (t, a = this.value, h = this.max) => {
|
|
90
|
-
if (!t) return;
|
|
91
|
-
const l = Array.from({ length: h }).map(
|
|
92
|
-
(o, E) => `
|
|
93
|
-
<span class='ea-rate__symbol' part='symbol-wrap'>
|
|
94
|
-
${t(E, a)}
|
|
95
|
-
</span>`
|
|
96
|
-
).join("");
|
|
97
|
-
return e(this, r).innerHTML = l, l;
|
|
98
|
-
});
|
|
99
|
-
/**
|
|
100
|
-
* 设置 rate 元素选中状态
|
|
101
|
-
* @param {Number} index
|
|
102
|
-
*/
|
|
103
|
-
n(this, c, (t = this.value - 1) => {
|
|
104
|
-
[...e(this, r).children].forEach((h, l) => {
|
|
105
|
-
h.classList.toggle("is-selected", l <= t);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
/**
|
|
109
|
-
* 取消 rate 元素选中状态
|
|
110
|
-
* @param {Number} [currentValue]
|
|
111
|
-
*/
|
|
112
|
-
n(this, m, (t = this.value - 1) => {
|
|
113
|
-
[...e(this, r).children].forEach((h, l) => {
|
|
114
|
-
h.classList.toggle("is-selected", l <= t);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
/**
|
|
118
|
-
* 触发 hover 事件
|
|
119
|
-
* @param {Number} [value]
|
|
120
|
-
* @param {HTMLElement} [target]
|
|
121
|
-
*/
|
|
122
|
-
n(this, y, (t = this.value, a = null) => {
|
|
123
|
-
this.emit("hover", {
|
|
124
|
-
detail: {
|
|
125
|
-
value: t,
|
|
126
|
-
target: a
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
/**
|
|
131
|
-
* 当鼠标移入父元素时,设置子元素的选中状态
|
|
132
|
-
*/
|
|
133
|
-
n(this, f, () => {
|
|
134
|
-
var h;
|
|
135
|
-
if (this.readonly || this.disabled) return;
|
|
136
|
-
(h = e(this, u)) == null || h.abort(), b(this, u, new AbortController());
|
|
137
|
-
const t = (l) => {
|
|
138
|
-
const o = l.target.closest(".ea-rate__symbol"), w = [...e(this, r).children].indexOf(o);
|
|
139
|
-
e(this, c).call(this, w), o && e(this, y).call(this, w, o);
|
|
140
|
-
}, a = () => {
|
|
141
|
-
const l = this.hasAttribute("value") ? this.value - 1 : null, o = this.children[l];
|
|
142
|
-
e(this, m).call(this), e(this, y).call(this, l, o);
|
|
143
|
-
};
|
|
144
|
-
e(this, r).addEventListener("mousemove", t, {
|
|
145
|
-
signal: e(this, u).signal
|
|
146
|
-
}), e(this, r).addEventListener("mouseout", a, {
|
|
147
|
-
signal: e(this, u).signal
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
/**
|
|
151
|
-
* 通过监听父元素的点击事件,设置子元素的选中状态
|
|
152
|
-
*/
|
|
153
|
-
n(this, g, (t) => {
|
|
154
|
-
if (this.readonly || this.disabled) return;
|
|
155
|
-
const a = t.target.closest(".ea-rate__symbol"), o = [...e(this, r).children].indexOf(a) + 1;
|
|
156
|
-
this.value === o ? (this.value = 0, e(this, m).call(this, 0)) : this.value = o, this.emit("change", { detail: { value: o } });
|
|
157
|
-
});
|
|
158
|
-
this.stylesheet = L, this.$render();
|
|
159
|
-
}
|
|
160
|
-
static get observedAttributes() {
|
|
161
|
-
return [
|
|
162
|
-
...super.observedAttributes,
|
|
163
|
-
"label",
|
|
164
|
-
"value",
|
|
165
|
-
"max",
|
|
166
|
-
"size",
|
|
167
|
-
"readonly",
|
|
168
|
-
"disabled"
|
|
169
|
-
];
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* 获取 classlist 列表
|
|
173
|
-
* @return {string} 属性值
|
|
174
|
-
*/
|
|
175
|
-
updateContainerClasslist() {
|
|
176
|
-
const t = this.computedClasslist(
|
|
177
|
-
"ea-rate",
|
|
178
|
-
{
|
|
179
|
-
["--" + this.size]: this.size
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
disabled: this.disabled
|
|
183
|
-
}
|
|
184
|
-
);
|
|
185
|
-
return e(this, r).className = t, t;
|
|
186
|
-
}
|
|
187
|
-
$render() {
|
|
188
|
-
this.shadowRoot.innerHTML = `
|
|
189
|
-
<label class="ea-rate__label" part="label"></label>
|
|
190
|
-
<div class='ea-rate' part='container'></div>
|
|
191
|
-
`, b(this, p, this.shadowRoot.querySelector(".ea-rate__label")), b(this, r, this.shadowRoot.querySelector(".ea-rate")), e(this, v).call(this, this.getSymbol), this.updateContainerClasslist();
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* 获取验证目标元素
|
|
195
|
-
* @returns {HTMLElement}
|
|
196
|
-
*/
|
|
197
|
-
get validationTarget() {
|
|
198
|
-
return this;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* 更新表单验证状态
|
|
202
|
-
*/
|
|
203
|
-
updateValidity() {
|
|
204
|
-
this.required && !this.value ? this.internals.setValidity(
|
|
205
|
-
{ valueMissing: !0 },
|
|
206
|
-
"请选择一个评分",
|
|
207
|
-
this
|
|
208
|
-
) : this.internals.setValidity({}, "", this);
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* 检查表单字段的有效性
|
|
212
|
-
* @returns {boolean} 如果字段有效返回 true,否则返回 false
|
|
213
|
-
*/
|
|
214
|
-
checkValidity() {
|
|
215
|
-
return this.updateValidity(), this.internals.checkValidity();
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* 报告表单字段的有效性(显示验证提示)
|
|
219
|
-
* @returns {boolean} 如果字段有效返回 true,否则返回 false
|
|
220
|
-
*/
|
|
221
|
-
reportValidity() {
|
|
222
|
-
return this.updateValidity(), this.internals.reportValidity();
|
|
223
|
-
}
|
|
224
|
-
connectedCallback() {
|
|
225
|
-
var t;
|
|
226
|
-
super.connectedCallback(), (t = e(this, d)) == null || t.abort(), b(this, d, new AbortController()), e(this, r).addEventListener("mouseover", e(this, f), {
|
|
227
|
-
signal: e(this, d).signal
|
|
228
|
-
}), e(this, r).addEventListener("click", e(this, g), {
|
|
229
|
-
signal: e(this, d).signal
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
$beforeUnmounted() {
|
|
233
|
-
var t, a;
|
|
234
|
-
(t = e(this, d)) == null || t.abort(), (a = e(this, u)) == null || a.abort();
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
r = new WeakMap(), p = new WeakMap(), d = new WeakMap(), u = new WeakMap(), v = new WeakMap(), c = new WeakMap(), m = new WeakMap(), y = new WeakMap(), f = new WeakMap(), g = new WeakMap();
|
|
238
|
-
window.customElements.get("ea-rate") || window.customElements.define("ea-rate", R);
|
|
239
|
-
export {
|
|
240
|
-
R as EaRate
|
|
241
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
var b = Object.defineProperty;
|
|
2
|
-
var h = (e) => {
|
|
3
|
-
throw TypeError(e);
|
|
4
|
-
};
|
|
5
|
-
var y = (e, s, t) => s in e ? b(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
6
|
-
var p = (e, s, t) => y(e, typeof s != "symbol" ? s + "" : s, t), _ = (e, s, t) => s.has(e) || h("Cannot " + t);
|
|
7
|
-
var i = (e, s, t) => (_(e, s, "read from private field"), t ? t.call(e) : s.get(e)), a = (e, s, t) => s.has(e) ? h("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), o = (e, s, t, d) => (_(e, s, "write to private field"), d ? d.call(e, t) : s.set(e, t), t);
|
|
8
|
-
import { B as v } from "./Base.js";
|
|
9
|
-
import { s as f } from "../css/ea-result.style.js";
|
|
10
|
-
import { t as m } from "../utils/Variables.js";
|
|
11
|
-
var l, r, n, u, c;
|
|
12
|
-
class w extends v {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
/** @type {HTMLElement} */
|
|
16
|
-
a(this, l);
|
|
17
|
-
/** @type {HTMLElement} */
|
|
18
|
-
a(this, r);
|
|
19
|
-
/** @type {HTMLElement} */
|
|
20
|
-
a(this, n);
|
|
21
|
-
/** @type {HTMLElement} */
|
|
22
|
-
a(this, u);
|
|
23
|
-
/** @type {HTMLElement} */
|
|
24
|
-
a(this, c);
|
|
25
|
-
p(this, "state", this.properties({
|
|
26
|
-
type: {
|
|
27
|
-
type: ["primary", "success", "warning", "info", "error"],
|
|
28
|
-
default: "",
|
|
29
|
-
observer: (t) => {
|
|
30
|
-
i(this, r).setAttribute("name", m[t]), this.updateContainerClasslist();
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
title: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: "",
|
|
36
|
-
observer: (t) => {
|
|
37
|
-
i(this, n).textContent = t;
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"sub-title": {
|
|
41
|
-
type: String,
|
|
42
|
-
default: "",
|
|
43
|
-
observer: (t) => {
|
|
44
|
-
i(this, u).textContent = t;
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
icon: {
|
|
48
|
-
type: String,
|
|
49
|
-
default: "",
|
|
50
|
-
observer: (t) => {
|
|
51
|
-
t ? i(this, r).setAttribute("name", t) : i(this, r).setAttribute("name", m[this.type]);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}));
|
|
55
|
-
this.stylesheet = f, this.$render();
|
|
56
|
-
}
|
|
57
|
-
static get observedAttributes() {
|
|
58
|
-
return [...super.observedAttributes, "type", "title", "sub-title", "icon"];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* 获取 classlist 列表
|
|
62
|
-
* @return {string} 属性值
|
|
63
|
-
*/
|
|
64
|
-
updateContainerClasslist() {
|
|
65
|
-
const t = this.computedClasslist("ea-result", {
|
|
66
|
-
["--" + this.type]: this.type
|
|
67
|
-
});
|
|
68
|
-
return i(this, l).className = t, t;
|
|
69
|
-
}
|
|
70
|
-
$render() {
|
|
71
|
-
this.shadowRoot.innerHTML = `
|
|
72
|
-
<div class='ea-result' part='container'>
|
|
73
|
-
<div class="ea-result__icon ea-result__icon-wrap" part="icon-wrap">
|
|
74
|
-
<slot name="icon">
|
|
75
|
-
<ea-icon class="ea-result__icon ea-result__default-icon" part="icon"></ea-icon>
|
|
76
|
-
</slot>
|
|
77
|
-
</div>
|
|
78
|
-
<div class="ea-result__title" part="title">
|
|
79
|
-
<slot name="title"></slot>
|
|
80
|
-
</div>
|
|
81
|
-
<div class="ea-result__sub-title" part="sub-title">
|
|
82
|
-
<slot name="sub-title"></slot>
|
|
83
|
-
</div>
|
|
84
|
-
<div class="ea-result__extra" part="extra">
|
|
85
|
-
<slot name="extra"></slot>
|
|
86
|
-
</div>
|
|
87
|
-
</div>
|
|
88
|
-
`, o(this, l, this.shadowRoot.querySelector(".ea-result")), o(this, r, this.shadowRoot.querySelector(".ea-result__default-icon")), o(this, n, this.shadowRoot.querySelector(".ea-result__title slot")), o(this, u, this.shadowRoot.querySelector(
|
|
89
|
-
".ea-result__sub-title slot"
|
|
90
|
-
)), o(this, c, this.shadowRoot.querySelector(".ea-result__extra slot"));
|
|
91
|
-
}
|
|
92
|
-
connectedCallback() {
|
|
93
|
-
super.connectedCallback();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
l = new WeakMap(), r = new WeakMap(), n = new WeakMap(), u = new WeakMap(), c = new WeakMap();
|
|
97
|
-
window.customElements.get("ea-result") || window.customElements.define("ea-result", w);
|
|
98
|
-
export {
|
|
99
|
-
w as EaResult
|
|
100
|
-
};
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
var z = Object.defineProperty;
|
|
2
|
-
var _ = (o) => {
|
|
3
|
-
throw TypeError(o);
|
|
4
|
-
};
|
|
5
|
-
var R = (o, i, s) => i in o ? z(o, i, { enumerable: !0, configurable: !0, writable: !0, value: s }) : o[i] = s;
|
|
6
|
-
var k = (o, i, s) => R(o, typeof i != "symbol" ? i + "" : i, s), E = (o, i, s) => i.has(o) || _("Cannot " + s);
|
|
7
|
-
var t = (o, i, s) => (E(o, i, "read from private field"), s ? s.call(o) : i.get(o)), r = (o, i, s) => i.has(o) ? _("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(o) : i.set(o, s), h = (o, i, s, l) => (E(o, i, "write to private field"), l ? l.call(o, s) : i.set(o, s), s);
|
|
8
|
-
import { B as C } from "./Base.js";
|
|
9
|
-
import { s as H } from "../css/ea-scrollbar.style.js";
|
|
10
|
-
var n, b, g, c, a, e, L, u, d, p, f, w, m;
|
|
11
|
-
class S extends C {
|
|
12
|
-
constructor() {
|
|
13
|
-
super();
|
|
14
|
-
/** @type {HTMLElement} */
|
|
15
|
-
r(this, n);
|
|
16
|
-
/** @type {HTMLElement} */
|
|
17
|
-
r(this, b);
|
|
18
|
-
/** @type {HTMLElement} */
|
|
19
|
-
r(this, g);
|
|
20
|
-
/** @type {HTMLElement} */
|
|
21
|
-
r(this, c);
|
|
22
|
-
/** @type {HTMLElement} */
|
|
23
|
-
r(this, a);
|
|
24
|
-
/** @type {HTMLElement} */
|
|
25
|
-
r(this, e);
|
|
26
|
-
r(this, L, {
|
|
27
|
-
verticalScrollDistance: 0,
|
|
28
|
-
horizontalScrollDistance: 0
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* @typedef {Object} State
|
|
32
|
-
*/
|
|
33
|
-
/** @type {State} */
|
|
34
|
-
k(this, "state", this.properties({
|
|
35
|
-
height: {
|
|
36
|
-
type: String,
|
|
37
|
-
default: "",
|
|
38
|
-
observer: (s) => {
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
native: {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
default: !1,
|
|
44
|
-
observer: (s) => {
|
|
45
|
-
t(this, n).classList.toggle("ea-scrollbar--native", s);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
noresize: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: !1,
|
|
51
|
-
observer: (s) => {
|
|
52
|
-
t(this, n).classList.toggle("ea-scrollbar--noresize", s);
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
always: {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
default: !1,
|
|
58
|
-
observer: (s) => {
|
|
59
|
-
t(this, n).classList.toggle("ea-scrollbar--always", s);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}));
|
|
63
|
-
/**
|
|
64
|
-
* 滚动事件 - 修改滚动条样式 和 事件派发
|
|
65
|
-
*/
|
|
66
|
-
r(this, u, () => {
|
|
67
|
-
t(this, c).style.setProperty(
|
|
68
|
-
"--ea-scrollbar-top",
|
|
69
|
-
`${t(this, e).scrollTop / t(this, e).scrollHeight * 100}%`
|
|
70
|
-
), t(this, a).style.setProperty(
|
|
71
|
-
"--ea-scrollbar-left",
|
|
72
|
-
`${t(this, e).scrollLeft / t(this, e).scrollWidth * 100}%`
|
|
73
|
-
), this.dispatchEvent(
|
|
74
|
-
new CustomEvent("scroll", {
|
|
75
|
-
detail: {
|
|
76
|
-
scrollTop: t(this, e).scrollTop,
|
|
77
|
-
scrollLeft: t(this, e).scrollLeft
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
);
|
|
81
|
-
const s = {
|
|
82
|
-
left: t(this, e).scrollTop / t(this, e).scrollHeight <= 0,
|
|
83
|
-
right: t(this, e).scrollTop / t(this, e).scrollHeight >= 1,
|
|
84
|
-
top: t(this, e).scrollLeft / t(this, e).scrollWidth <= 0,
|
|
85
|
-
bottom: t(this, e).scrollLeft / t(this, e).scrollWidth >= 1
|
|
86
|
-
};
|
|
87
|
-
Object.keys(s).forEach((l) => {
|
|
88
|
-
s[l] && this.dispatchEvent(
|
|
89
|
-
new CustomEvent("end-reached", {
|
|
90
|
-
detail: {
|
|
91
|
-
direction: l,
|
|
92
|
-
scrollTop: t(this, e).scrollTop,
|
|
93
|
-
scrollLeft: t(this, e).scrollLeft
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
/**
|
|
100
|
-
* 页面尺寸改变后,调整滚动条样式
|
|
101
|
-
*/
|
|
102
|
-
r(this, d, () => {
|
|
103
|
-
queueMicrotask(() => {
|
|
104
|
-
const s = t(this, e).getBoundingClientRect(), l = s.height / t(this, e).scrollHeight, v = s.width / t(this, e).scrollWidth;
|
|
105
|
-
t(this, c).style.setProperty(
|
|
106
|
-
"--ea-scrollbar-thumb-vertical-height",
|
|
107
|
-
`${l * 100}%`
|
|
108
|
-
), t(this, a).style.setProperty(
|
|
109
|
-
"--ea-scrollbar-thumb-horizontal-width",
|
|
110
|
-
`${v * 100}%`
|
|
111
|
-
), t(this, g).classList.toggle(
|
|
112
|
-
"is-show",
|
|
113
|
-
l >= 0.999
|
|
114
|
-
), t(this, b).classList.toggle(
|
|
115
|
-
"is-show",
|
|
116
|
-
v >= 0.999
|
|
117
|
-
);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
/**
|
|
121
|
-
* 垂直滚动条拖动事件
|
|
122
|
-
* @param {MouseEvent} e
|
|
123
|
-
*/
|
|
124
|
-
r(this, p, (s) => {
|
|
125
|
-
const l = t(this, g).getBoundingClientRect(), y = (s.clientY - l.top) / l.height * (t(this, e).scrollHeight - t(this, e).clientHeight);
|
|
126
|
-
t(this, e).scrollTo({
|
|
127
|
-
top: y,
|
|
128
|
-
behavior: "instant"
|
|
129
|
-
}), t(this, c).classList.add("is-active");
|
|
130
|
-
});
|
|
131
|
-
/**
|
|
132
|
-
* 水平滚动条拖动事件
|
|
133
|
-
* @param {MouseEvent} e
|
|
134
|
-
*/
|
|
135
|
-
r(this, f, (s) => {
|
|
136
|
-
const l = t(this, b).getBoundingClientRect(), y = (s.clientX - l.left) / l.width * (t(this, e).scrollWidth - t(this, e).clientWidth);
|
|
137
|
-
t(this, e).scrollTo({
|
|
138
|
-
left: y,
|
|
139
|
-
behavior: "instant"
|
|
140
|
-
}), t(this, a).classList.add("is-active");
|
|
141
|
-
});
|
|
142
|
-
/**
|
|
143
|
-
* 鼠标按下事件
|
|
144
|
-
* @param {MouseEvent} e
|
|
145
|
-
*/
|
|
146
|
-
r(this, w, (s) => {
|
|
147
|
-
s.preventDefault(), s.stopPropagation();
|
|
148
|
-
const l = new AbortController(), v = s.target === t(this, a);
|
|
149
|
-
window.addEventListener(
|
|
150
|
-
"mousemove",
|
|
151
|
-
v ? t(this, f) : t(this, p),
|
|
152
|
-
{ signal: l.signal }
|
|
153
|
-
), window.addEventListener(
|
|
154
|
-
"mouseup",
|
|
155
|
-
() => {
|
|
156
|
-
l.abort(), t(this, a).classList.remove("is-active"), t(this, c).classList.remove("is-active");
|
|
157
|
-
},
|
|
158
|
-
{ signal: l.signal }
|
|
159
|
-
);
|
|
160
|
-
});
|
|
161
|
-
/**
|
|
162
|
-
* 键盘事件
|
|
163
|
-
* @param {KeyboardEvent} e
|
|
164
|
-
*/
|
|
165
|
-
r(this, m, (s) => {
|
|
166
|
-
s.key === "ArrowUp" || s.key === "ArrowDown" ? t(this, e).scrollTo({
|
|
167
|
-
top: t(this, e).scrollTop + t(this, e).scrollHeight / 8 * (s.key === "ArrowUp" ? -1 : 1),
|
|
168
|
-
behavior: "smooth"
|
|
169
|
-
}) : (s.key === "ArrowLeft" || s.key === "ArrowRight") && t(this, e).scrollTo({
|
|
170
|
-
left: t(this, e).scrollLeft + t(this, e).scrollWidth / 8 * (s.key === "ArrowLeft" ? -1 : 1),
|
|
171
|
-
behavior: "smooth"
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
this.stylesheet = H, this.isMounted = !1;
|
|
175
|
-
}
|
|
176
|
-
static get observedAttributes() {
|
|
177
|
-
return ["native", "noresize", "always"];
|
|
178
|
-
}
|
|
179
|
-
$render() {
|
|
180
|
-
this.shadowRoot.innerHTML = `
|
|
181
|
-
<div class="ea-scrollbar" part="container">
|
|
182
|
-
<div class="ea-scrollbar__track ea-scrollbar__track-horizontal" part="track-horizontal">
|
|
183
|
-
<div class="ea-scrollbar__thumb-horizontal" part="thumb"></div>
|
|
184
|
-
</div>
|
|
185
|
-
<div class="ea-scrollbar__track ea-scrollbar__track-vertical" part="track-vertical">
|
|
186
|
-
<div class="ea-scrollbar__thumb-vertical" part="thumb"></div>
|
|
187
|
-
</div>
|
|
188
|
-
<div class="ea-scrollbar__view" part="view-container">
|
|
189
|
-
<slot></slot>
|
|
190
|
-
</div>
|
|
191
|
-
</div>
|
|
192
|
-
`, h(this, n, this.shadowRoot.querySelector(".ea-scrollbar")), h(this, g, this.shadowRoot.querySelector(
|
|
193
|
-
".ea-scrollbar__track-vertical"
|
|
194
|
-
)), h(this, b, this.shadowRoot.querySelector(
|
|
195
|
-
".ea-scrollbar__track-horizontal"
|
|
196
|
-
)), h(this, c, this.shadowRoot.querySelector(
|
|
197
|
-
".ea-scrollbar__thumb-vertical"
|
|
198
|
-
)), h(this, a, this.shadowRoot.querySelector(
|
|
199
|
-
".ea-scrollbar__thumb-horizontal"
|
|
200
|
-
)), h(this, e, this.shadowRoot.querySelector(".ea-scrollbar__view")), this.isMounted = !0;
|
|
201
|
-
}
|
|
202
|
-
connectedCallback() {
|
|
203
|
-
super.connectedCallback(), this.$render(), this.native = this.native, this.noresize = this.noresize, this.always = this.always, this.eventController = new AbortController();
|
|
204
|
-
const s = this.eventController;
|
|
205
|
-
t(this, d).call(this), t(this, e).addEventListener("scroll", t(this, u), {
|
|
206
|
-
signal: s.signal
|
|
207
|
-
}), t(this, a).addEventListener("mousedown", t(this, w), {
|
|
208
|
-
signal: s.signal
|
|
209
|
-
}), t(this, c).addEventListener("mousedown", t(this, w), {
|
|
210
|
-
signal: s.signal
|
|
211
|
-
}), this.addEventListener("keydown", t(this, m)), this.noresize || window.addEventListener("resize", t(this, d), {
|
|
212
|
-
signal: s.signal
|
|
213
|
-
}), this.shadowRoot.addEventListener("slotchange", t(this, d), {
|
|
214
|
-
signal: s.signal
|
|
215
|
-
}), window.addEventListener("load", t(this, d), {
|
|
216
|
-
signal: s.signal
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* @exports scrollTo
|
|
221
|
-
* @param {ScrollToOptions} options
|
|
222
|
-
*/
|
|
223
|
-
scrollTo(s) {
|
|
224
|
-
t(this, e).scrollTo(s);
|
|
225
|
-
}
|
|
226
|
-
$beforeUnmounted() {
|
|
227
|
-
var s;
|
|
228
|
-
(s = this.eventController) == null || s.abort();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
n = new WeakMap(), b = new WeakMap(), g = new WeakMap(), c = new WeakMap(), a = new WeakMap(), e = new WeakMap(), L = new WeakMap(), u = new WeakMap(), d = new WeakMap(), p = new WeakMap(), f = new WeakMap(), w = new WeakMap(), m = new WeakMap();
|
|
232
|
-
window.customElements.get("ea-scrollbar") || window.customElements.define("ea-scrollbar", S);
|
|
233
|
-
export {
|
|
234
|
-
S as EaScrollbar
|
|
235
|
-
};
|