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,1135 +0,0 @@
|
|
|
1
|
-
var it = Object.defineProperty;
|
|
2
|
-
var ot = (o) => {
|
|
3
|
-
throw TypeError(o);
|
|
4
|
-
};
|
|
5
|
-
var ct = (o, r, t) => r in o ? it(o, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[r] = t;
|
|
6
|
-
var x = (o, r, t) => ct(o, typeof r != "symbol" ? r + "" : r, t), at = (o, r, t) => r.has(o) || ot("Cannot " + t);
|
|
7
|
-
var e = (o, r, t) => (at(o, r, "read from private field"), t ? t.call(o) : r.get(o)), p = (o, r, t) => r.has(o) ? ot("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(o) : r.set(o, t), C = (o, r, t, s) => (at(o, r, "write to private field"), s ? s.call(o, t) : r.set(o, t), t), S = (o, r, t) => (at(o, r, "access private method"), t);
|
|
8
|
-
import { E } from "../utils/Utils.js";
|
|
9
|
-
import { B as rt } from "./Base.js";
|
|
10
|
-
import "./ea-empty.js";
|
|
11
|
-
import { s as ht } from "../css/ea-table.style.js";
|
|
12
|
-
import { s as dt } from "../css/ea-table-column.style.js";
|
|
13
|
-
class ut extends Event {
|
|
14
|
-
constructor(r) {
|
|
15
|
-
super("ea-cell-click", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
class pt extends Event {
|
|
19
|
-
constructor(r) {
|
|
20
|
-
super("ea-current-change", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
class bt extends Event {
|
|
24
|
-
constructor(r) {
|
|
25
|
-
super("ea-row-click", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
class mt extends Event {
|
|
29
|
-
constructor(r) {
|
|
30
|
-
super("ea-select-all", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
class ft extends Event {
|
|
34
|
-
constructor(r) {
|
|
35
|
-
super("ea-select", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
class gt extends Event {
|
|
39
|
-
constructor(r) {
|
|
40
|
-
super("ea-selection-change", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const Et = (o) => E.EaElement.h(
|
|
44
|
-
"colgroup",
|
|
45
|
-
"ea-table__colgroup",
|
|
46
|
-
{
|
|
47
|
-
part: "colgroup"
|
|
48
|
-
},
|
|
49
|
-
o.map(
|
|
50
|
-
(r) => E.EaElement.h("col", "ea-table__col", {
|
|
51
|
-
width: r.width,
|
|
52
|
-
part: "col"
|
|
53
|
-
})
|
|
54
|
-
)
|
|
55
|
-
), yt = (o) => E.EaElement.h(
|
|
56
|
-
"tfoot",
|
|
57
|
-
"ea-table__tfoot",
|
|
58
|
-
{
|
|
59
|
-
part: "tfoot"
|
|
60
|
-
},
|
|
61
|
-
E.EaElement.h(
|
|
62
|
-
"tr",
|
|
63
|
-
"ea-table__tr",
|
|
64
|
-
{
|
|
65
|
-
part: "tfoot-tr"
|
|
66
|
-
},
|
|
67
|
-
o.map(
|
|
68
|
-
(r) => E.EaElement.h(
|
|
69
|
-
"td",
|
|
70
|
-
`ea-table__td ${r.fixed ? ` is-fixed fixed-${r.fixed}` : ""}`,
|
|
71
|
-
{
|
|
72
|
-
part: "tfoot-td",
|
|
73
|
-
"data-scope": r.prop
|
|
74
|
-
}
|
|
75
|
-
)
|
|
76
|
-
)
|
|
77
|
-
)
|
|
78
|
-
), vt = (o) => E.EaElement.h("span", "ea-table__sort-wrapper", {}, [
|
|
79
|
-
E.EaElement.h("span", null, {}, o),
|
|
80
|
-
E.EaElement.h(
|
|
81
|
-
"span",
|
|
82
|
-
"ea-table__sort",
|
|
83
|
-
{},
|
|
84
|
-
[
|
|
85
|
-
E.EaElement.h("ea-icon", "ea-table__sort-icon", {
|
|
86
|
-
part: "asc-icon",
|
|
87
|
-
name: "angle-up",
|
|
88
|
-
size: "small"
|
|
89
|
-
}),
|
|
90
|
-
E.EaElement.h("ea-icon", "ea-table__sort-icon", {
|
|
91
|
-
part: "desc-icon",
|
|
92
|
-
name: "angle-down",
|
|
93
|
-
size: "small"
|
|
94
|
-
})
|
|
95
|
-
].join("")
|
|
96
|
-
)
|
|
97
|
-
]), wt = () => E.EaElement.h(
|
|
98
|
-
"ea-checkbox",
|
|
99
|
-
"ea-table__checkbox",
|
|
100
|
-
{
|
|
101
|
-
"data-type": "selection",
|
|
102
|
-
part: "checkbox"
|
|
103
|
-
},
|
|
104
|
-
null
|
|
105
|
-
), xt = () => "", Ct = (o) => {
|
|
106
|
-
const r = (c) => c === "selection" ? wt() : c === "index" ? xt() : null, t = (c, u) => c ? vt(u) : null;
|
|
107
|
-
let s = null;
|
|
108
|
-
const n = o.label || o.prop || "", l = r(o.type), i = t(o.sortable, n);
|
|
109
|
-
return l ? s = l : i ? s = i : o.header ? s = o.header : s = n, E.EaElement.h(
|
|
110
|
-
"th",
|
|
111
|
-
`ea-table__th${o.fixed ? ` is-fixed fixed-${o.fixed}` : ""}${o.sortable ? " is-sortable" : ""}${o.width ? " is-width" : ""}`.trim(),
|
|
112
|
-
{
|
|
113
|
-
part: "thead-th",
|
|
114
|
-
colspan: o.colspan,
|
|
115
|
-
rowspan: o.rowspan,
|
|
116
|
-
style: [o.width ? `--ea-table-cell-width: ${o.width}` : ""],
|
|
117
|
-
"data-scope": o.prop || "",
|
|
118
|
-
"data-prop": o.prop || "",
|
|
119
|
-
"data-order": "asc"
|
|
120
|
-
},
|
|
121
|
-
s
|
|
122
|
-
);
|
|
123
|
-
}, St = (o) => o.map(
|
|
124
|
-
(r) => E.EaElement.h(
|
|
125
|
-
"tr",
|
|
126
|
-
"ea-table__tr is-thead",
|
|
127
|
-
{
|
|
128
|
-
part: "thead-tr"
|
|
129
|
-
},
|
|
130
|
-
r.map(Ct)
|
|
131
|
-
)
|
|
132
|
-
), _t = (o) => {
|
|
133
|
-
const r = o.reduce((t, s) => (t[s.depth] || (t[s.depth] = []), t[s.depth].push(s), t), []);
|
|
134
|
-
return E.EaElement.h(
|
|
135
|
-
"thead",
|
|
136
|
-
"ea-table__thead",
|
|
137
|
-
{
|
|
138
|
-
part: "thead"
|
|
139
|
-
},
|
|
140
|
-
St(r)
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
class kt extends Event {
|
|
144
|
-
constructor(r) {
|
|
145
|
-
super("ea-sort-change", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
class At extends Event {
|
|
149
|
-
constructor(r) {
|
|
150
|
-
super("ea-cell-mouse-enter", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
class Lt extends Event {
|
|
154
|
-
constructor(r) {
|
|
155
|
-
super("ea-cell-mouse-leave", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
class Tt extends Event {
|
|
159
|
-
constructor(r) {
|
|
160
|
-
super("ea-cell-dblclick", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
class Rt extends Event {
|
|
164
|
-
constructor(r) {
|
|
165
|
-
super("ea-row-dblclick", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
class qt extends Event {
|
|
169
|
-
constructor(r) {
|
|
170
|
-
super("ea-row-contextmenu", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
class Dt extends Event {
|
|
174
|
-
constructor(r) {
|
|
175
|
-
super("ea-cell-contextmenu", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
class $t extends Event {
|
|
179
|
-
constructor(r) {
|
|
180
|
-
super("ea-header-contextmenu", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
class Mt extends Event {
|
|
184
|
-
constructor(r) {
|
|
185
|
-
super("ea-header-click", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
class Nt extends Event {
|
|
189
|
-
constructor(r) {
|
|
190
|
-
super("ea-template-cell-click", { bubbles: !0, composed: !0 }), this.detail = r;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
var f, T, w, H, I, F, g, k, h, B, K, D, P, W, j, U, $, z, L, G, J, O, Q, V, X, Y, Z, tt, et;
|
|
194
|
-
class Ht extends rt {
|
|
195
|
-
constructor() {
|
|
196
|
-
super();
|
|
197
|
-
/** @type {HTMLElement} */
|
|
198
|
-
p(this, f);
|
|
199
|
-
/** @type {HTMLElement} */
|
|
200
|
-
p(this, T);
|
|
201
|
-
/** @type {HTMLElement} */
|
|
202
|
-
p(this, w);
|
|
203
|
-
/** @type {HTMLElement} */
|
|
204
|
-
p(this, H);
|
|
205
|
-
/** @type {HTMLSlotElement} */
|
|
206
|
-
p(this, I);
|
|
207
|
-
/** @type {HTMLElement} */
|
|
208
|
-
p(this, F);
|
|
209
|
-
/** @type {AbortController} */
|
|
210
|
-
p(this, g);
|
|
211
|
-
p(this, k, {
|
|
212
|
-
/** @type {AbortController | null} */
|
|
213
|
-
selectionChangeAbortController: null,
|
|
214
|
-
/** @type {AbortController | null} */
|
|
215
|
-
selectAbortController: null
|
|
216
|
-
});
|
|
217
|
-
p(this, h, {
|
|
218
|
-
isDataRendered: !1,
|
|
219
|
-
currentRow: {
|
|
220
|
-
target: null,
|
|
221
|
-
value: {}
|
|
222
|
-
},
|
|
223
|
-
/** @type {import("../ea-table-column/index.js").TableColumnCtx[]} */
|
|
224
|
-
columns: [],
|
|
225
|
-
originData: [],
|
|
226
|
-
dataSource: /* @__PURE__ */ new WeakMap(),
|
|
227
|
-
dataIndex: /* @__PURE__ */ new WeakMap()
|
|
228
|
-
});
|
|
229
|
-
x(this, "state", this.properties({
|
|
230
|
-
stripe: {
|
|
231
|
-
type: Boolean,
|
|
232
|
-
default: !1,
|
|
233
|
-
observer: () => {
|
|
234
|
-
this.updateContainerClasslist();
|
|
235
|
-
}
|
|
236
|
-
},
|
|
237
|
-
border: {
|
|
238
|
-
type: Boolean,
|
|
239
|
-
default: !1,
|
|
240
|
-
observer: () => {
|
|
241
|
-
this.updateContainerClasslist();
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
height: {
|
|
245
|
-
type: String,
|
|
246
|
-
default: null,
|
|
247
|
-
observer: (t) => {
|
|
248
|
-
this.style.setProperty("--ea-table-height", t), this.updateContainerClasslist();
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
"max-height": {
|
|
252
|
-
type: String,
|
|
253
|
-
default: null,
|
|
254
|
-
observer: (t) => {
|
|
255
|
-
this.style.setProperty("--ea-table-max-height", t), this.updateContainerClasslist();
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
"highlight-current-row": {
|
|
259
|
-
type: Boolean,
|
|
260
|
-
default: !1,
|
|
261
|
-
observer: () => {
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
"show-summary": {
|
|
265
|
-
type: Boolean,
|
|
266
|
-
default: !1,
|
|
267
|
-
observer: () => {
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}));
|
|
271
|
-
x(this, "propStates", this.properties({
|
|
272
|
-
data: {
|
|
273
|
-
props: !0,
|
|
274
|
-
type: Array,
|
|
275
|
-
default: () => e(this, h).originData,
|
|
276
|
-
observer: (t) => {
|
|
277
|
-
e(this, h).originData = t, this.setData(t);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}));
|
|
281
|
-
x(this, "funcStates", this.properties({
|
|
282
|
-
selectable: {
|
|
283
|
-
props: !0,
|
|
284
|
-
type: Function,
|
|
285
|
-
rawFunction: !0,
|
|
286
|
-
default: null
|
|
287
|
-
},
|
|
288
|
-
indexMethod: {
|
|
289
|
-
props: !0,
|
|
290
|
-
type: Function,
|
|
291
|
-
rawFunction: !0,
|
|
292
|
-
default: () => (t) => t
|
|
293
|
-
},
|
|
294
|
-
summaryMethod: {
|
|
295
|
-
props: !0,
|
|
296
|
-
type: Function,
|
|
297
|
-
rawFunction: !0,
|
|
298
|
-
default: () => (
|
|
299
|
-
/** @param {{columns: ColumnOption, data: any[]}} param */
|
|
300
|
-
(t) => {
|
|
301
|
-
const { columns: s, data: n } = t, l = [];
|
|
302
|
-
return s.forEach((i, c) => {
|
|
303
|
-
if (c === 0) {
|
|
304
|
-
l[c] = "Sum";
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
const u = n.map((a) => Number(a[i.prop]));
|
|
308
|
-
u.every((a) => Number.isNaN(a)) ? l[c] = "" : l[c] = u.reduce((a, b) => {
|
|
309
|
-
const m = Number(b);
|
|
310
|
-
return Number.isNaN(m) ? a : a + b;
|
|
311
|
-
}, 0);
|
|
312
|
-
}), l;
|
|
313
|
-
}
|
|
314
|
-
)
|
|
315
|
-
}
|
|
316
|
-
}));
|
|
317
|
-
/**
|
|
318
|
-
* 渲染表格的基本结构
|
|
319
|
-
*/
|
|
320
|
-
p(this, B, () => {
|
|
321
|
-
const t = [...this.querySelectorAll("ea-table-column")].map(
|
|
322
|
-
(a) => a.getColumnTree
|
|
323
|
-
);
|
|
324
|
-
e(this, h).columns = t;
|
|
325
|
-
const s = Et(t), n = _t(t), l = yt(t), i = this.shadowRoot.querySelector(".ea-table__colgroup"), c = this.shadowRoot.querySelector(".ea-table__thead"), u = this.shadowRoot.querySelector(".ea-table__tfoot");
|
|
326
|
-
i && (i.innerHTML = s), c && (c.innerHTML = n), u && (u.innerHTML = l);
|
|
327
|
-
});
|
|
328
|
-
/**
|
|
329
|
-
* 初始化带有筛选的列
|
|
330
|
-
*/
|
|
331
|
-
p(this, K, () => {
|
|
332
|
-
if (![
|
|
333
|
-
...e(this, f).querySelectorAll(".ea-table__th.is-sortable")
|
|
334
|
-
].length) return;
|
|
335
|
-
const s = (n) => {
|
|
336
|
-
const l = n.target.closest(".is-sortable");
|
|
337
|
-
if (!l) return;
|
|
338
|
-
const { prop: i, order: c } = l.dataset;
|
|
339
|
-
if (!i) return;
|
|
340
|
-
const u = c === "asc" ? "desc" : "asc", a = {
|
|
341
|
-
asc: l.querySelector('[part="asc-icon"]'),
|
|
342
|
-
desc: l.querySelector('[part="desc-icon"]')
|
|
343
|
-
};
|
|
344
|
-
l.setAttribute("data-order", u), l.querySelectorAll(".ea-table__sort-icon").forEach((b) => {
|
|
345
|
-
b.classList.toggle("is-active", a[u] === b);
|
|
346
|
-
}), this.sort(i, u);
|
|
347
|
-
};
|
|
348
|
-
e(this, T).addEventListener("click", s, {
|
|
349
|
-
signal: e(this, g).signal
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
/**
|
|
353
|
-
* @param {any[]} dataSource
|
|
354
|
-
*/
|
|
355
|
-
x(this, "setData", async (t) => {
|
|
356
|
-
var u;
|
|
357
|
-
await customElements.whenDefined("ea-table"), await customElements.whenDefined("ea-table-column"), e(this, h).columns.length === 0 && (e(this, B).call(this), e(this, K).call(this));
|
|
358
|
-
const s = document.createDocumentFragment(), n = document.createElement("tr");
|
|
359
|
-
n.part = "tbody-tr", n.className = "ea-table__tr";
|
|
360
|
-
const l = e(this, h).columns.filter(
|
|
361
|
-
(a) => !a.template || a.template instanceof HTMLTemplateElement
|
|
362
|
-
), i = l.some((a) => a.type === "selection"), c = {
|
|
363
|
-
selection: () => this.html(
|
|
364
|
-
E.EaElement.h(
|
|
365
|
-
"ea-checkbox",
|
|
366
|
-
"ea-table__selection",
|
|
367
|
-
{
|
|
368
|
-
"data-type": "selection"
|
|
369
|
-
},
|
|
370
|
-
null
|
|
371
|
-
)
|
|
372
|
-
),
|
|
373
|
-
index: () => this.html(
|
|
374
|
-
E.EaElement.h(
|
|
375
|
-
"span",
|
|
376
|
-
"ea-table__index",
|
|
377
|
-
{
|
|
378
|
-
"data-type": "index"
|
|
379
|
-
},
|
|
380
|
-
null
|
|
381
|
-
)
|
|
382
|
-
)
|
|
383
|
-
};
|
|
384
|
-
for (const a in e(this, k))
|
|
385
|
-
(u = e(this, k)[a]) == null || u.abort(), e(this, k)[a] = new AbortController();
|
|
386
|
-
if (e(this, h).isDataRendered = !1, e(this, w).innerHTML = "", e(this, h).dataSource = /* @__PURE__ */ new WeakMap(), e(this, h).originData = t, l.forEach((a) => {
|
|
387
|
-
var v;
|
|
388
|
-
const b = n, { template: m } = a, d = document.createElement("td");
|
|
389
|
-
if (d.part = "tbody-td", d.className = "ea-table__td", d.classList.toggle("is-fixed", a.fixed), d.classList.toggle(`fixed-${a.fixed}`, a.fixed), d.classList.toggle(
|
|
390
|
-
`ea-table__cell--align-${a.align}`,
|
|
391
|
-
a.align
|
|
392
|
-
), a.width && d.style.setProperty("--ea-table-cell-width", a.width), m) {
|
|
393
|
-
const A = m.content.cloneNode(!0);
|
|
394
|
-
A.querySelectorAll("*").forEach((nt) => {
|
|
395
|
-
nt.setAttribute("data-template-cell", "");
|
|
396
|
-
}), d.appendChild(A);
|
|
397
|
-
} else a.type ? d.innerHTML = (v = c[a.type]) == null ? void 0 : v.call(c) : d.setAttribute("data-scope", a.prop);
|
|
398
|
-
b.appendChild(d);
|
|
399
|
-
}), t.forEach((a, b) => {
|
|
400
|
-
const m = n.cloneNode(!0);
|
|
401
|
-
if (m.setAttribute("data-index", b), typeof this.selectable == "function") {
|
|
402
|
-
const d = !this.selectable(a);
|
|
403
|
-
m.querySelector(
|
|
404
|
-
'ea-checkbox[data-type="selection"]'
|
|
405
|
-
).toggleAttribute("disabled", d);
|
|
406
|
-
}
|
|
407
|
-
if (l.some((d) => d.type === "index") && typeof this.indexMethod == "function") {
|
|
408
|
-
const d = m.querySelector(".ea-table__index");
|
|
409
|
-
d.textContent = this.indexMethod(b);
|
|
410
|
-
}
|
|
411
|
-
m.querySelectorAll("[data-scope]").forEach((d) => {
|
|
412
|
-
const v = d.getAttribute("data-scope"), A = l.find((N) => N.prop === v);
|
|
413
|
-
A ? d.textContent = a[A.prop] : v in a && (d.textContent = a[v]);
|
|
414
|
-
}), s.appendChild(m), e(this, h).dataSource.set(m, a), a && typeof a == "object" && e(this, h).dataIndex.set(a, m);
|
|
415
|
-
}), this["show-summary"] && typeof this.summaryMethod == "function") {
|
|
416
|
-
const a = e(this, H).querySelectorAll(
|
|
417
|
-
".ea-table__td[data-scope]"
|
|
418
|
-
), b = this.summaryMethod({ columns: l, data: t });
|
|
419
|
-
a.forEach((m, d) => {
|
|
420
|
-
m.textContent = b[d];
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
e(this, w).appendChild(s), i && e(this, f).addEventListener("change", e(this, et), {
|
|
424
|
-
signal: e(this, g).signal
|
|
425
|
-
}), e(this, W).call(this), e(this, O).call(this), this.updateContainerClasslist(), e(this, h).isDataRendered = !0, this.emit("ea-table-data-rendered");
|
|
426
|
-
});
|
|
427
|
-
/**
|
|
428
|
-
* 排序
|
|
429
|
-
* @param {string} prop
|
|
430
|
-
* @param {"asc" | "desc"} order
|
|
431
|
-
*/
|
|
432
|
-
x(this, "sort", (t, s = "asc") => {
|
|
433
|
-
const n = document.createDocumentFragment(), l = e(this, w).nextElementSibling;
|
|
434
|
-
n.appendChild(e(this, w)), [...n.querySelectorAll("tr")].sort((c, u) => {
|
|
435
|
-
const a = e(this, h).dataSource.get(c), b = e(this, h).dataSource.get(u);
|
|
436
|
-
return s === "asc" ? String(a[t]).localeCompare(b[t]) : String(b[t]).localeCompare(a[t]);
|
|
437
|
-
}).forEach((c) => {
|
|
438
|
-
e(this, w).appendChild(c);
|
|
439
|
-
}), e(this, f).insertBefore(n, l), this.dispatchEvent(
|
|
440
|
-
new kt({
|
|
441
|
-
prop: t,
|
|
442
|
-
order: s
|
|
443
|
-
})
|
|
444
|
-
);
|
|
445
|
-
});
|
|
446
|
-
/**
|
|
447
|
-
* 设置行样式
|
|
448
|
-
* @param {Function | String} handler
|
|
449
|
-
*/
|
|
450
|
-
x(this, "setRowStylePart", async (t) => {
|
|
451
|
-
e(this, h).isDataRendered || await E.EaElement.addAsyncEventListener(
|
|
452
|
-
this,
|
|
453
|
-
"ea-table-data-rendered",
|
|
454
|
-
!0
|
|
455
|
-
);
|
|
456
|
-
const s = [...e(this, w).querySelectorAll("tr")];
|
|
457
|
-
if (typeof t == "function")
|
|
458
|
-
s.forEach((n, l) => {
|
|
459
|
-
const i = t({
|
|
460
|
-
row: e(this, h).dataSource.get(n),
|
|
461
|
-
rowIndex: l
|
|
462
|
-
});
|
|
463
|
-
i && n.part.add(i);
|
|
464
|
-
});
|
|
465
|
-
else if (typeof t == "string") {
|
|
466
|
-
if (!t) return;
|
|
467
|
-
s.forEach((n) => {
|
|
468
|
-
n.part.add(t);
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
/**
|
|
473
|
-
* 设置当前行是否被选中
|
|
474
|
-
* @param {any} row
|
|
475
|
-
* @param {Boolean} selected
|
|
476
|
-
* @param {boolean} [ignoreSelectable]
|
|
477
|
-
*/
|
|
478
|
-
x(this, "toggleRowSelection", (t, s, n = !0) => {
|
|
479
|
-
if (!e(this, h).columns.some(
|
|
480
|
-
(a) => a.type === "selection"
|
|
481
|
-
)) return;
|
|
482
|
-
const i = e(this, h).dataIndex.get(t);
|
|
483
|
-
if (!i) return;
|
|
484
|
-
const c = `ea-checkbox[data-type="selection"]${n ? "" : ":not([disabled])"}`, u = i.querySelector(c);
|
|
485
|
-
u && (s ? u.toggleAttribute("checked", s) : u.toggleAttribute("checked", !u.checked), e(this, P).call(this), e(this, $).call(this));
|
|
486
|
-
});
|
|
487
|
-
/**
|
|
488
|
-
* 清空选择
|
|
489
|
-
*/
|
|
490
|
-
x(this, "clearSelection", () => {
|
|
491
|
-
[
|
|
492
|
-
...e(this, f).querySelectorAll('ea-checkbox[data-type="selection"]')
|
|
493
|
-
].forEach((s) => {
|
|
494
|
-
s.removeAttribute("checked"), s.removeAttribute("indeterminate");
|
|
495
|
-
}), e(this, $).call(this);
|
|
496
|
-
});
|
|
497
|
-
/**
|
|
498
|
-
* 获取当前选中的行
|
|
499
|
-
* @returns {any[]}
|
|
500
|
-
*/
|
|
501
|
-
p(this, D, () => [
|
|
502
|
-
...e(this, w).querySelectorAll(
|
|
503
|
-
'ea-checkbox[data-type="selection"][checked]'
|
|
504
|
-
)
|
|
505
|
-
].map(
|
|
506
|
-
(t) => e(this, h).dataSource.get(t.closest('.ea-table__tr[part="tbody-tr"]'))
|
|
507
|
-
));
|
|
508
|
-
/**
|
|
509
|
-
* 更新选中状态
|
|
510
|
-
*/
|
|
511
|
-
p(this, P, () => {
|
|
512
|
-
const t = e(this, T).querySelector(
|
|
513
|
-
'ea-checkbox[data-type="selection"]'
|
|
514
|
-
), s = [
|
|
515
|
-
...e(this, w).querySelectorAll(
|
|
516
|
-
'ea-checkbox[data-type="selection"]:not([disabled])'
|
|
517
|
-
)
|
|
518
|
-
].every((l) => l.hasAttribute("checked")), n = [
|
|
519
|
-
...e(this, w).querySelectorAll('ea-checkbox[data-type="selection"]')
|
|
520
|
-
].some((l) => l.hasAttribute("checked"));
|
|
521
|
-
s ? (t.toggleAttribute("checked", !0), t.removeAttribute("indeterminate")) : n ? (t.removeAttribute("checked"), t.toggleAttribute("indeterminate", !0)) : (t.removeAttribute("checked"), t.removeAttribute("indeterminate"));
|
|
522
|
-
});
|
|
523
|
-
/**
|
|
524
|
-
* 处理固定列的位置和阴影(box-shadow)
|
|
525
|
-
*/
|
|
526
|
-
p(this, W, () => {
|
|
527
|
-
const t = [...e(this, f).querySelectorAll(".is-fixed")], s = t.filter(
|
|
528
|
-
(a) => a.classList.contains("fixed-left")
|
|
529
|
-
), n = t.filter(
|
|
530
|
-
(a) => a.classList.contains("fixed-right")
|
|
531
|
-
), l = (a) => {
|
|
532
|
-
const b = a.filter((d) => d.part.contains("thead-th"));
|
|
533
|
-
if (b.length <= 1) return [a];
|
|
534
|
-
const m = [];
|
|
535
|
-
for (let d = 0; d < a.length; d += b.length)
|
|
536
|
-
m.push(a.slice(d, d + b.length));
|
|
537
|
-
return m.reduce((d, v) => (v.forEach((A, N) => {
|
|
538
|
-
d[N] = [...d[N], A];
|
|
539
|
-
}), d), Array(b.length).fill([]));
|
|
540
|
-
}, i = (a) => {
|
|
541
|
-
if (!a.length) return;
|
|
542
|
-
const b = a.slice(-1)[0];
|
|
543
|
-
a.forEach((m, d) => {
|
|
544
|
-
const v = a[d - 1] || [];
|
|
545
|
-
m.forEach((A) => {
|
|
546
|
-
b && v[0] && A.style.setProperty(
|
|
547
|
-
"--ea-table-fixed-x",
|
|
548
|
-
`${d * v[0].offsetWidth}px`
|
|
549
|
-
);
|
|
550
|
-
});
|
|
551
|
-
}), b.forEach((m) => {
|
|
552
|
-
m.classList.add("is-last");
|
|
553
|
-
});
|
|
554
|
-
}, [c, u] = [
|
|
555
|
-
l(s),
|
|
556
|
-
l(n).reverse()
|
|
557
|
-
];
|
|
558
|
-
i(c), i(u);
|
|
559
|
-
});
|
|
560
|
-
/**
|
|
561
|
-
* 设置高亮当前行样式
|
|
562
|
-
* @param {HTMLTableRowElement} currentRow
|
|
563
|
-
* @param {HTMLTableRowElement} [oldRow]
|
|
564
|
-
*/
|
|
565
|
-
p(this, j, (t, s = e(this, h).currentRow.target) => {
|
|
566
|
-
var n, l;
|
|
567
|
-
this["highlight-current-row"] && ((n = s == null ? void 0 : s.classList) == null || n.remove("is-current"), (l = t == null ? void 0 : t.classList) == null || l.add("is-current"));
|
|
568
|
-
});
|
|
569
|
-
/**
|
|
570
|
-
* 取消高亮当前行样式
|
|
571
|
-
* @param {HTMLTableRowElement} currentRow
|
|
572
|
-
*/
|
|
573
|
-
p(this, U, (t) => {
|
|
574
|
-
var s;
|
|
575
|
-
!this["highlight-current-row"] || !t || (s = t == null ? void 0 : t.classList) == null || s.remove("is-current");
|
|
576
|
-
});
|
|
577
|
-
/**
|
|
578
|
-
* 派发选择改变事件
|
|
579
|
-
*/
|
|
580
|
-
p(this, $, () => {
|
|
581
|
-
const t = e(this, D).call(this);
|
|
582
|
-
this.dispatchEvent(
|
|
583
|
-
new gt({
|
|
584
|
-
newSelection: t
|
|
585
|
-
})
|
|
586
|
-
);
|
|
587
|
-
});
|
|
588
|
-
/**
|
|
589
|
-
* 点击事件: 行点击, 单元格点击
|
|
590
|
-
* @param {MouseEvent} e
|
|
591
|
-
*/
|
|
592
|
-
p(this, z, (t) => {
|
|
593
|
-
var i;
|
|
594
|
-
const s = t.target.closest("tr[part='tbody-tr']");
|
|
595
|
-
if ((i = e(this, k).selectAbortController) == null || i.abort(), !s) return;
|
|
596
|
-
const n = () => {
|
|
597
|
-
var c;
|
|
598
|
-
(c = e(this, k).selectAbortController) == null || c.abort();
|
|
599
|
-
}, l = (c) => {
|
|
600
|
-
const u = c.target.closest("tr[part='tbody-tr']"), a = c.target.closest("td[part='tbody-td']");
|
|
601
|
-
if (n(), u !== s) return;
|
|
602
|
-
const b = e(this, h).dataSource.get(s), m = a == null ? void 0 : a.getAttribute("data-scope");
|
|
603
|
-
if (e(this, j).call(this, s, e(this, h).currentRow.target), e(this, h).currentRow.target = s, e(this, h).currentRow.value = b, this.dispatchEvent(
|
|
604
|
-
new bt({
|
|
605
|
-
target: s,
|
|
606
|
-
column: m,
|
|
607
|
-
row: b
|
|
608
|
-
})
|
|
609
|
-
), this.dispatchEvent(
|
|
610
|
-
new pt({
|
|
611
|
-
target: s,
|
|
612
|
-
column: m,
|
|
613
|
-
row: b
|
|
614
|
-
})
|
|
615
|
-
), a) {
|
|
616
|
-
this.dispatchEvent(
|
|
617
|
-
new ut({
|
|
618
|
-
cell: a,
|
|
619
|
-
column: m,
|
|
620
|
-
row: b
|
|
621
|
-
})
|
|
622
|
-
);
|
|
623
|
-
const d = c.target.closest("[data-template-cell]");
|
|
624
|
-
if (d) {
|
|
625
|
-
const v = Number(s.getAttribute("data-index"));
|
|
626
|
-
this.dispatchEvent(
|
|
627
|
-
new Nt({
|
|
628
|
-
target: d,
|
|
629
|
-
rowData: b,
|
|
630
|
-
rowIndex: v,
|
|
631
|
-
originalEvent: c
|
|
632
|
-
})
|
|
633
|
-
);
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
};
|
|
637
|
-
e(this, k).selectAbortController = new AbortController(), this.addEventListener("mouseout", n, {
|
|
638
|
-
once: !0,
|
|
639
|
-
signal: e(this, k).selectAbortController.signal
|
|
640
|
-
}), e(this, f).addEventListener("mouseup", l, {
|
|
641
|
-
once: !0,
|
|
642
|
-
signal: e(this, k).selectAbortController.signal
|
|
643
|
-
});
|
|
644
|
-
});
|
|
645
|
-
/**
|
|
646
|
-
* 鼠标相关事件的共同处理逻辑
|
|
647
|
-
* @param {MouseEvent} e
|
|
648
|
-
* @param {'body' | 'head'} part
|
|
649
|
-
* @returns {{
|
|
650
|
-
* cell: HTMLTableCellElement;
|
|
651
|
-
* row: HTMLTableRowElement;
|
|
652
|
-
* data: any;
|
|
653
|
-
* columnKey: string;
|
|
654
|
-
* } | {
|
|
655
|
-
* cell: HTMLTableCellElement;
|
|
656
|
-
* columnKey: string;
|
|
657
|
-
* }}
|
|
658
|
-
*/
|
|
659
|
-
p(this, L, (t, s) => {
|
|
660
|
-
const n = t.target.closest(`tr[part='t${s}-tr']`);
|
|
661
|
-
if (!n) return { cell: null, row: null, data: null, columnKey: null };
|
|
662
|
-
const l = s === "body" ? "td" : "th", i = t.target.closest(`${l}[part='t${s}-${l}']`), c = e(this, h).dataSource.get(n), u = i == null ? void 0 : i.getAttribute("data-scope");
|
|
663
|
-
return s === "body" ? {
|
|
664
|
-
cell: i,
|
|
665
|
-
row: n,
|
|
666
|
-
data: c,
|
|
667
|
-
columnKey: u
|
|
668
|
-
} : {
|
|
669
|
-
cell: i,
|
|
670
|
-
columnKey: u
|
|
671
|
-
};
|
|
672
|
-
});
|
|
673
|
-
/**
|
|
674
|
-
* 鼠标双击事件: 行双击, 单元格双击
|
|
675
|
-
* @param {MouseEvent} e
|
|
676
|
-
*/
|
|
677
|
-
p(this, G, (t) => {
|
|
678
|
-
const { row: s, cell: n, data: l, columnKey: i } = e(this, L).call(this, t, "body");
|
|
679
|
-
s && (this.dispatchEvent(
|
|
680
|
-
new Rt({
|
|
681
|
-
target: s,
|
|
682
|
-
column: i,
|
|
683
|
-
row: l
|
|
684
|
-
})
|
|
685
|
-
), this.dispatchEvent(
|
|
686
|
-
new Tt({
|
|
687
|
-
cell: n,
|
|
688
|
-
column: i,
|
|
689
|
-
row: l
|
|
690
|
-
})
|
|
691
|
-
));
|
|
692
|
-
});
|
|
693
|
-
/**
|
|
694
|
-
* 鼠标右击事件: 行右击, 单元格右击
|
|
695
|
-
* @param {MouseEvent} e
|
|
696
|
-
*/
|
|
697
|
-
p(this, J, (t) => {
|
|
698
|
-
const { row: s, cell: n, data: l, columnKey: i } = e(this, L).call(this, t, "body");
|
|
699
|
-
s && (this.dispatchEvent(
|
|
700
|
-
new qt({
|
|
701
|
-
target: s,
|
|
702
|
-
column: i,
|
|
703
|
-
row: l
|
|
704
|
-
})
|
|
705
|
-
), this.dispatchEvent(
|
|
706
|
-
new Dt({
|
|
707
|
-
cell: n,
|
|
708
|
-
column: i,
|
|
709
|
-
row: l
|
|
710
|
-
})
|
|
711
|
-
));
|
|
712
|
-
});
|
|
713
|
-
/**
|
|
714
|
-
* 滚动事件: 固定列样式
|
|
715
|
-
*/
|
|
716
|
-
p(this, O, () => {
|
|
717
|
-
const t = [...e(this, f).querySelectorAll(".is-fixed")], { scrollLeft: s } = e(this, f), n = Math.floor(e(this, f).scrollWidth - e(this, f).offsetWidth) - 1;
|
|
718
|
-
s < n ? s ? t.forEach((l) => {
|
|
719
|
-
l.classList.add("not-origin-position");
|
|
720
|
-
}) : t.forEach((l) => {
|
|
721
|
-
l.classList.toggle(
|
|
722
|
-
"not-origin-position",
|
|
723
|
-
!l.classList.contains("fixed-left")
|
|
724
|
-
);
|
|
725
|
-
}) : t.forEach((l) => {
|
|
726
|
-
l.classList.toggle(
|
|
727
|
-
"not-origin-position",
|
|
728
|
-
!l.classList.contains("fixed-right")
|
|
729
|
-
);
|
|
730
|
-
});
|
|
731
|
-
});
|
|
732
|
-
/**
|
|
733
|
-
* 鼠标进入单元格事件
|
|
734
|
-
* @param {MouseEvent} e
|
|
735
|
-
*/
|
|
736
|
-
p(this, Q, (t) => {
|
|
737
|
-
const { row: s, cell: n, data: l, columnKey: i } = e(this, L).call(this, t, "body");
|
|
738
|
-
s && this.dispatchEvent(
|
|
739
|
-
new At({
|
|
740
|
-
column: i,
|
|
741
|
-
row: l,
|
|
742
|
-
cell: n
|
|
743
|
-
})
|
|
744
|
-
);
|
|
745
|
-
});
|
|
746
|
-
/**
|
|
747
|
-
* 鼠标进入单元格事件
|
|
748
|
-
* @param {MouseEvent} e
|
|
749
|
-
*/
|
|
750
|
-
p(this, V, (t) => {
|
|
751
|
-
const { row: s, cell: n, data: l, columnKey: i } = e(this, L).call(this, t, "body");
|
|
752
|
-
s && this.dispatchEvent(
|
|
753
|
-
new Lt({
|
|
754
|
-
column: i,
|
|
755
|
-
row: l,
|
|
756
|
-
cell: n
|
|
757
|
-
})
|
|
758
|
-
);
|
|
759
|
-
});
|
|
760
|
-
/**
|
|
761
|
-
* 鼠标点击单元格事件
|
|
762
|
-
* @param {MouseEvent} e
|
|
763
|
-
*/
|
|
764
|
-
p(this, X, (t) => {
|
|
765
|
-
const { cell: s, columnKey: n } = e(this, L).call(this, t, "head");
|
|
766
|
-
s && this.dispatchEvent(
|
|
767
|
-
new Mt({
|
|
768
|
-
column: n,
|
|
769
|
-
cell: s
|
|
770
|
-
})
|
|
771
|
-
);
|
|
772
|
-
});
|
|
773
|
-
/**
|
|
774
|
-
* 表头鼠标右键事件
|
|
775
|
-
* @param {MouseEvent} e
|
|
776
|
-
*/
|
|
777
|
-
p(this, Y, (t) => {
|
|
778
|
-
const { cell: s, columnKey: n } = e(this, L).call(this, t, "head");
|
|
779
|
-
s && this.dispatchEvent(
|
|
780
|
-
new $t({
|
|
781
|
-
column: n,
|
|
782
|
-
cell: s
|
|
783
|
-
})
|
|
784
|
-
);
|
|
785
|
-
});
|
|
786
|
-
/**
|
|
787
|
-
* 监听默认插槽变化
|
|
788
|
-
*/
|
|
789
|
-
p(this, Z, () => {
|
|
790
|
-
this.$render(), e(this, h).originData.length > 0 && this.setData(e(this, h).originData);
|
|
791
|
-
});
|
|
792
|
-
/**
|
|
793
|
-
* 监听子元素变化
|
|
794
|
-
* @param {Event} e
|
|
795
|
-
*/
|
|
796
|
-
p(this, tt, (t) => {
|
|
797
|
-
t.stopImmediatePropagation(), this.$render(), e(this, h).originData.length > 0 && this.setData(e(this, h).originData);
|
|
798
|
-
});
|
|
799
|
-
/**
|
|
800
|
-
* 当存在 selection 列时,checkbox 的改变事件
|
|
801
|
-
* @param {Event} e
|
|
802
|
-
*/
|
|
803
|
-
p(this, et, (t) => {
|
|
804
|
-
if (t.target.getAttribute("data-type") !== "selection") return;
|
|
805
|
-
t.stopImmediatePropagation();
|
|
806
|
-
const { checked: s } = t.detail;
|
|
807
|
-
if (t.target.closest(".ea-table__thead")) {
|
|
808
|
-
const l = [
|
|
809
|
-
...e(this, w).querySelectorAll('ea-checkbox[data-type="selection"]')
|
|
810
|
-
];
|
|
811
|
-
t.target.toggleAttribute("checked", t.target.hasAttribute("checked")), l.forEach((c) => {
|
|
812
|
-
c.hasAttribute("disabled") || c.toggleAttribute("checked", s);
|
|
813
|
-
});
|
|
814
|
-
const i = e(this, D).call(this);
|
|
815
|
-
this.dispatchEvent(new mt({ selection: i }));
|
|
816
|
-
} else {
|
|
817
|
-
const l = e(this, D).call(this), i = e(this, h).dataSource.get(
|
|
818
|
-
t.target.closest('.ea-table__tr[part="tbody-tr"]')
|
|
819
|
-
);
|
|
820
|
-
e(this, P).call(this), this.dispatchEvent(
|
|
821
|
-
new ft({ selection: l, row: i })
|
|
822
|
-
);
|
|
823
|
-
}
|
|
824
|
-
e(this, $).call(this);
|
|
825
|
-
});
|
|
826
|
-
this.stylesheet = ht, this.shadowRoot.innerHTML = this.html(`
|
|
827
|
-
<slot id='defaultSlot' part='default-slot'></slot>
|
|
828
|
-
<table class='ea-table' part='container'>
|
|
829
|
-
<colgroup class='ea-table__colgroup' part='colgroup'></colgroup>
|
|
830
|
-
<thead class='ea-table__thead' part='thead'></thead>
|
|
831
|
-
<tbody class='ea-table__tbody' part='tbody'></tbody>
|
|
832
|
-
<tfoot class='ea-table__tfoot' part='tfoot'></tfoot>
|
|
833
|
-
</table>
|
|
834
|
-
<slot class="ea-table__empty" name="empty">No Data</slot>
|
|
835
|
-
`), C(this, f, this.shadowRoot.querySelector(".ea-table")), C(this, I, this.shadowRoot.querySelector("#defaultSlot")), C(this, T, this.shadowRoot.querySelector(".ea-table__thead")), C(this, w, this.shadowRoot.querySelector(".ea-table__tbody")), C(this, H, this.shadowRoot.querySelector(".ea-table__tfoot")), C(this, F, this.shadowRoot.querySelector(".ea-table__empty"));
|
|
836
|
-
}
|
|
837
|
-
static get observedAttributes() {
|
|
838
|
-
return [
|
|
839
|
-
...super.observedAttributes,
|
|
840
|
-
"stripe",
|
|
841
|
-
"border",
|
|
842
|
-
"height",
|
|
843
|
-
"max-height",
|
|
844
|
-
"highlight-current-row",
|
|
845
|
-
"show-summary"
|
|
846
|
-
];
|
|
847
|
-
}
|
|
848
|
-
/**
|
|
849
|
-
* 获取 classlist 列表
|
|
850
|
-
* @return {string} 属性值
|
|
851
|
-
*/
|
|
852
|
-
updateContainerClasslist() {
|
|
853
|
-
const t = this.computedClasslist(
|
|
854
|
-
"ea-table",
|
|
855
|
-
{},
|
|
856
|
-
{
|
|
857
|
-
stripe: this.stripe,
|
|
858
|
-
border: this.border,
|
|
859
|
-
"sticky-header": CSS.supports("height", this.height) || CSS.supports("height", this.maxHeight),
|
|
860
|
-
data: e(this, h).originData.length > 0
|
|
861
|
-
}
|
|
862
|
-
);
|
|
863
|
-
return e(this, f).className = t, e(this, F).className = this.computedClasslist(
|
|
864
|
-
"ea-table__empty",
|
|
865
|
-
{},
|
|
866
|
-
{
|
|
867
|
-
data: e(this, h).originData.length > 0
|
|
868
|
-
}
|
|
869
|
-
), t;
|
|
870
|
-
}
|
|
871
|
-
async $render() {
|
|
872
|
-
var t;
|
|
873
|
-
await customElements.whenDefined("ea-table-column"), (t = e(this, g)) == null || t.abort(), C(this, g, new AbortController()), e(this, B).call(this), e(this, K).call(this), this.addEventListener("ea-table-column-change", e(this, tt), {
|
|
874
|
-
signal: e(this, g).signal
|
|
875
|
-
}), e(this, f).addEventListener("mousedown", e(this, z), {
|
|
876
|
-
signal: e(this, g).signal
|
|
877
|
-
}), e(this, f).addEventListener("dblclick", e(this, G), {
|
|
878
|
-
signal: e(this, g).signal
|
|
879
|
-
}), e(this, f).addEventListener("contextmenu", e(this, J), {
|
|
880
|
-
signal: e(this, g).signal
|
|
881
|
-
}), e(this, T).addEventListener("click", e(this, X), {
|
|
882
|
-
signal: e(this, g).signal
|
|
883
|
-
}), e(this, T).addEventListener(
|
|
884
|
-
"contextmenu",
|
|
885
|
-
e(this, Y),
|
|
886
|
-
{
|
|
887
|
-
signal: e(this, g).signal
|
|
888
|
-
}
|
|
889
|
-
), e(this, f).addEventListener("scroll", e(this, O), {
|
|
890
|
-
signal: e(this, g).signal
|
|
891
|
-
}), e(this, f).addEventListener("mouseover", e(this, Q), {
|
|
892
|
-
signal: e(this, g).signal
|
|
893
|
-
}), e(this, f).addEventListener("mouseout", e(this, V), {
|
|
894
|
-
signal: e(this, g).signal
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
|
-
/**
|
|
898
|
-
* 获取当前行数据
|
|
899
|
-
* @returns {Promise<Object>}
|
|
900
|
-
*/
|
|
901
|
-
getCurrentRow() {
|
|
902
|
-
return e(this, h).currentRow;
|
|
903
|
-
}
|
|
904
|
-
/**
|
|
905
|
-
* 设置当前行数据
|
|
906
|
-
* @param {any} row 当前行数据
|
|
907
|
-
*/
|
|
908
|
-
setCurrentRow(t) {
|
|
909
|
-
let s = null, n = null;
|
|
910
|
-
t && typeof t == "object" && (s = e(this, h).dataIndex.get(t) || null, n = t), s && n ? (e(this, j).call(this, s, e(this, h).currentRow.target), e(this, h).currentRow.target = s, e(this, h).currentRow.value = n) : (e(this, U).call(this, e(this, h).currentRow.target), e(this, h).currentRow.value = null, e(this, h).currentRow.target = null);
|
|
911
|
-
}
|
|
912
|
-
connectedCallback() {
|
|
913
|
-
var t;
|
|
914
|
-
super.connectedCallback(), (t = e(this, g)) == null || t.abort(), C(this, g, new AbortController()), this.$render(), e(this, I).addEventListener("slotchange", e(this, Z), {
|
|
915
|
-
signal: e(this, g).signal
|
|
916
|
-
});
|
|
917
|
-
}
|
|
918
|
-
$beforeUnmounted() {
|
|
919
|
-
var t;
|
|
920
|
-
(t = e(this, g)) == null || t.abort();
|
|
921
|
-
for (const s in e(this, h))
|
|
922
|
-
e(this, h)[s] = null;
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
f = new WeakMap(), T = new WeakMap(), w = new WeakMap(), H = new WeakMap(), I = new WeakMap(), F = new WeakMap(), g = new WeakMap(), k = new WeakMap(), h = new WeakMap(), B = new WeakMap(), K = new WeakMap(), D = new WeakMap(), P = new WeakMap(), W = new WeakMap(), j = new WeakMap(), U = new WeakMap(), $ = new WeakMap(), z = new WeakMap(), L = new WeakMap(), G = new WeakMap(), J = new WeakMap(), O = new WeakMap(), Q = new WeakMap(), V = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), Z = new WeakMap(), tt = new WeakMap(), et = new WeakMap();
|
|
926
|
-
window.customElements.get("ea-table") || window.customElements.define("ea-table", Ht);
|
|
927
|
-
var R, q, M, st, y, _, lt;
|
|
928
|
-
class It extends rt {
|
|
929
|
-
constructor() {
|
|
930
|
-
super();
|
|
931
|
-
p(this, y);
|
|
932
|
-
/** @type {HTMLSpanElement | null} */
|
|
933
|
-
p(this, R);
|
|
934
|
-
/** @type {MutationObserver | null} */
|
|
935
|
-
p(this, q, null);
|
|
936
|
-
x(this, "state", this.properties({
|
|
937
|
-
type: {
|
|
938
|
-
type: ["selection", "index"],
|
|
939
|
-
default: "",
|
|
940
|
-
/** @param {"selection" | "index"} newVal */
|
|
941
|
-
observer: (t) => {
|
|
942
|
-
t === "selection" && !customElements.get("ea-checkbox") && import("./ea-checkbox.js"), S(this, y, _).call(this);
|
|
943
|
-
}
|
|
944
|
-
},
|
|
945
|
-
align: {
|
|
946
|
-
type: ["left", "center", "right"],
|
|
947
|
-
default: "left",
|
|
948
|
-
observer: () => {
|
|
949
|
-
S(this, y, _).call(this);
|
|
950
|
-
}
|
|
951
|
-
},
|
|
952
|
-
label: {
|
|
953
|
-
type: String,
|
|
954
|
-
default: "",
|
|
955
|
-
observer: () => {
|
|
956
|
-
e(this, R) && (e(this, R).textContent = `${this.label}[$${this.prop}]`), S(this, y, _).call(this);
|
|
957
|
-
}
|
|
958
|
-
},
|
|
959
|
-
prop: {
|
|
960
|
-
type: String,
|
|
961
|
-
default: "",
|
|
962
|
-
observer: () => {
|
|
963
|
-
e(this, R) && (e(this, R).textContent = `${this.label}[$${this.prop}]`), S(this, y, _).call(this);
|
|
964
|
-
}
|
|
965
|
-
},
|
|
966
|
-
colspan: {
|
|
967
|
-
type: Number,
|
|
968
|
-
default: () => this.querySelectorAll("ea-table-column").length || 1,
|
|
969
|
-
observer: () => {
|
|
970
|
-
S(this, y, _).call(this);
|
|
971
|
-
}
|
|
972
|
-
},
|
|
973
|
-
width: {
|
|
974
|
-
type: String,
|
|
975
|
-
default: "",
|
|
976
|
-
observer: () => {
|
|
977
|
-
S(this, y, _).call(this);
|
|
978
|
-
}
|
|
979
|
-
},
|
|
980
|
-
sortable: {
|
|
981
|
-
type: Boolean,
|
|
982
|
-
default: !1,
|
|
983
|
-
observer: () => {
|
|
984
|
-
S(this, y, _).call(this);
|
|
985
|
-
}
|
|
986
|
-
},
|
|
987
|
-
fixed: {
|
|
988
|
-
type: ["left", "right", "false"],
|
|
989
|
-
default: () => {
|
|
990
|
-
if (!this.hasAttribute("fixed")) return null;
|
|
991
|
-
const t = this.getAttribute("fixed");
|
|
992
|
-
return t === "false" || t === "null" || t === "" ? "left" : t || "left";
|
|
993
|
-
},
|
|
994
|
-
observer: () => {
|
|
995
|
-
S(this, y, _).call(this);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
}));
|
|
999
|
-
x(this, "propState", this.properties({
|
|
1000
|
-
option: {
|
|
1001
|
-
props: !0,
|
|
1002
|
-
type: Object,
|
|
1003
|
-
default: {},
|
|
1004
|
-
observer: () => {
|
|
1005
|
-
S(this, y, _).call(this);
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
}));
|
|
1009
|
-
x(this, "funcStates", this.properties({
|
|
1010
|
-
getColumnTree: {
|
|
1011
|
-
props: !0,
|
|
1012
|
-
type: Object,
|
|
1013
|
-
/**
|
|
1014
|
-
* @returns {TableColumnCtx}
|
|
1015
|
-
*/
|
|
1016
|
-
default: () => {
|
|
1017
|
-
const t = this.closest("ea-table"), s = [...this.querySelectorAll("& > ea-table-column")], n = this.shadowRoot.querySelector('slot[name="header"]'), l = this.shadowRoot.querySelector("#defaultSlot"), i = ["prop", "label", "width", "fixed", "sortable"];
|
|
1018
|
-
let c = null;
|
|
1019
|
-
if (s.length)
|
|
1020
|
-
c = s.map((u) => u.getColumnTree);
|
|
1021
|
-
else {
|
|
1022
|
-
const u = Array.from(l.assignedElements() || []).map((a) => {
|
|
1023
|
-
var b;
|
|
1024
|
-
return (b = a.outerHTML) == null ? void 0 : b.trim();
|
|
1025
|
-
}).join("");
|
|
1026
|
-
if (u) {
|
|
1027
|
-
const a = document.createElement("template");
|
|
1028
|
-
a.innerHTML = this.html(u), c = a;
|
|
1029
|
-
} else
|
|
1030
|
-
c = null;
|
|
1031
|
-
}
|
|
1032
|
-
return {
|
|
1033
|
-
label: this.label,
|
|
1034
|
-
prop: this.prop,
|
|
1035
|
-
type: this.type,
|
|
1036
|
-
colspan: this.colspan,
|
|
1037
|
-
rowspan: c ? 1 : e(this, st).call(this, t) - e(this, M).call(this, this, t) + 1,
|
|
1038
|
-
align: this.align,
|
|
1039
|
-
width: this.width,
|
|
1040
|
-
sortable: this.sortable,
|
|
1041
|
-
fixed: this.fixed,
|
|
1042
|
-
depth: e(this, M).call(this, this, t),
|
|
1043
|
-
props: [...this.attributes].filter(
|
|
1044
|
-
(u) => !i.includes(u.name)
|
|
1045
|
-
),
|
|
1046
|
-
header: n.assignedElements().map((u) => {
|
|
1047
|
-
var a;
|
|
1048
|
-
return (a = u.outerHTML) == null ? void 0 : a.trim();
|
|
1049
|
-
}).join("") || null,
|
|
1050
|
-
template: c
|
|
1051
|
-
};
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
}));
|
|
1055
|
-
/**
|
|
1056
|
-
* 获取当前组件的深度
|
|
1057
|
-
* @param {EaTableColumn} el
|
|
1058
|
-
* @param {import("../ea-table/index.js").EaTable} root
|
|
1059
|
-
* @returns {number}
|
|
1060
|
-
*/
|
|
1061
|
-
p(this, M, (t, s) => {
|
|
1062
|
-
let n = 0;
|
|
1063
|
-
for (; t !== s; )
|
|
1064
|
-
t = t.parentElement, n++;
|
|
1065
|
-
return n;
|
|
1066
|
-
});
|
|
1067
|
-
/**
|
|
1068
|
-
* 获取最大深度
|
|
1069
|
-
* @param {import("../ea-table/index.js").EaTable} root
|
|
1070
|
-
* @returns {number}
|
|
1071
|
-
*/
|
|
1072
|
-
p(this, st, (t) => {
|
|
1073
|
-
let s = 0;
|
|
1074
|
-
return t.querySelectorAll("ea-table-column").forEach((n) => {
|
|
1075
|
-
s = Math.max(s, e(this, M).call(this, n, t));
|
|
1076
|
-
}), s;
|
|
1077
|
-
});
|
|
1078
|
-
this.stylesheet = dt, this.$render();
|
|
1079
|
-
}
|
|
1080
|
-
static get observedAttributes() {
|
|
1081
|
-
return [
|
|
1082
|
-
...super.observedAttributes,
|
|
1083
|
-
"type",
|
|
1084
|
-
"align",
|
|
1085
|
-
"label",
|
|
1086
|
-
"prop",
|
|
1087
|
-
"colspan",
|
|
1088
|
-
"width",
|
|
1089
|
-
"sortable",
|
|
1090
|
-
"fixed"
|
|
1091
|
-
];
|
|
1092
|
-
}
|
|
1093
|
-
$render() {
|
|
1094
|
-
this.shadowRoot.innerHTML = `
|
|
1095
|
-
<div class='ea-table-column' part='container'>
|
|
1096
|
-
<header class='ea-table-column__label' part='label'>${this.label}[$${this.prop}]</header>
|
|
1097
|
-
<span class='ea-table-column__content' part='content'>
|
|
1098
|
-
<slot name="header"></slot>
|
|
1099
|
-
<slot id="defaultSlot" part="default-slot"></slot>
|
|
1100
|
-
</span>
|
|
1101
|
-
</div>
|
|
1102
|
-
`, C(this, R, this.shadowRoot.querySelector(".ea-table-column__label"));
|
|
1103
|
-
}
|
|
1104
|
-
connectedCallback() {
|
|
1105
|
-
super.connectedCallback(), S(this, y, lt).call(this);
|
|
1106
|
-
}
|
|
1107
|
-
$beforeUnmounted() {
|
|
1108
|
-
e(this, q) && (e(this, q).disconnect(), C(this, q, null));
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
R = new WeakMap(), q = new WeakMap(), M = new WeakMap(), st = new WeakMap(), y = new WeakSet(), /**
|
|
1112
|
-
* 通知父组件更新
|
|
1113
|
-
*/
|
|
1114
|
-
_ = function() {
|
|
1115
|
-
this.emit("ea-table-column-change", {
|
|
1116
|
-
bubbles: !0,
|
|
1117
|
-
composed: !0
|
|
1118
|
-
});
|
|
1119
|
-
}, /**
|
|
1120
|
-
* 监听默认插槽变化
|
|
1121
|
-
*/
|
|
1122
|
-
lt = function() {
|
|
1123
|
-
C(this, q, new MutationObserver(() => {
|
|
1124
|
-
S(this, y, _).call(this);
|
|
1125
|
-
})), e(this, q).observe(this, {
|
|
1126
|
-
childList: !0,
|
|
1127
|
-
subtree: !0,
|
|
1128
|
-
characterData: !0
|
|
1129
|
-
});
|
|
1130
|
-
};
|
|
1131
|
-
window.customElements.get("ea-table-column") || window.customElements.define("ea-table-column", It);
|
|
1132
|
-
export {
|
|
1133
|
-
Ht as EaTable,
|
|
1134
|
-
It as EaTableColumn
|
|
1135
|
-
};
|