easy-component-ui 3.0.14 → 3.0.15
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/dist/assets/icon.css +1 -0
- package/dist/components/Base.js +941 -0
- package/dist/components/ea-alert.js +213 -0
- package/dist/components/ea-avatar.js +164 -0
- package/dist/components/ea-backtop.js +136 -0
- package/dist/components/ea-badge.js +144 -0
- package/dist/components/ea-breadcrumb.js +148 -0
- package/dist/components/ea-button.js +266 -0
- package/dist/components/ea-calendar.js +10 -0
- package/dist/components/ea-calendar2.js +673 -0
- package/dist/components/ea-card.js +121 -0
- package/dist/components/ea-carousel.js +415 -0
- package/dist/components/ea-checkbox.js +446 -0
- package/dist/components/ea-collapse.js +313 -0
- package/dist/components/ea-color-picker.js +888 -0
- package/dist/components/ea-container.js +206 -0
- package/dist/components/ea-countdown.js +142 -0
- package/dist/components/ea-date-picker.js +649 -0
- package/dist/components/ea-descriptions.js +474 -0
- package/dist/components/ea-dialog.js +249 -0
- package/dist/components/ea-drawer.js +216 -0
- package/dist/components/ea-dropdown.js +228 -0
- package/dist/components/ea-empty.js +93 -0
- package/dist/components/ea-icon.js +159 -0
- package/dist/components/ea-image-preview.js +532 -0
- package/dist/components/ea-image.js +327 -0
- package/dist/components/ea-infinite-scroll.js +109 -0
- package/dist/components/ea-input-number.js +367 -0
- package/dist/components/ea-input.js +588 -0
- package/dist/components/ea-layout.js +132 -0
- package/dist/components/ea-link.js +101 -0
- package/dist/components/ea-menu.js +433 -0
- package/dist/components/ea-message-box.js +624 -0
- package/dist/components/ea-message.js +313 -0
- package/dist/components/ea-notification.js +331 -0
- package/dist/components/ea-overlay.js +168 -0
- package/dist/components/ea-page-header.js +108 -0
- package/dist/components/ea-pagination.js +481 -0
- package/dist/components/ea-popconfirm.js +275 -0
- package/dist/components/ea-popover.js +147 -0
- package/dist/components/ea-popper.js +203 -0
- package/dist/components/ea-progress.js +286 -0
- package/dist/components/ea-radio.js +364 -0
- package/dist/components/ea-rate.js +241 -0
- package/dist/components/ea-result.js +100 -0
- package/dist/components/ea-scrollbar.js +235 -0
- package/dist/components/ea-segmented.js +215 -0
- package/dist/components/ea-select.js +609 -0
- package/dist/components/ea-skeleton.js +263 -0
- package/dist/components/ea-slider.js +430 -0
- package/dist/components/ea-space.js +123 -0
- package/dist/components/ea-splitter.js +233 -0
- package/dist/components/ea-statistic.js +74 -0
- package/dist/components/ea-steps.js +346 -0
- package/dist/components/ea-switch.js +271 -0
- package/dist/components/ea-table.js +1137 -0
- package/dist/components/ea-tabs.js +503 -0
- package/dist/components/ea-tag.js +228 -0
- package/dist/components/ea-text.js +113 -0
- package/dist/components/ea-time-picker.js +510 -0
- package/dist/components/ea-timeline.js +185 -0
- package/dist/components/ea-tooltip.js +161 -0
- package/dist/components/ea-tour.js +544 -0
- package/dist/components/ea-transfer.js +949 -0
- package/dist/components/ea-tree.js +1125 -0
- package/dist/components/index.js +60 -0
- package/dist/core/FormBase.js +238 -0
- package/dist/css/ea-alert.style.js +4 -0
- package/dist/css/ea-aside.style.js +4 -0
- package/dist/css/ea-avatar.style.js +4 -0
- package/dist/css/ea-backtop.style.js +4 -0
- package/dist/css/ea-badge.style.js +4 -0
- package/dist/css/ea-breadcrumb-item.style.js +4 -0
- package/dist/css/ea-breadcrumb.style.js +4 -0
- package/dist/css/ea-button-group.style.js +4 -0
- package/dist/css/ea-button.style.js +4 -0
- package/dist/css/ea-calendar.style.js +4 -0
- package/dist/css/ea-card.style.js +4 -0
- package/dist/css/ea-carousel-item.style.js +4 -0
- package/dist/css/ea-carousel.style.js +4 -0
- package/dist/css/ea-check-tag.style.js +4 -0
- package/dist/css/ea-checkbox-group.style.js +4 -0
- package/dist/css/ea-checkbox.style.js +4 -0
- package/dist/css/ea-col.style.js +4 -0
- package/dist/css/ea-collapse-item.style.js +4 -0
- package/dist/css/ea-collapse.style.js +4 -0
- package/dist/css/ea-color-picker-panel.style.js +4 -0
- package/dist/css/ea-color-picker.style.js +4 -0
- package/dist/css/ea-container.style.js +4 -0
- package/dist/css/ea-date-picker.style.js +4 -0
- package/dist/css/ea-descriptions-item.style.js +4 -0
- package/dist/css/ea-descriptions.style.js +4 -0
- package/dist/css/ea-dialog.style.js +4 -0
- package/dist/css/ea-drawer.style.js +4 -0
- package/dist/css/ea-dropdown-item.style.js +4 -0
- package/dist/css/ea-dropdown-menu.style.js +4 -0
- package/dist/css/ea-dropdown.style.js +4 -0
- package/dist/css/ea-empty.style.js +4 -0
- package/dist/css/ea-footer.style.js +4 -0
- package/dist/css/ea-header.style.js +4 -0
- package/dist/css/ea-icon.style.js +4 -0
- package/dist/css/ea-image-preview.style.js +4 -0
- package/dist/css/ea-image.style.js +4 -0
- package/dist/css/ea-infinite-scroll.style.js +4 -0
- package/dist/css/ea-input-number.style.js +4 -0
- package/dist/css/ea-input.style.js +4 -0
- package/dist/css/ea-link.style.js +4 -0
- package/dist/css/ea-main.style.js +4 -0
- package/dist/css/ea-menu-item-group.style.js +4 -0
- package/dist/css/ea-menu-item.style.js +4 -0
- package/dist/css/ea-menu.style.js +4 -0
- package/dist/css/ea-message-box.style.js +4 -0
- package/dist/css/ea-message.style.js +4 -0
- package/dist/css/ea-notification.style.js +4 -0
- package/dist/css/ea-option-gropu.style.js +4 -0
- package/dist/css/ea-option.style.js +4 -0
- package/dist/css/ea-overlay.style.js +4 -0
- package/dist/css/ea-page-header.style.js +4 -0
- package/dist/css/ea-pagination.style.js +4 -0
- package/dist/css/ea-popconfirm.style.js +4 -0
- package/dist/css/ea-popover.style.js +4 -0
- package/dist/css/ea-popper.style.js +4 -0
- package/dist/css/ea-progress.style.js +4 -0
- package/dist/css/ea-radio-group.style.js +4 -0
- package/dist/css/ea-radio.style.js +4 -0
- package/dist/css/ea-rate.style.js +4 -0
- package/dist/css/ea-result.style.js +4 -0
- package/dist/css/ea-row.style.js +4 -0
- package/dist/css/ea-scrollbar.style.js +4 -0
- package/dist/css/ea-segmented.style.js +4 -0
- package/dist/css/ea-select.style.js +4 -0
- package/dist/css/ea-skeleton-item.style.js +4 -0
- package/dist/css/ea-skeleton.style.js +4 -0
- package/dist/css/ea-slider.style.js +4 -0
- package/dist/css/ea-space.style.js +4 -0
- package/dist/css/ea-splitter-bar.style.js +4 -0
- package/dist/css/ea-splitter-panel.style.js +4 -0
- package/dist/css/ea-splitter.style.js +4 -0
- package/dist/css/ea-statistic.style.js +4 -0
- package/dist/css/ea-step.style.js +4 -0
- package/dist/css/ea-steps.style.js +4 -0
- package/dist/css/ea-sub-menu.style.js +4 -0
- package/dist/css/ea-switch.style.js +4 -0
- package/dist/css/ea-tab-panel.style.js +4 -0
- package/dist/css/ea-tab.style.js +4 -0
- package/dist/css/ea-table-column.style.js +4 -0
- package/dist/css/ea-table.style.js +4 -0
- package/dist/css/ea-tabs.style.js +4 -0
- package/dist/css/ea-tag.style.js +4 -0
- package/dist/css/ea-text.style.js +4 -0
- package/dist/css/ea-time-picker.style.js +4 -0
- package/dist/css/ea-timeline-item.style.js +4 -0
- package/dist/css/ea-timeline.style.js +4 -0
- package/dist/css/ea-tooltip.style.js +4 -0
- package/dist/css/ea-tour-step.style.js +4 -0
- package/dist/css/ea-tour.style.js +4 -0
- package/dist/css/ea-transfer.style.js +5 -0
- package/dist/css/ea-tree.style.js +6 -0
- package/dist/css/ea-ui-component.style.js +4 -0
- package/dist/favicon.ico +0 -0
- package/dist/utils/Color.js +439 -0
- package/dist/utils/I18nManager.js +218 -0
- package/dist/utils/Utils.js +65 -0
- package/dist/utils/Variables.js +12 -0
- package/dist/utils/parseTime.js +73 -0
- package/dist/utils/timeout.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
var E = Object.defineProperty;
|
|
2
|
+
var S = (t) => {
|
|
3
|
+
throw TypeError(t);
|
|
4
|
+
};
|
|
5
|
+
var y = (t, r, e) => r in t ? E(t, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[r] = e;
|
|
6
|
+
var f = (t, r, e) => y(t, typeof r != "symbol" ? r + "" : r, e), w = (t, r, e) => r.has(t) || S("Cannot " + e);
|
|
7
|
+
var s = (t, r, e) => (w(t, r, "read from private field"), e ? e.call(t) : r.get(t)), a = (t, r, e) => r.has(t) ? S("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(t) : r.set(t, e), i = (t, r, e, n) => (w(t, r, "write to private field"), n ? n.call(t, e) : r.set(t, e), e);
|
|
8
|
+
import { B as C } from "./Base.js";
|
|
9
|
+
import { s as v } from "../css/ea-breadcrumb.style.js";
|
|
10
|
+
import { s as R } from "../css/ea-breadcrumb-item.style.js";
|
|
11
|
+
import { E as _ } from "../utils/Utils.js";
|
|
12
|
+
var l, c, d, b, p;
|
|
13
|
+
class $ extends C {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
/** @type {HTMLElement} */
|
|
17
|
+
a(this, l);
|
|
18
|
+
/** @type {HTMLSlotElement} */
|
|
19
|
+
a(this, c);
|
|
20
|
+
/** @type {AbortController} */
|
|
21
|
+
a(this, d, new AbortController());
|
|
22
|
+
f(this, "state", this.properties({
|
|
23
|
+
separator: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "/",
|
|
26
|
+
observer: () => {
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
/**
|
|
31
|
+
* 获取分隔符
|
|
32
|
+
* @param {string} defaultSeparator
|
|
33
|
+
* @returns {HTMLElement}
|
|
34
|
+
*/
|
|
35
|
+
a(this, b, (e = this.separator) => {
|
|
36
|
+
let o = this.shadowRoot.querySelector("#separatorSlot").assignedElements()[0];
|
|
37
|
+
return o || (o = document.createElement("span"), o.setAttribute("slot", "separator"), o.innerText = e), o;
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* 渲染分隔符
|
|
41
|
+
*/
|
|
42
|
+
a(this, p, () => {
|
|
43
|
+
const n = [...this.shadowRoot.querySelector("#defaultSlot").assignedElements()].filter(
|
|
44
|
+
(m) => m.tagName.toLowerCase() === "ea-breadcrumb-item"
|
|
45
|
+
), o = s(this, b).call(this, this.separator);
|
|
46
|
+
n.forEach((m, g) => {
|
|
47
|
+
g < n.length - 1 && !m.querySelector("[slot='separator']") && m.appendChild(o.cloneNode(!0));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
this.stylesheet = v, this.$render();
|
|
51
|
+
}
|
|
52
|
+
static get observedAttributes() {
|
|
53
|
+
return [...super.observedAttributes, "separator"];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 获取 classlist 列表
|
|
57
|
+
* @return {string} 属性值
|
|
58
|
+
*/
|
|
59
|
+
updateContainerClasslist() {
|
|
60
|
+
const e = this.computedClasslist("ea-breadcrumb", {
|
|
61
|
+
// ['--' + this.type]: this.type,
|
|
62
|
+
});
|
|
63
|
+
return s(this, l).className = e, e;
|
|
64
|
+
}
|
|
65
|
+
$render() {
|
|
66
|
+
this.shadowRoot.innerHTML = `
|
|
67
|
+
<nav class='ea-breadcrumb' part='container'>
|
|
68
|
+
<slot id="defaultSlot"></slot>
|
|
69
|
+
</nav>
|
|
70
|
+
<slot id="separatorSlot" name="separator"></slot>
|
|
71
|
+
`, i(this, l, this.shadowRoot.querySelector(".ea-breadcrumb")), i(this, c, this.shadowRoot.querySelector("#defaultSlot"));
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
super.connectedCallback(), s(this, c).addEventListener("slotchange", s(this, p), {
|
|
75
|
+
signal: s(this, d).signal
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
$beforeUnmounted() {
|
|
79
|
+
var e;
|
|
80
|
+
(e = s(this, d)) == null || e.abort();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
l = new WeakMap(), c = new WeakMap(), d = new WeakMap(), b = new WeakMap(), p = new WeakMap();
|
|
84
|
+
window.customElements.get("ea-breadcrumb") || window.customElements.define("ea-breadcrumb", $);
|
|
85
|
+
var u, h;
|
|
86
|
+
class q extends C {
|
|
87
|
+
constructor() {
|
|
88
|
+
super();
|
|
89
|
+
/** @type {HTMLElement} */
|
|
90
|
+
a(this, u);
|
|
91
|
+
/** @type {HTMLElement} */
|
|
92
|
+
a(this, h);
|
|
93
|
+
f(this, "state", this.properties({
|
|
94
|
+
href: {
|
|
95
|
+
type: String,
|
|
96
|
+
default: "",
|
|
97
|
+
observer: (e) => {
|
|
98
|
+
this.$render(), s(this, h).href = this.getAttribute("href");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
this.stylesheet = R, this.$render();
|
|
103
|
+
}
|
|
104
|
+
static get observedAttributes() {
|
|
105
|
+
return [...super.observedAttributes, "href"];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* 获取 classlist 列表
|
|
109
|
+
* @return {string} 属性值
|
|
110
|
+
*/
|
|
111
|
+
updateContainerClasslist() {
|
|
112
|
+
const e = this.computedClasslist("ea-breadcrumb-item", {
|
|
113
|
+
// ['--' + this.type]: this.type,
|
|
114
|
+
});
|
|
115
|
+
return s(this, u).className = e, e;
|
|
116
|
+
}
|
|
117
|
+
$render() {
|
|
118
|
+
const e = _.EaElement.h(
|
|
119
|
+
this.href ? "a" : "span",
|
|
120
|
+
"ea-breadcrumb-item__content",
|
|
121
|
+
{
|
|
122
|
+
part: "content",
|
|
123
|
+
[this.href ? "href" : ""]: this.href,
|
|
124
|
+
class: ["ea-breadcrumb-item__content", this.href ? "is-link" : ""]
|
|
125
|
+
},
|
|
126
|
+
"<slot></slot>"
|
|
127
|
+
);
|
|
128
|
+
this.shadowRoot.innerHTML = `
|
|
129
|
+
<div class='ea-breadcrumb-item' part='container'>
|
|
130
|
+
${e}
|
|
131
|
+
<span class="ea-breadcrumb-item__separator" part='separator'>
|
|
132
|
+
<slot name="separator"></slot>
|
|
133
|
+
</span>
|
|
134
|
+
</div>
|
|
135
|
+
`, i(this, u, this.shadowRoot.querySelector(".ea-breadcrumb-item")), i(this, h, this.shadowRoot.querySelector(
|
|
136
|
+
".ea-breadcrumb-item__content"
|
|
137
|
+
)), this.updateContainerClasslist();
|
|
138
|
+
}
|
|
139
|
+
connectedCallback() {
|
|
140
|
+
super.connectedCallback();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
u = new WeakMap(), h = new WeakMap();
|
|
144
|
+
window.customElements.get("ea-breadcrumb-item") || window.customElements.define("ea-breadcrumb-item", q);
|
|
145
|
+
export {
|
|
146
|
+
$ as EaBreadcrumb,
|
|
147
|
+
q as EaBreadcrumbItem
|
|
148
|
+
};
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var b = (e) => {
|
|
3
|
+
throw TypeError(e);
|
|
4
|
+
};
|
|
5
|
+
var y = (e, s, t) => s in e ? m(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
|
|
6
|
+
var c = (e, s, t) => y(e, typeof s != "symbol" ? s + "" : s, t), p = (e, s, t) => s.has(e) || b("Cannot " + t);
|
|
7
|
+
var a = (e, s, t) => (p(e, s, "read from private field"), t ? t.call(e) : s.get(e)), u = (e, s, t) => s.has(e) ? b("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), d = (e, s, t, r) => (p(e, s, "write to private field"), r ? r.call(e, t) : s.set(e, t), t);
|
|
8
|
+
import { F as C } from "../core/FormBase.js";
|
|
9
|
+
import { s as g } from "../css/ea-button.style.js";
|
|
10
|
+
import { B as v } from "./Base.js";
|
|
11
|
+
import { s as A } from "../css/ea-button-group.style.js";
|
|
12
|
+
var o, l, n, h;
|
|
13
|
+
class w extends C {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
/** @type {HTMLButtonElement | HTMLLinkElement} */
|
|
17
|
+
u(this, o);
|
|
18
|
+
/** @type {HTMLIconElement} */
|
|
19
|
+
u(this, l);
|
|
20
|
+
/** @type {AbortController} */
|
|
21
|
+
u(this, n);
|
|
22
|
+
/**
|
|
23
|
+
* @typedef {Object} state
|
|
24
|
+
* @property {boolean} disabled
|
|
25
|
+
* @property {string} type
|
|
26
|
+
* @property {string} text
|
|
27
|
+
* @property {boolean} plain
|
|
28
|
+
* @property {boolean} round
|
|
29
|
+
* @property {boolean} circle
|
|
30
|
+
* @property {boolean} link
|
|
31
|
+
* @property {string} href
|
|
32
|
+
* @property {string} size
|
|
33
|
+
* @property {boolean} loading
|
|
34
|
+
* @property {string} icon
|
|
35
|
+
*/
|
|
36
|
+
/** @type {state} */
|
|
37
|
+
c(this, "state", this.properties({
|
|
38
|
+
disabled: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !1,
|
|
41
|
+
observer: (t) => {
|
|
42
|
+
this.updateContainerClasslist();
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
type: {
|
|
46
|
+
type: ["normal", "primary", "success", "warning", "danger"],
|
|
47
|
+
default: "normal",
|
|
48
|
+
observer: (t) => {
|
|
49
|
+
this.updateContainerClasslist();
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
text: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: !1,
|
|
55
|
+
observer: (t) => {
|
|
56
|
+
this.updateContainerClasslist();
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
plain: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: !1,
|
|
62
|
+
observer: (t) => {
|
|
63
|
+
this.updateContainerClasslist();
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
round: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
default: !1,
|
|
69
|
+
observer: (t) => {
|
|
70
|
+
this.updateContainerClasslist();
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
circle: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: !1,
|
|
76
|
+
observer: (t) => {
|
|
77
|
+
this.updateContainerClasslist();
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
link: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: !1,
|
|
83
|
+
observer: (t) => {
|
|
84
|
+
this.$render(), a(this, o).href = this.getAttribute("href"), this.updateContainerClasslist();
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
href: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: "",
|
|
90
|
+
observer: (t) => {
|
|
91
|
+
this.updateContainerClasslist(), a(this, o).setAttribute("href", t);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
size: {
|
|
95
|
+
type: ["small", "medium", "large"],
|
|
96
|
+
default: "medium",
|
|
97
|
+
observer: (t) => {
|
|
98
|
+
this.updateContainerClasslist();
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
loading: {
|
|
102
|
+
type: Boolean,
|
|
103
|
+
default: !1,
|
|
104
|
+
observer: (t) => {
|
|
105
|
+
var r;
|
|
106
|
+
if (t = t === "true" || t === !0, this.toggleAttribute("disabled", t), t) {
|
|
107
|
+
const i = document.createElement("ea-icon");
|
|
108
|
+
i.id = "ea-loading-icon", i.setAttribute("name", "spinner"), i.toggleAttribute("spin", !0), i.setAttribute("size", this.size), i.setAttribute("part", "loading-icon"), a(this, o).insertBefore(i, a(this, o).firstChild);
|
|
109
|
+
} else {
|
|
110
|
+
const i = (r = a(this, o)) == null ? void 0 : r.querySelectorAll("#ea-loading-icon");
|
|
111
|
+
(i == null ? void 0 : i.length) > 0 && (i == null || i.forEach((f) => f.remove()));
|
|
112
|
+
}
|
|
113
|
+
this.updateContainerClasslist();
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
icon: {
|
|
117
|
+
type: String,
|
|
118
|
+
default: "",
|
|
119
|
+
observer: (t) => {
|
|
120
|
+
a(this, l).setAttribute("name", t), a(this, l).setAttribute("size", this.size), this.updateContainerClasslist();
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"button-type": {
|
|
124
|
+
type: ["button", "submit", "reset"],
|
|
125
|
+
default: "button",
|
|
126
|
+
observer: (t) => {
|
|
127
|
+
a(this, o).type = t;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}));
|
|
131
|
+
/**
|
|
132
|
+
* @param {KeyboardEvent} e
|
|
133
|
+
*/
|
|
134
|
+
u(this, h, (t) => {
|
|
135
|
+
t.key === "Enter" && this.click();
|
|
136
|
+
});
|
|
137
|
+
this.stylesheet = g, this.$render();
|
|
138
|
+
}
|
|
139
|
+
static get observedAttributes() {
|
|
140
|
+
return [
|
|
141
|
+
"disabled",
|
|
142
|
+
"type",
|
|
143
|
+
"button-type",
|
|
144
|
+
// 暂定为原生 type 属性
|
|
145
|
+
"text",
|
|
146
|
+
"plain",
|
|
147
|
+
"round",
|
|
148
|
+
"circle",
|
|
149
|
+
"link",
|
|
150
|
+
"href",
|
|
151
|
+
"size",
|
|
152
|
+
"loading",
|
|
153
|
+
"icon"
|
|
154
|
+
];
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* 获取 classlist 列表
|
|
158
|
+
* @return {string} 属性值
|
|
159
|
+
*/
|
|
160
|
+
updateContainerClasslist() {
|
|
161
|
+
var r;
|
|
162
|
+
const t = this.computedClasslist(
|
|
163
|
+
"ea-button",
|
|
164
|
+
{
|
|
165
|
+
["--" + this.type]: this.type,
|
|
166
|
+
"--disabled": this.disabled || this.loading,
|
|
167
|
+
"--text": this.text || this.link,
|
|
168
|
+
"--plain": this.plain,
|
|
169
|
+
"--round": this.round,
|
|
170
|
+
"--circle": this.circle,
|
|
171
|
+
["--" + this.size]: this.size
|
|
172
|
+
},
|
|
173
|
+
{ icon: (r = this.icon) == null ? void 0 : r.length }
|
|
174
|
+
);
|
|
175
|
+
return a(this, o).className = t, t;
|
|
176
|
+
}
|
|
177
|
+
$render() {
|
|
178
|
+
const t = this.getAttrBoolean("link") ? "a" : "button";
|
|
179
|
+
this.shadowRoot.innerHTML = `
|
|
180
|
+
<${t} class="ea-button" part="container" tabindex="-1">
|
|
181
|
+
<ea-icon class="ea-button__icon" part="icon"></ea-icon>
|
|
182
|
+
<slot></slot>
|
|
183
|
+
</${t}>
|
|
184
|
+
`, d(this, o, this.shadowRoot.querySelector(".ea-button")), d(this, l, this.shadowRoot.querySelector(".ea-button__icon")), this.updateContainerClasslist();
|
|
185
|
+
}
|
|
186
|
+
connectedCallback() {
|
|
187
|
+
var t;
|
|
188
|
+
super.connectedCallback(), (t = a(this, n)) == null || t.abort(), d(this, n, new AbortController()), this.addEventListener("keypress", a(this, h), {
|
|
189
|
+
signal: a(this, n).signal
|
|
190
|
+
}), this.addEventListener("click", (r) => {
|
|
191
|
+
if (this["button-type"] === "submit") {
|
|
192
|
+
const i = this.getForm();
|
|
193
|
+
i && (r.preventDefault(), i.dispatchEvent(new Event("submit")));
|
|
194
|
+
} else if (this["button-type"] === "reset") {
|
|
195
|
+
const i = this.getForm();
|
|
196
|
+
i && (r.preventDefault(), i.reset());
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
$beforeUnmounted() {
|
|
201
|
+
var t;
|
|
202
|
+
(t = a(this, n)) == null || t.abort();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
o = new WeakMap(), l = new WeakMap(), n = new WeakMap(), h = new WeakMap();
|
|
206
|
+
window.customElements.get("ea-button") || window.customElements.define("ea-button", w);
|
|
207
|
+
class E extends v {
|
|
208
|
+
constructor() {
|
|
209
|
+
super();
|
|
210
|
+
/**
|
|
211
|
+
* @typedef {object} Properties
|
|
212
|
+
* @property {boolean} disabled
|
|
213
|
+
* @property {string} size
|
|
214
|
+
* @property {string} type
|
|
215
|
+
*/
|
|
216
|
+
/** @type {Properties} */
|
|
217
|
+
c(this, "state", this.properties({
|
|
218
|
+
disabled: {
|
|
219
|
+
type: Boolean,
|
|
220
|
+
default: !1,
|
|
221
|
+
observer: (t) => {
|
|
222
|
+
this.querySelectorAll("ea-button").forEach((r) => {
|
|
223
|
+
r.setAttribute("disabled", t);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
size: {
|
|
228
|
+
type: ["small", "normal", "large"],
|
|
229
|
+
default: "normal",
|
|
230
|
+
observer: (t) => {
|
|
231
|
+
this.querySelectorAll("ea-button").forEach((r) => {
|
|
232
|
+
r.setAttribute("size", t);
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
type: {
|
|
237
|
+
type: ["primary", "success", "warning", "danger", "normal"],
|
|
238
|
+
default: "normal",
|
|
239
|
+
observer: (t) => {
|
|
240
|
+
this.querySelectorAll("ea-button").forEach((r) => {
|
|
241
|
+
r.setAttribute("type", t);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}));
|
|
246
|
+
this.stylesheet = A, this.$render();
|
|
247
|
+
}
|
|
248
|
+
static get observedAttributes() {
|
|
249
|
+
return [...super.observedAttributes, "disabled", "size", "type"];
|
|
250
|
+
}
|
|
251
|
+
$render() {
|
|
252
|
+
this.shadowRoot.innerHTML = this.html(`
|
|
253
|
+
<div class="ea-button-group">
|
|
254
|
+
<slot></slot>
|
|
255
|
+
</div>
|
|
256
|
+
`);
|
|
257
|
+
}
|
|
258
|
+
async connectedCallback() {
|
|
259
|
+
super.connectedCallback();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
window.customElements.get("ea-button-group") || window.customElements.define("ea-button-group", E);
|
|
263
|
+
export {
|
|
264
|
+
w as EaButton,
|
|
265
|
+
E as EaButtonGroup
|
|
266
|
+
};
|