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,132 @@
|
|
|
1
|
+
var a = Object.defineProperty;
|
|
2
|
+
var l = (s, t, e) => t in s ? a(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var r = (s, t, e) => l(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { B as o } from "./Base.js";
|
|
5
|
+
import { s as n } from "../css/ea-col.style.js";
|
|
6
|
+
import { s as i } from "../css/ea-row.style.js";
|
|
7
|
+
class p extends o {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {Object} State
|
|
12
|
+
* @property {Number} span 列数
|
|
13
|
+
* @property {Number} offset 列偏移
|
|
14
|
+
* @property {Number} push 列向右移动
|
|
15
|
+
* @property {Number} pull 列向左移动
|
|
16
|
+
*/
|
|
17
|
+
/** @type {State} */
|
|
18
|
+
r(this, "state", this.properties({
|
|
19
|
+
span: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 24,
|
|
22
|
+
observer: (e) => {
|
|
23
|
+
this.style.setProperty("--ea-col-span", e);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
offset: {
|
|
27
|
+
type: Number,
|
|
28
|
+
default: 0,
|
|
29
|
+
observer: (e) => {
|
|
30
|
+
this.style.setProperty("--ea-col-offset", e);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
push: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 0,
|
|
36
|
+
observer: (e) => {
|
|
37
|
+
this.style.setProperty("--ea-col-push", e);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
pull: {
|
|
41
|
+
type: Number,
|
|
42
|
+
default: 0,
|
|
43
|
+
observer: (e) => {
|
|
44
|
+
this.style.setProperty("--ea-col-pull", e);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
tag: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "div",
|
|
50
|
+
observer: (e) => {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}));
|
|
54
|
+
this.stylesheet = n, this.$render();
|
|
55
|
+
}
|
|
56
|
+
static get observedAttributes() {
|
|
57
|
+
return ["span", "offset", "push", "pull", "tag"];
|
|
58
|
+
}
|
|
59
|
+
$render() {
|
|
60
|
+
this.shadowRoot.innerHTML = `
|
|
61
|
+
<${this.tag} class="ea-row" part="container">
|
|
62
|
+
<slot></slot>
|
|
63
|
+
</${this.tag}>
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
connectedCallback() {
|
|
67
|
+
super.connectedCallback();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
window.customElements.get("ea-col") || window.customElements.define("ea-col", p);
|
|
71
|
+
class u extends o {
|
|
72
|
+
constructor() {
|
|
73
|
+
super();
|
|
74
|
+
/**
|
|
75
|
+
* @typedef {Object} State
|
|
76
|
+
* @property {string} gutter - 列类型
|
|
77
|
+
* @property {string} justify - 列对齐方式
|
|
78
|
+
* @property {string} align - 列对齐方式
|
|
79
|
+
*/
|
|
80
|
+
/** @type {State} */
|
|
81
|
+
r(this, "state", this.properties({
|
|
82
|
+
gutter: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: 0,
|
|
85
|
+
observer: (e) => {
|
|
86
|
+
this.style.setProperty("--ea-row-gutter", e / 2 + "px");
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
justify: {
|
|
90
|
+
type: [
|
|
91
|
+
"start",
|
|
92
|
+
"end",
|
|
93
|
+
"center",
|
|
94
|
+
"space-around",
|
|
95
|
+
"space-between",
|
|
96
|
+
"space-evenly"
|
|
97
|
+
],
|
|
98
|
+
default: "start",
|
|
99
|
+
observer: (e) => {
|
|
100
|
+
this.style.setProperty("--ea-row-justify", e);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
align: {
|
|
104
|
+
type: ["top", "middle", "bottom"],
|
|
105
|
+
default: "",
|
|
106
|
+
observer: (e) => {
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
tag: {
|
|
110
|
+
type: String,
|
|
111
|
+
default: "div",
|
|
112
|
+
observer: (e) => {
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
this.stylesheet = i, this.$render();
|
|
117
|
+
}
|
|
118
|
+
static get observedAttributes() {
|
|
119
|
+
return ["gutter", "justify", "align", "tag"];
|
|
120
|
+
}
|
|
121
|
+
$render() {
|
|
122
|
+
this.shadowRoot.innerHTML = `
|
|
123
|
+
<${this.tag} class="ea-row" part="container">
|
|
124
|
+
<slot></slot>
|
|
125
|
+
</${this.tag}>
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
connectedCallback() {
|
|
129
|
+
super.connectedCallback();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
window.customElements.get("ea-row") || window.customElements.define("ea-row", u);
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var d = (t) => {
|
|
3
|
+
throw TypeError(t);
|
|
4
|
+
};
|
|
5
|
+
var p = (t, s, e) => s in t ? u(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
6
|
+
var c = (t, s, e) => p(t, typeof s != "symbol" ? s + "" : s, e), h = (t, s, e) => s.has(t) || d("Cannot " + e);
|
|
7
|
+
var a = (t, s, e) => (h(t, s, "read from private field"), e ? e.call(t) : s.get(t)), r = (t, s, e) => s.has(t) ? d("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), l = (t, s, e, o) => (h(t, s, "write to private field"), o ? o.call(t, e) : s.set(t, e), e);
|
|
8
|
+
import { B as m } from "./Base.js";
|
|
9
|
+
import { s as b } from "../css/ea-link.style.js";
|
|
10
|
+
var i, n;
|
|
11
|
+
class y extends m {
|
|
12
|
+
constructor() {
|
|
13
|
+
super();
|
|
14
|
+
/** @type {HTMLAnchorElement} */
|
|
15
|
+
r(this, i);
|
|
16
|
+
/** @type {HTMLElement} */
|
|
17
|
+
r(this, n);
|
|
18
|
+
/**
|
|
19
|
+
* @typedef {Object} LinkState
|
|
20
|
+
* @property {string} type
|
|
21
|
+
* @property {Boolean} disabled
|
|
22
|
+
* @property {Boolean} underline
|
|
23
|
+
* @property {string} href
|
|
24
|
+
* @property {string} icon
|
|
25
|
+
*/
|
|
26
|
+
/** @type {LinkState} */
|
|
27
|
+
c(this, "state", this.properties({
|
|
28
|
+
type: {
|
|
29
|
+
type: ["normal", "primary", "success", "info", "warning", "danger"],
|
|
30
|
+
default: "normal",
|
|
31
|
+
observer: (e) => {
|
|
32
|
+
a(this, i).className = this.updateContainerClasslist();
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
disabled: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: !1,
|
|
38
|
+
observer: (e) => {
|
|
39
|
+
a(this, i).className = this.updateContainerClasslist();
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
underline: {
|
|
43
|
+
type: ["always", "hover", "never"],
|
|
44
|
+
default: "",
|
|
45
|
+
observer: (e) => {
|
|
46
|
+
a(this, i).className = this.updateContainerClasslist();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
href: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: "",
|
|
52
|
+
observer: (e) => {
|
|
53
|
+
a(this, i).href = e;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
icon: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: "",
|
|
59
|
+
observer: (e) => {
|
|
60
|
+
a(this, n).setAttribute("name", e), a(this, i).className = this.updateContainerClasslist();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}));
|
|
64
|
+
this.stylesheet = b, this.$render();
|
|
65
|
+
}
|
|
66
|
+
static get observedAttributes() {
|
|
67
|
+
return ["type", "disabled", "underline", "href", "icon"];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 获取 classlist 列表
|
|
71
|
+
* @return {string} 属性值
|
|
72
|
+
*/
|
|
73
|
+
updateContainerClasslist() {
|
|
74
|
+
var e;
|
|
75
|
+
return this.computedClasslist(
|
|
76
|
+
"ea-link",
|
|
77
|
+
{
|
|
78
|
+
["--" + this.type]: this.type,
|
|
79
|
+
["--underline-" + this.underline]: this.underline,
|
|
80
|
+
"--disabled": this.disabled
|
|
81
|
+
},
|
|
82
|
+
{ icon: (e = this.icon) == null ? void 0 : e.length }
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
$render() {
|
|
86
|
+
this.shadowRoot.innerHTML = `
|
|
87
|
+
<a class="ea-link" part="container" tabindex="-1">
|
|
88
|
+
<ea-icon class="ea-link__icon" part="icon"></ea-icon>
|
|
89
|
+
<slot></slot>
|
|
90
|
+
</a>
|
|
91
|
+
`, l(this, i, this.shadowRoot.querySelector(".ea-link")), l(this, n, this.shadowRoot.querySelector(".ea-link__icon"));
|
|
92
|
+
}
|
|
93
|
+
connectedCallback() {
|
|
94
|
+
super.connectedCallback();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
i = new WeakMap(), n = new WeakMap();
|
|
98
|
+
window.customElements.get("ea-link") || window.customElements.define("ea-link", y);
|
|
99
|
+
export {
|
|
100
|
+
y as EaLink
|
|
101
|
+
};
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
var I = Object.defineProperty;
|
|
2
|
+
var R = (s) => {
|
|
3
|
+
throw TypeError(s);
|
|
4
|
+
};
|
|
5
|
+
var N = (s, i, e) => i in s ? I(s, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[i] = e;
|
|
6
|
+
var p = (s, i, e) => N(s, typeof i != "symbol" ? i + "" : i, e), H = (s, i, e) => i.has(s) || R("Cannot " + e);
|
|
7
|
+
var t = (s, i, e) => (H(s, i, "read from private field"), e ? e.call(s) : i.get(s)), r = (s, i, e) => i.has(s) ? R("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, e), a = (s, i, e, o) => (H(s, i, "write to private field"), o ? o.call(s, e) : i.set(s, e), e);
|
|
8
|
+
import { B as q } from "./Base.js";
|
|
9
|
+
import { s as P } from "../css/ea-menu.style.js";
|
|
10
|
+
import { s as T } from "../css/ea-menu-item.style.js";
|
|
11
|
+
import { s as U } from "../css/ea-menu-item-group.style.js";
|
|
12
|
+
import { s as z } from "../css/ea-sub-menu.style.js";
|
|
13
|
+
var u, c, E, v, x;
|
|
14
|
+
class D extends q {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
/** @type {HTMLElement} */
|
|
18
|
+
r(this, u);
|
|
19
|
+
/** @type {AbortController} */
|
|
20
|
+
r(this, c, new AbortController());
|
|
21
|
+
p(this, "state", this.properties({
|
|
22
|
+
mode: {
|
|
23
|
+
type: ["horizontal", "vertical"],
|
|
24
|
+
default: "vertical",
|
|
25
|
+
observer: (e) => {
|
|
26
|
+
t(this, E).call(this, e), this.updateContainerClasslist();
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"background-color": {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "#ffffff",
|
|
32
|
+
observer: (e) => {
|
|
33
|
+
t(this, u).style.setProperty("--ea-menu-bg-color", e);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"text-color": {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "#303133",
|
|
39
|
+
observer: (e) => {
|
|
40
|
+
t(this, u).style.setProperty("--ea-menu-text-color", e);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"active-text-color": {
|
|
44
|
+
type: String,
|
|
45
|
+
default: "#409eff",
|
|
46
|
+
observer: (e) => {
|
|
47
|
+
t(this, u).style.setProperty(
|
|
48
|
+
"--ea-menu-active-text-color",
|
|
49
|
+
e
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"default-active": {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "",
|
|
56
|
+
observer: () => {
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
// TODO: 没写😋
|
|
60
|
+
collapse: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: !1,
|
|
63
|
+
observer: () => {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// TODO: 没写disabled😋
|
|
67
|
+
}));
|
|
68
|
+
/**
|
|
69
|
+
* 更新子菜单模式
|
|
70
|
+
* @param {string} mode
|
|
71
|
+
*/
|
|
72
|
+
r(this, E, (e) => {
|
|
73
|
+
this.querySelectorAll("ea-sub-menu").forEach((o) => {
|
|
74
|
+
o.setAttribute("mode", e);
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* 处理菜单项点击事件
|
|
79
|
+
* @param {MouseEvent} e
|
|
80
|
+
*/
|
|
81
|
+
r(this, v, (e) => {
|
|
82
|
+
const o = [...this.querySelectorAll("ea-menu-item")], l = [...this.querySelectorAll("ea-sub-menu")], b = e.target.closest("ea-menu-item");
|
|
83
|
+
if (e.target.closest("ea-sub-menu") || b) {
|
|
84
|
+
const L = (B) => B.removeAttribute("active");
|
|
85
|
+
o.forEach(L), l.forEach(L);
|
|
86
|
+
}
|
|
87
|
+
b && (b.toggleAttribute("active", !0), this.emit("select", {
|
|
88
|
+
detail: {
|
|
89
|
+
index: b.index || b.getAttribute("index"),
|
|
90
|
+
target: b
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* 初始化默认激活项
|
|
96
|
+
*/
|
|
97
|
+
r(this, x, () => {
|
|
98
|
+
const e = this.querySelector(
|
|
99
|
+
`ea-menu-item[index="${this["default-active"]}"]`
|
|
100
|
+
);
|
|
101
|
+
e && e.click();
|
|
102
|
+
});
|
|
103
|
+
this.stylesheet = P, this.$render();
|
|
104
|
+
}
|
|
105
|
+
static get observedAttributes() {
|
|
106
|
+
return [
|
|
107
|
+
...super.observedAttributes,
|
|
108
|
+
"mode",
|
|
109
|
+
"background-color",
|
|
110
|
+
"text-color",
|
|
111
|
+
"active-text-color",
|
|
112
|
+
"collapse",
|
|
113
|
+
"default-active"
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* 获取 classlist 列表
|
|
118
|
+
* @return {string} 属性值
|
|
119
|
+
*/
|
|
120
|
+
updateContainerClasslist() {
|
|
121
|
+
const e = this.computedClasslist(
|
|
122
|
+
"ea-menu",
|
|
123
|
+
{
|
|
124
|
+
["--" + this.mode]: this.mode
|
|
125
|
+
},
|
|
126
|
+
{}
|
|
127
|
+
);
|
|
128
|
+
return t(this, u).className = e, e;
|
|
129
|
+
}
|
|
130
|
+
$render() {
|
|
131
|
+
this.shadowRoot.innerHTML = `
|
|
132
|
+
<ul class='ea-menu' role="menubar" part='container'>
|
|
133
|
+
<slot></slot>
|
|
134
|
+
</ul>
|
|
135
|
+
`, a(this, u, this.shadowRoot.querySelector(".ea-menu")), this.updateContainerClasslist();
|
|
136
|
+
}
|
|
137
|
+
connectedCallback() {
|
|
138
|
+
var e;
|
|
139
|
+
super.connectedCallback(), (e = t(this, c)) == null || e.abort(), a(this, c, new AbortController()), this.addEventListener("click", t(this, v), {
|
|
140
|
+
signal: t(this, c).signal
|
|
141
|
+
}), this.addEventListener("ea-sub-menu-click", t(this, v), {
|
|
142
|
+
signal: t(this, c).signal
|
|
143
|
+
}), t(this, x).call(this);
|
|
144
|
+
}
|
|
145
|
+
$beforeUnmounted() {
|
|
146
|
+
t(this, c).abort();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
u = new WeakMap(), c = new WeakMap(), E = new WeakMap(), v = new WeakMap(), x = new WeakMap();
|
|
150
|
+
window.customElements.get("ea-menu") || window.customElements.define("ea-menu", D);
|
|
151
|
+
var f;
|
|
152
|
+
class G extends q {
|
|
153
|
+
constructor() {
|
|
154
|
+
super();
|
|
155
|
+
/** @type {HTMLElement} */
|
|
156
|
+
r(this, f);
|
|
157
|
+
p(this, "state", this.properties({
|
|
158
|
+
index: {
|
|
159
|
+
type: String,
|
|
160
|
+
default: "",
|
|
161
|
+
observer: () => {
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
disabled: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
default: !1,
|
|
167
|
+
observer: () => {
|
|
168
|
+
this.updateContainerClasslist();
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
active: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: !1,
|
|
174
|
+
observer: () => {
|
|
175
|
+
this.updateContainerClasslist();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}));
|
|
179
|
+
this.stylesheet = T, this.$render();
|
|
180
|
+
}
|
|
181
|
+
static get observedAttributes() {
|
|
182
|
+
return [...super.observedAttributes, "index", "disabled", "active"];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* 获取 classlist 列表
|
|
186
|
+
* @return {string} 属性值
|
|
187
|
+
*/
|
|
188
|
+
updateContainerClasslist() {
|
|
189
|
+
const e = this.computedClasslist(
|
|
190
|
+
"ea-menu-item",
|
|
191
|
+
{},
|
|
192
|
+
{
|
|
193
|
+
disabled: this.disabled,
|
|
194
|
+
active: this.active
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
return t(this, f).className = e, e;
|
|
198
|
+
}
|
|
199
|
+
$render() {
|
|
200
|
+
this.shadowRoot.innerHTML = `
|
|
201
|
+
<li class='ea-menu-item' role="menuitem" part='container'>
|
|
202
|
+
<slot></slot>
|
|
203
|
+
</li>
|
|
204
|
+
`, a(this, f, this.shadowRoot.querySelector(".ea-menu-item"));
|
|
205
|
+
}
|
|
206
|
+
connectedCallback() {
|
|
207
|
+
super.connectedCallback();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
f = new WeakMap();
|
|
211
|
+
window.customElements.get("ea-menu-item") || window.customElements.define("ea-menu-item", G);
|
|
212
|
+
var S, C, $;
|
|
213
|
+
class V extends q {
|
|
214
|
+
constructor() {
|
|
215
|
+
super();
|
|
216
|
+
/** @type {HTMLElement} */
|
|
217
|
+
r(this, S);
|
|
218
|
+
/** @type {HTMLSlotElement} */
|
|
219
|
+
r(this, C);
|
|
220
|
+
/** @type {AbortController} */
|
|
221
|
+
r(this, $, new AbortController());
|
|
222
|
+
p(this, "state", this.properties({
|
|
223
|
+
title: {
|
|
224
|
+
type: String,
|
|
225
|
+
default: "",
|
|
226
|
+
observer: (e) => {
|
|
227
|
+
t(this, C).textContent = e;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}));
|
|
231
|
+
this.stylesheet = U, this.$render();
|
|
232
|
+
}
|
|
233
|
+
static get observedAttributes() {
|
|
234
|
+
return [...super.observedAttributes, "title"];
|
|
235
|
+
}
|
|
236
|
+
$render() {
|
|
237
|
+
this.shadowRoot.innerHTML = `
|
|
238
|
+
<div class='ea-menu-item-group' part='container'>
|
|
239
|
+
<header class='ea-menu-item-group__title' part='title'>
|
|
240
|
+
<slot name="title">${this.title}</slot>
|
|
241
|
+
</header>
|
|
242
|
+
<div class='ea-menu-item-group__content' part='content'>
|
|
243
|
+
<slot></slot>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
`, a(this, S, this.shadowRoot.querySelector(".ea-menu-item-group")), a(this, C, this.shadowRoot.querySelector("slot[name='title']"));
|
|
247
|
+
}
|
|
248
|
+
connectedCallback() {
|
|
249
|
+
super.connectedCallback();
|
|
250
|
+
}
|
|
251
|
+
$beforeUnmounted() {
|
|
252
|
+
t(this, $).abort();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
S = new WeakMap(), C = new WeakMap(), $ = new WeakMap();
|
|
256
|
+
window.customElements.get("ea-menu-item-group") || window.customElements.define("ea-menu-item-group", V);
|
|
257
|
+
var g, y, w, n, m, h, d, k, M, _, A;
|
|
258
|
+
class j extends q {
|
|
259
|
+
constructor() {
|
|
260
|
+
super();
|
|
261
|
+
/** @type {HTMLElement} */
|
|
262
|
+
r(this, g);
|
|
263
|
+
/** @type {HTMLElement} */
|
|
264
|
+
r(this, y);
|
|
265
|
+
/** @type {HTMLSlotElement} */
|
|
266
|
+
r(this, w);
|
|
267
|
+
/** @type {HTMLElement} */
|
|
268
|
+
r(this, n);
|
|
269
|
+
/** @type {AbortController} */
|
|
270
|
+
r(this, m, new AbortController());
|
|
271
|
+
/** @type {AbortController} */
|
|
272
|
+
r(this, h, new AbortController());
|
|
273
|
+
/** @type {AbortController} */
|
|
274
|
+
r(this, d, new AbortController());
|
|
275
|
+
p(this, "state", this.properties({
|
|
276
|
+
open: {
|
|
277
|
+
props: !0,
|
|
278
|
+
type: Boolean,
|
|
279
|
+
default: !1,
|
|
280
|
+
observer: () => {
|
|
281
|
+
this.updateContainerClasslist();
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
index: {
|
|
285
|
+
type: String,
|
|
286
|
+
default: "",
|
|
287
|
+
observer: () => {
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
disabled: {
|
|
291
|
+
type: Boolean,
|
|
292
|
+
default: !1,
|
|
293
|
+
observer: () => {
|
|
294
|
+
this.updateContainerClasslist();
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
active: {
|
|
298
|
+
type: Boolean,
|
|
299
|
+
default: !1,
|
|
300
|
+
observer: () => {
|
|
301
|
+
this.updateContainerClasslist();
|
|
302
|
+
}
|
|
303
|
+
},
|
|
304
|
+
mode: {
|
|
305
|
+
type: ["horizontal", "vertical"],
|
|
306
|
+
default: "vertical",
|
|
307
|
+
observer: (e) => {
|
|
308
|
+
t(this, A).call(this, e), this.updateContainerClasslist();
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
label: {
|
|
312
|
+
type: String,
|
|
313
|
+
default: "",
|
|
314
|
+
observer: (e) => {
|
|
315
|
+
t(this, w).textContent = e;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}));
|
|
319
|
+
/**
|
|
320
|
+
* 菜单项点击事件
|
|
321
|
+
* @param {MouseEvent} e
|
|
322
|
+
*/
|
|
323
|
+
r(this, k, (e) => {
|
|
324
|
+
e.stopImmediatePropagation(), e.preventDefault();
|
|
325
|
+
const o = e.target.closest("ea-menu-item"), l = this.closest("ea-sub-menu") === this ? this.parentElement.closest("ea-sub-menu") : this.closest("ea-sub-menu");
|
|
326
|
+
o && (this.emit("ea-sub-menu-click", {
|
|
327
|
+
detail: { index: this.index },
|
|
328
|
+
bubbles: !0
|
|
329
|
+
}), this.setAttribute("active", "true"), l && l.setAttribute("active", "true"), o.setAttribute("active", "true"));
|
|
330
|
+
});
|
|
331
|
+
/**
|
|
332
|
+
* 鼠标悬停事件
|
|
333
|
+
* @param {MouseEvent} e
|
|
334
|
+
*/
|
|
335
|
+
r(this, M, () => {
|
|
336
|
+
var o;
|
|
337
|
+
(o = t(this, h)) == null || o.abort(), a(this, h, new AbortController()), this.open = !0;
|
|
338
|
+
const e = () => {
|
|
339
|
+
var l;
|
|
340
|
+
this.open = !1, (l = t(this, h)) == null || l.abort();
|
|
341
|
+
};
|
|
342
|
+
this.addEventListener("mouseleave", e, {
|
|
343
|
+
signal: t(this, h).signal
|
|
344
|
+
});
|
|
345
|
+
});
|
|
346
|
+
/**
|
|
347
|
+
* 垂直菜单折叠事件
|
|
348
|
+
*/
|
|
349
|
+
r(this, _, () => {
|
|
350
|
+
this.open = !this.open, this.open || (t(this, n).style.setProperty("--ea-sub-menu-transition", "none"), t(this, n).offsetHeight, t(this, n).style.height = `${t(this, n).scrollHeight}px`, t(this, n).offsetHeight, t(this, n).style.removeProperty("--ea-sub-menu-transition")), t(this, n).style.height = `${this.open ? t(this, n).scrollHeight : 0}px`, t(this, n).addEventListener(
|
|
351
|
+
"transitionend",
|
|
352
|
+
() => {
|
|
353
|
+
t(this, n).style.height = this.open ? "100%" : 0;
|
|
354
|
+
},
|
|
355
|
+
{ once: !0 }
|
|
356
|
+
);
|
|
357
|
+
});
|
|
358
|
+
/**
|
|
359
|
+
* 菜单模式切换
|
|
360
|
+
* @param {string} [mode]
|
|
361
|
+
*/
|
|
362
|
+
r(this, A, (e = this.mode) => {
|
|
363
|
+
var o;
|
|
364
|
+
(o = t(this, d)) == null || o.abort(), a(this, d, new AbortController()), e === "vertical" ? t(this, y).addEventListener("click", t(this, _), {
|
|
365
|
+
signal: t(this, d).signal
|
|
366
|
+
}) : this.addEventListener("mouseenter", t(this, M), {
|
|
367
|
+
signal: t(this, d).signal
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
this.stylesheet = z, this.$render();
|
|
371
|
+
}
|
|
372
|
+
static get observedAttributes() {
|
|
373
|
+
return [
|
|
374
|
+
...super.observedAttributes,
|
|
375
|
+
"active",
|
|
376
|
+
"index",
|
|
377
|
+
"disabled",
|
|
378
|
+
"mode",
|
|
379
|
+
"label"
|
|
380
|
+
];
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* 获取 classlist 列表
|
|
384
|
+
* @return {string} 属性值
|
|
385
|
+
*/
|
|
386
|
+
updateContainerClasslist() {
|
|
387
|
+
const e = this.computedClasslist(
|
|
388
|
+
"ea-sub-menu",
|
|
389
|
+
{
|
|
390
|
+
["--" + this.mode]: this.mode
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
disabled: this.disabled,
|
|
394
|
+
active: this.active,
|
|
395
|
+
open: this.open
|
|
396
|
+
}
|
|
397
|
+
);
|
|
398
|
+
return t(this, g).className = e, e;
|
|
399
|
+
}
|
|
400
|
+
$render() {
|
|
401
|
+
var o;
|
|
402
|
+
const e = (o = this.parentElement) == null ? void 0 : o.closest("ea-sub-menu");
|
|
403
|
+
this.shadowRoot.innerHTML = `
|
|
404
|
+
<div class='ea-sub-menu' part='container'>
|
|
405
|
+
<header class='ea-sub-menu__title' part='title'>
|
|
406
|
+
<slot name='title'></slot>
|
|
407
|
+
<ea-icon name="${e ? "angle-right" : "angle-down"}" class='ea-sub-menu__arrow' part='arrow'></ea-icon>
|
|
408
|
+
</header>
|
|
409
|
+
<ul class='ea-sub-menu__content' part='content'>
|
|
410
|
+
<slot></slot>
|
|
411
|
+
</ul>
|
|
412
|
+
</div>
|
|
413
|
+
`, a(this, g, this.shadowRoot.querySelector(".ea-sub-menu")), a(this, y, this.shadowRoot.querySelector(".ea-sub-menu__title")), a(this, w, this.shadowRoot.querySelector("slot[name='title']")), a(this, n, this.shadowRoot.querySelector(".ea-sub-menu__content")), this.updateContainerClasslist();
|
|
414
|
+
}
|
|
415
|
+
connectedCallback() {
|
|
416
|
+
var e;
|
|
417
|
+
super.connectedCallback(), (e = t(this, m)) == null || e.abort(), a(this, m, new AbortController()), this.addEventListener("click", t(this, k), {
|
|
418
|
+
signal: t(this, m).signal
|
|
419
|
+
}), t(this, A).call(this), this.updateContainerClasslist();
|
|
420
|
+
}
|
|
421
|
+
$beforeUnmounted() {
|
|
422
|
+
var e, o, l;
|
|
423
|
+
(e = t(this, m)) == null || e.abort(), (o = t(this, h)) == null || o.abort(), (l = t(this, d)) == null || l.abort();
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
g = new WeakMap(), y = new WeakMap(), w = new WeakMap(), n = new WeakMap(), m = new WeakMap(), h = new WeakMap(), d = new WeakMap(), k = new WeakMap(), M = new WeakMap(), _ = new WeakMap(), A = new WeakMap();
|
|
427
|
+
window.customElements.get("ea-sub-menu") || window.customElements.define("ea-sub-menu", j);
|
|
428
|
+
export {
|
|
429
|
+
D as EaMenu,
|
|
430
|
+
G as EaMenuItem,
|
|
431
|
+
V as EaMenuItemGroup,
|
|
432
|
+
j as EaSubMenu
|
|
433
|
+
};
|