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