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,206 +0,0 @@
|
|
|
1
|
-
var b = Object.defineProperty;
|
|
2
|
-
var f = (t) => {
|
|
3
|
-
throw TypeError(t);
|
|
4
|
-
};
|
|
5
|
-
var g = (t, s, e) => s in t ? b(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
6
|
-
var n = (t, s, e) => g(t, typeof s != "symbol" ? s + "" : s, e), y = (t, s, e) => s.has(t) || f("Cannot " + e);
|
|
7
|
-
var r = (t, s, e) => (y(t, s, "read from private field"), e ? e.call(t) : s.get(t)), o = (t, s, e) => s.has(t) ? f("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), a = (t, s, e, d) => (y(t, s, "write to private field"), d ? d.call(t, e) : s.set(t, e), e);
|
|
8
|
-
import { B as c } from "./Base.js";
|
|
9
|
-
import { s as w } from "../css/ea-container.style.js";
|
|
10
|
-
import { s as C } from "../css/ea-header.style.js";
|
|
11
|
-
import { s as E } from "../css/ea-main.style.js";
|
|
12
|
-
import { s as $ } from "../css/ea-footer.style.js";
|
|
13
|
-
import { s as v } from "../css/ea-aside.style.js";
|
|
14
|
-
var h, l, i, u;
|
|
15
|
-
class S extends c {
|
|
16
|
-
constructor() {
|
|
17
|
-
super();
|
|
18
|
-
/** @type {HTMLElement} */
|
|
19
|
-
o(this, h);
|
|
20
|
-
/** @type {SlotElement} */
|
|
21
|
-
o(this, l);
|
|
22
|
-
/** @type {AbortController} */
|
|
23
|
-
o(this, i);
|
|
24
|
-
/**
|
|
25
|
-
* @typedef {Object} State
|
|
26
|
-
* @property {string} direction 排列方向
|
|
27
|
-
*/
|
|
28
|
-
/** @type {State} */
|
|
29
|
-
n(this, "state", this.properties({
|
|
30
|
-
direction: {
|
|
31
|
-
type: ["horizontal", "vertical"],
|
|
32
|
-
default: "horizontal",
|
|
33
|
-
observer: () => {
|
|
34
|
-
this.updateContainerClasslist();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}));
|
|
38
|
-
/**
|
|
39
|
-
* 处理槽位变化事件
|
|
40
|
-
*/
|
|
41
|
-
o(this, u, () => {
|
|
42
|
-
const e = [...this.querySelectorAll("& > *")].map(
|
|
43
|
-
(d) => d.tagName.toLowerCase()
|
|
44
|
-
);
|
|
45
|
-
this.hasAttribute("direction") || (e.includes("ea-header") || e.includes("ea-footer") ? this.direction = "vertical" : this.direction = "horizontal");
|
|
46
|
-
});
|
|
47
|
-
this.stylesheet = w, this.$render();
|
|
48
|
-
}
|
|
49
|
-
static get observedAttributes() {
|
|
50
|
-
return [...super.observedAttributes, "direction"];
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* 获取 classlist 列表
|
|
54
|
-
* @return {string} 属性值
|
|
55
|
-
*/
|
|
56
|
-
updateContainerClasslist() {
|
|
57
|
-
const e = this.computedClasslist("ea-container", {
|
|
58
|
-
[`--${this.direction}`]: this.direction
|
|
59
|
-
});
|
|
60
|
-
return r(this, h).className = e, e;
|
|
61
|
-
}
|
|
62
|
-
$render() {
|
|
63
|
-
this.shadowRoot.innerHTML = `
|
|
64
|
-
<div class="ea-container" part="container">
|
|
65
|
-
<slot></slot>
|
|
66
|
-
</div>
|
|
67
|
-
`, a(this, h, this.shadowRoot.querySelector(".ea-container")), a(this, l, this.shadowRoot.querySelector("slot"));
|
|
68
|
-
}
|
|
69
|
-
connectedCallback() {
|
|
70
|
-
var e;
|
|
71
|
-
super.connectedCallback(), (e = r(this, i)) == null || e.abort(), a(this, i, new AbortController()), r(this, l).addEventListener("slotchange", r(this, u), {
|
|
72
|
-
signal: r(this, i).signal
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
$beforeUnmounted() {
|
|
76
|
-
var e;
|
|
77
|
-
(e = r(this, i)) == null || e.abort();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
h = new WeakMap(), l = new WeakMap(), i = new WeakMap(), u = new WeakMap();
|
|
81
|
-
customElements.get("ea-container") || customElements.define("ea-container", S);
|
|
82
|
-
class k extends c {
|
|
83
|
-
constructor() {
|
|
84
|
-
super();
|
|
85
|
-
/**
|
|
86
|
-
* @typedef {Object} State
|
|
87
|
-
* @property {string} height
|
|
88
|
-
*/
|
|
89
|
-
/** @type {State} */
|
|
90
|
-
n(this, "state", this.properties({
|
|
91
|
-
height: {
|
|
92
|
-
type: String,
|
|
93
|
-
default: "60px",
|
|
94
|
-
observer: (e) => {
|
|
95
|
-
e && CSS.supports("height", e) ? this.style.setProperty("--ea-header-height", e) : e ? this.style.setProperty("--ea-header-height", "60px") : this.style.setProperty("--ea-header-height", "auto");
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}));
|
|
99
|
-
this.stylesheet = C, this.$render();
|
|
100
|
-
}
|
|
101
|
-
static get observedAttributes() {
|
|
102
|
-
return ["height"];
|
|
103
|
-
}
|
|
104
|
-
$render() {
|
|
105
|
-
this.shadowRoot.innerHTML = `
|
|
106
|
-
<header class="ea-header" part="container">
|
|
107
|
-
<slot></slot>
|
|
108
|
-
</header>
|
|
109
|
-
`;
|
|
110
|
-
}
|
|
111
|
-
connectedCallback() {
|
|
112
|
-
super.connectedCallback();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
window.customElements.get("ea-header") || window.customElements.define("ea-header", k);
|
|
116
|
-
class x extends c {
|
|
117
|
-
constructor() {
|
|
118
|
-
super(), this.stylesheet = E, this.$render();
|
|
119
|
-
}
|
|
120
|
-
$render() {
|
|
121
|
-
this.shadowRoot.innerHTML = `
|
|
122
|
-
<main class="ea-main" part="container">
|
|
123
|
-
<slot></slot>
|
|
124
|
-
</main>
|
|
125
|
-
`;
|
|
126
|
-
}
|
|
127
|
-
connectedCallback() {
|
|
128
|
-
super.connectedCallback();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
window.customElements.get("ea-main") || window.customElements.define("ea-main", x);
|
|
132
|
-
var p;
|
|
133
|
-
class A extends c {
|
|
134
|
-
constructor() {
|
|
135
|
-
super();
|
|
136
|
-
/** @type {HTMLElement} */
|
|
137
|
-
o(this, p);
|
|
138
|
-
/**
|
|
139
|
-
* @typedef {Object} State
|
|
140
|
-
* @property {string} height
|
|
141
|
-
*/
|
|
142
|
-
/** @type {State} */
|
|
143
|
-
n(this, "state", this.properties({
|
|
144
|
-
height: {
|
|
145
|
-
type: String,
|
|
146
|
-
default: "60px",
|
|
147
|
-
observer: (e) => {
|
|
148
|
-
e && CSS.supports("height", e) ? this.style.setProperty("--ea-footer-height", e) : e ? this.style.setProperty("--ea-footer-height", "60px") : this.style.setProperty("--ea-footer-height", "auto");
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}));
|
|
152
|
-
this.stylesheet = $, this.$render();
|
|
153
|
-
}
|
|
154
|
-
static get observedAttributes() {
|
|
155
|
-
return ["height"];
|
|
156
|
-
}
|
|
157
|
-
$render() {
|
|
158
|
-
this.shadowRoot.innerHTML = `
|
|
159
|
-
<footer class="ea-footer" part="container">
|
|
160
|
-
<slot></slot>
|
|
161
|
-
</footer>
|
|
162
|
-
`, a(this, p, this.shadowRoot.querySelector(".ea-footer"));
|
|
163
|
-
}
|
|
164
|
-
connectedCallback() {
|
|
165
|
-
super.connectedCallback();
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
p = new WeakMap();
|
|
169
|
-
window.customElements.get("ea-footer") || window.customElements.define("ea-footer", A);
|
|
170
|
-
var m;
|
|
171
|
-
class R extends c {
|
|
172
|
-
constructor() {
|
|
173
|
-
super();
|
|
174
|
-
/** @type {HTMLElement} */
|
|
175
|
-
o(this, m);
|
|
176
|
-
/**
|
|
177
|
-
* @typedef {Object} State
|
|
178
|
-
*/
|
|
179
|
-
/** @type {State} */
|
|
180
|
-
n(this, "state", this.properties({
|
|
181
|
-
width: {
|
|
182
|
-
type: String,
|
|
183
|
-
default: "300px",
|
|
184
|
-
observer: (e) => {
|
|
185
|
-
this.style.setProperty("--ea-aside-width", e);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
}));
|
|
189
|
-
this.stylesheet = v, this.$render();
|
|
190
|
-
}
|
|
191
|
-
static get observedAttributes() {
|
|
192
|
-
return ["width"];
|
|
193
|
-
}
|
|
194
|
-
$render() {
|
|
195
|
-
this.shadowRoot.innerHTML = `
|
|
196
|
-
<aside class="ea-aside" part="container">
|
|
197
|
-
<slot></slot>
|
|
198
|
-
</aside>
|
|
199
|
-
`, a(this, m, this.shadowRoot.querySelector(".ea-aside"));
|
|
200
|
-
}
|
|
201
|
-
connectedCallback() {
|
|
202
|
-
super.connectedCallback();
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
m = new WeakMap();
|
|
206
|
-
window.customElements.get("ea-aside") || window.customElements.define("ea-aside", R);
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
var I = Object.defineProperty;
|
|
2
|
-
var H = (t) => {
|
|
3
|
-
throw TypeError(t);
|
|
4
|
-
};
|
|
5
|
-
var N = (t, s, e) => s in t ? I(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
6
|
-
var T = (t, s, e) => N(t, typeof s != "symbol" ? s + "" : s, e), _ = (t, s, e) => s.has(t) || H("Cannot " + e);
|
|
7
|
-
var n = (t, s, e) => (_(t, s, "read from private field"), e ? e.call(t) : s.get(t)), f = (t, s, e) => s.has(t) ? H("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), o = (t, s, e, a) => (_(t, s, "write to private field"), a ? a.call(t, e) : s.set(t, e), e);
|
|
8
|
-
import { EaStatistic as O } from "./ea-statistic.js";
|
|
9
|
-
import { d as Y } from "./ea-calendar2.js";
|
|
10
|
-
import { t as A } from "../utils/timeout.js";
|
|
11
|
-
import { p as k } from "../utils/parseTime.js";
|
|
12
|
-
class U extends Event {
|
|
13
|
-
constructor(s) {
|
|
14
|
-
super("ea-finish", {
|
|
15
|
-
bubbles: !0,
|
|
16
|
-
composed: !0
|
|
17
|
-
}), this.detail = s;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
var y, b, v, S, M, d, c, w, g;
|
|
21
|
-
class $ extends O {
|
|
22
|
-
constructor() {
|
|
23
|
-
super();
|
|
24
|
-
/** @type {HTMLElement} */
|
|
25
|
-
f(this, y);
|
|
26
|
-
/** @type {HTMLElement} */
|
|
27
|
-
f(this, b);
|
|
28
|
-
/** @type {HTMLElement} */
|
|
29
|
-
f(this, v);
|
|
30
|
-
/** @type {HTMLElement} */
|
|
31
|
-
f(this, S);
|
|
32
|
-
/** @type {HTMLElement} */
|
|
33
|
-
f(this, M);
|
|
34
|
-
f(this, d, null);
|
|
35
|
-
f(this, c, null);
|
|
36
|
-
f(this, w, {
|
|
37
|
-
displayValue: ""
|
|
38
|
-
});
|
|
39
|
-
T(this, "state", this.properties({
|
|
40
|
-
value: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: "",
|
|
43
|
-
observer: (e) => {
|
|
44
|
-
n(this, d) && (clearInterval(n(this, d)), o(this, d, null)), n(this, c) && (clearTimeout(n(this, c)), o(this, c, null));
|
|
45
|
-
const a = k(e) || e, r = () => {
|
|
46
|
-
const { diff: h, currentTime: l, displayValue: m } = n(this, g).call(this, a, this.format);
|
|
47
|
-
n(this, v).textContent = m, this.emit("change", { detail: { value: l, displayValue: m } }), (h <= 0 || !h) && (n(this, c) && (clearTimeout(n(this, c)), o(this, c, null)), n(this, d) && (clearInterval(n(this, d)), o(this, d, null)), this.dispatchEvent(
|
|
48
|
-
new U({ value: l, displayValue: m })
|
|
49
|
-
));
|
|
50
|
-
};
|
|
51
|
-
r();
|
|
52
|
-
const i = Number(this["refresh-interval"]) || 1e3, p = Date.now();
|
|
53
|
-
let u = i - p % i;
|
|
54
|
-
u === 0 && (u = i), o(this, c, A(() => {
|
|
55
|
-
o(this, c, null), r(), o(this, d, setInterval(r, i));
|
|
56
|
-
}, u));
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
format: {
|
|
60
|
-
type: String,
|
|
61
|
-
default: "HH:mm:ss",
|
|
62
|
-
observer: (e) => {
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"refresh-interval": {
|
|
66
|
-
type: Number,
|
|
67
|
-
default: 1e3,
|
|
68
|
-
/** @param {Number} newVal */
|
|
69
|
-
observer: (e) => {
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}));
|
|
73
|
-
/**
|
|
74
|
-
* 获取时间差
|
|
75
|
-
* @param {dayjs} date
|
|
76
|
-
* @param {string} format
|
|
77
|
-
* @return {{currentTime: number, diff: number, displayValue: string}}
|
|
78
|
-
*/
|
|
79
|
-
f(this, g, (e, a) => {
|
|
80
|
-
const r = Y(), i = Y(e), p = i.valueOf() - r.valueOf(), u = (q, R = 2) => `${q}`.padStart(R, "0");
|
|
81
|
-
if (p <= 0 || i.isBefore(r) || !p)
|
|
82
|
-
return {
|
|
83
|
-
currentTime: r.valueOf(),
|
|
84
|
-
diff: p,
|
|
85
|
-
displayValue: "00:00:00"
|
|
86
|
-
};
|
|
87
|
-
let h = i.diff(r, "year"), l = r.add(h, "year");
|
|
88
|
-
l.isAfter(i) && (h -= 1, l = r.add(h, "year"));
|
|
89
|
-
let m = i.diff(l, "month");
|
|
90
|
-
l = l.add(m, "month");
|
|
91
|
-
let D = i.diff(l, "day");
|
|
92
|
-
l = l.add(D, "day");
|
|
93
|
-
let V = i.diff(l, "hour");
|
|
94
|
-
l = l.add(V, "hour");
|
|
95
|
-
let x = i.diff(l, "minute");
|
|
96
|
-
l = l.add(x, "minute");
|
|
97
|
-
let C = i.diff(l, "second");
|
|
98
|
-
l = l.add(C, "second");
|
|
99
|
-
let E = i.diff(l, "millisecond");
|
|
100
|
-
return !a.includes("YY") && a.includes("MM") && (m = Math.floor(i.diff(r, "month", !0))), !a.includes("MM") && a.includes("DD") && (D = Math.floor(i.diff(r, "day", !0))), !a.includes("DD") && a.includes("HH") && (V = Math.floor(i.diff(r, "hour", !0))), !a.includes("HH") && a.includes("mm") && (x = Math.floor(i.diff(r, "minute", !0))), !a.includes("mm") && a.includes("ss") && (C = Math.floor(i.diff(r, "second", !0))), !a.includes("ss") && a.includes("SSS") && (E = Math.floor(i.diff(r, "millisecond", !0))), {
|
|
101
|
-
currentTime: r.valueOf(),
|
|
102
|
-
diff: p,
|
|
103
|
-
displayValue: a.replace("YYYY", u(h)).replace("MM", u(m)).replace("DD", u(D)).replace("HH", u(V)).replace("mm", u(x)).replace("ss", u(C)).replace("SSS", u(E, 3)).replace(/\[|\]/g, "")
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
o(this, y, this.shadowRoot.querySelector(".ea-statistic")), o(this, b, this.shadowRoot.querySelector(".ea-statistic__number slot")), o(this, v, this.shadowRoot.querySelector(".ea-statistic__number")), o(this, S, this.shadowRoot.querySelector(".ea-statistic__prefix slot")), o(this, M, this.shadowRoot.querySelector(".ea-statistic__suffix slot"));
|
|
107
|
-
}
|
|
108
|
-
// ------- displayValue -------
|
|
109
|
-
// #region
|
|
110
|
-
get displayValue() {
|
|
111
|
-
return n(this, w).displayValue;
|
|
112
|
-
}
|
|
113
|
-
set displayValue(e) {
|
|
114
|
-
n(this, w).displayValue = e;
|
|
115
|
-
}
|
|
116
|
-
// #endregion
|
|
117
|
-
// ------- end -------
|
|
118
|
-
static get observedAttributes() {
|
|
119
|
-
return [...super.observedAttributes, "value", "format", "refresh-interval"];
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* 获取 classlist 列表
|
|
123
|
-
* @return {string} 属性值
|
|
124
|
-
*/
|
|
125
|
-
updateContainerClasslist() {
|
|
126
|
-
const e = this.computedClasslist("ea-countdown", {
|
|
127
|
-
// ['--' + this.type]: this.type,
|
|
128
|
-
});
|
|
129
|
-
return n(this, y).className = e, e;
|
|
130
|
-
}
|
|
131
|
-
connectedCallback() {
|
|
132
|
-
super.connectedCallback();
|
|
133
|
-
}
|
|
134
|
-
$beforeUnmounted() {
|
|
135
|
-
clearInterval(n(this, d));
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
y = new WeakMap(), b = new WeakMap(), v = new WeakMap(), S = new WeakMap(), M = new WeakMap(), d = new WeakMap(), c = new WeakMap(), w = new WeakMap(), g = new WeakMap();
|
|
139
|
-
window.customElements.get("ea-countdown") || window.customElements.define("ea-countdown", $);
|
|
140
|
-
export {
|
|
141
|
-
$ as EaCountdown
|
|
142
|
-
};
|