easy-component-ui 3.0.14 → 3.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/dist/assets/icon.css +1 -0
  2. package/dist/components/Base.js +941 -0
  3. package/dist/components/ea-alert.js +213 -0
  4. package/dist/components/ea-avatar.js +164 -0
  5. package/dist/components/ea-backtop.js +136 -0
  6. package/dist/components/ea-badge.js +144 -0
  7. package/dist/components/ea-breadcrumb.js +148 -0
  8. package/dist/components/ea-button.js +266 -0
  9. package/dist/components/ea-calendar.js +10 -0
  10. package/dist/components/ea-calendar2.js +673 -0
  11. package/dist/components/ea-card.js +121 -0
  12. package/dist/components/ea-carousel.js +415 -0
  13. package/dist/components/ea-checkbox.js +446 -0
  14. package/dist/components/ea-collapse.js +313 -0
  15. package/dist/components/ea-color-picker.js +888 -0
  16. package/dist/components/ea-container.js +206 -0
  17. package/dist/components/ea-countdown.js +142 -0
  18. package/dist/components/ea-date-picker.js +649 -0
  19. package/dist/components/ea-descriptions.js +474 -0
  20. package/dist/components/ea-dialog.js +249 -0
  21. package/dist/components/ea-drawer.js +216 -0
  22. package/dist/components/ea-dropdown.js +228 -0
  23. package/dist/components/ea-empty.js +93 -0
  24. package/dist/components/ea-icon.js +159 -0
  25. package/dist/components/ea-image-preview.js +532 -0
  26. package/dist/components/ea-image.js +327 -0
  27. package/dist/components/ea-infinite-scroll.js +109 -0
  28. package/dist/components/ea-input-number.js +367 -0
  29. package/dist/components/ea-input.js +588 -0
  30. package/dist/components/ea-layout.js +132 -0
  31. package/dist/components/ea-link.js +101 -0
  32. package/dist/components/ea-menu.js +433 -0
  33. package/dist/components/ea-message-box.js +624 -0
  34. package/dist/components/ea-message.js +313 -0
  35. package/dist/components/ea-notification.js +331 -0
  36. package/dist/components/ea-overlay.js +168 -0
  37. package/dist/components/ea-page-header.js +108 -0
  38. package/dist/components/ea-pagination.js +481 -0
  39. package/dist/components/ea-popconfirm.js +275 -0
  40. package/dist/components/ea-popover.js +147 -0
  41. package/dist/components/ea-popper.js +203 -0
  42. package/dist/components/ea-progress.js +286 -0
  43. package/dist/components/ea-radio.js +364 -0
  44. package/dist/components/ea-rate.js +241 -0
  45. package/dist/components/ea-result.js +100 -0
  46. package/dist/components/ea-scrollbar.js +235 -0
  47. package/dist/components/ea-segmented.js +215 -0
  48. package/dist/components/ea-select.js +609 -0
  49. package/dist/components/ea-skeleton.js +263 -0
  50. package/dist/components/ea-slider.js +430 -0
  51. package/dist/components/ea-space.js +123 -0
  52. package/dist/components/ea-splitter.js +233 -0
  53. package/dist/components/ea-statistic.js +74 -0
  54. package/dist/components/ea-steps.js +346 -0
  55. package/dist/components/ea-switch.js +271 -0
  56. package/dist/components/ea-table.js +1137 -0
  57. package/dist/components/ea-tabs.js +503 -0
  58. package/dist/components/ea-tag.js +228 -0
  59. package/dist/components/ea-text.js +113 -0
  60. package/dist/components/ea-time-picker.js +510 -0
  61. package/dist/components/ea-timeline.js +185 -0
  62. package/dist/components/ea-tooltip.js +161 -0
  63. package/dist/components/ea-tour.js +544 -0
  64. package/dist/components/ea-transfer.js +949 -0
  65. package/dist/components/ea-tree.js +1125 -0
  66. package/dist/components/index.js +60 -0
  67. package/dist/core/FormBase.js +238 -0
  68. package/dist/css/ea-alert.style.js +4 -0
  69. package/dist/css/ea-aside.style.js +4 -0
  70. package/dist/css/ea-avatar.style.js +4 -0
  71. package/dist/css/ea-backtop.style.js +4 -0
  72. package/dist/css/ea-badge.style.js +4 -0
  73. package/dist/css/ea-breadcrumb-item.style.js +4 -0
  74. package/dist/css/ea-breadcrumb.style.js +4 -0
  75. package/dist/css/ea-button-group.style.js +4 -0
  76. package/dist/css/ea-button.style.js +4 -0
  77. package/dist/css/ea-calendar.style.js +4 -0
  78. package/dist/css/ea-card.style.js +4 -0
  79. package/dist/css/ea-carousel-item.style.js +4 -0
  80. package/dist/css/ea-carousel.style.js +4 -0
  81. package/dist/css/ea-check-tag.style.js +4 -0
  82. package/dist/css/ea-checkbox-group.style.js +4 -0
  83. package/dist/css/ea-checkbox.style.js +4 -0
  84. package/dist/css/ea-col.style.js +4 -0
  85. package/dist/css/ea-collapse-item.style.js +4 -0
  86. package/dist/css/ea-collapse.style.js +4 -0
  87. package/dist/css/ea-color-picker-panel.style.js +4 -0
  88. package/dist/css/ea-color-picker.style.js +4 -0
  89. package/dist/css/ea-container.style.js +4 -0
  90. package/dist/css/ea-date-picker.style.js +4 -0
  91. package/dist/css/ea-descriptions-item.style.js +4 -0
  92. package/dist/css/ea-descriptions.style.js +4 -0
  93. package/dist/css/ea-dialog.style.js +4 -0
  94. package/dist/css/ea-drawer.style.js +4 -0
  95. package/dist/css/ea-dropdown-item.style.js +4 -0
  96. package/dist/css/ea-dropdown-menu.style.js +4 -0
  97. package/dist/css/ea-dropdown.style.js +4 -0
  98. package/dist/css/ea-empty.style.js +4 -0
  99. package/dist/css/ea-footer.style.js +4 -0
  100. package/dist/css/ea-header.style.js +4 -0
  101. package/dist/css/ea-icon.style.js +4 -0
  102. package/dist/css/ea-image-preview.style.js +4 -0
  103. package/dist/css/ea-image.style.js +4 -0
  104. package/dist/css/ea-infinite-scroll.style.js +4 -0
  105. package/dist/css/ea-input-number.style.js +4 -0
  106. package/dist/css/ea-input.style.js +4 -0
  107. package/dist/css/ea-link.style.js +4 -0
  108. package/dist/css/ea-main.style.js +4 -0
  109. package/dist/css/ea-menu-item-group.style.js +4 -0
  110. package/dist/css/ea-menu-item.style.js +4 -0
  111. package/dist/css/ea-menu.style.js +4 -0
  112. package/dist/css/ea-message-box.style.js +4 -0
  113. package/dist/css/ea-message.style.js +4 -0
  114. package/dist/css/ea-notification.style.js +4 -0
  115. package/dist/css/ea-option-gropu.style.js +4 -0
  116. package/dist/css/ea-option.style.js +4 -0
  117. package/dist/css/ea-overlay.style.js +4 -0
  118. package/dist/css/ea-page-header.style.js +4 -0
  119. package/dist/css/ea-pagination.style.js +4 -0
  120. package/dist/css/ea-popconfirm.style.js +4 -0
  121. package/dist/css/ea-popover.style.js +4 -0
  122. package/dist/css/ea-popper.style.js +4 -0
  123. package/dist/css/ea-progress.style.js +4 -0
  124. package/dist/css/ea-radio-group.style.js +4 -0
  125. package/dist/css/ea-radio.style.js +4 -0
  126. package/dist/css/ea-rate.style.js +4 -0
  127. package/dist/css/ea-result.style.js +4 -0
  128. package/dist/css/ea-row.style.js +4 -0
  129. package/dist/css/ea-scrollbar.style.js +4 -0
  130. package/dist/css/ea-segmented.style.js +4 -0
  131. package/dist/css/ea-select.style.js +4 -0
  132. package/dist/css/ea-skeleton-item.style.js +4 -0
  133. package/dist/css/ea-skeleton.style.js +4 -0
  134. package/dist/css/ea-slider.style.js +4 -0
  135. package/dist/css/ea-space.style.js +4 -0
  136. package/dist/css/ea-splitter-bar.style.js +4 -0
  137. package/dist/css/ea-splitter-panel.style.js +4 -0
  138. package/dist/css/ea-splitter.style.js +4 -0
  139. package/dist/css/ea-statistic.style.js +4 -0
  140. package/dist/css/ea-step.style.js +4 -0
  141. package/dist/css/ea-steps.style.js +4 -0
  142. package/dist/css/ea-sub-menu.style.js +4 -0
  143. package/dist/css/ea-switch.style.js +4 -0
  144. package/dist/css/ea-tab-panel.style.js +4 -0
  145. package/dist/css/ea-tab.style.js +4 -0
  146. package/dist/css/ea-table-column.style.js +4 -0
  147. package/dist/css/ea-table.style.js +4 -0
  148. package/dist/css/ea-tabs.style.js +4 -0
  149. package/dist/css/ea-tag.style.js +4 -0
  150. package/dist/css/ea-text.style.js +4 -0
  151. package/dist/css/ea-time-picker.style.js +4 -0
  152. package/dist/css/ea-timeline-item.style.js +4 -0
  153. package/dist/css/ea-timeline.style.js +4 -0
  154. package/dist/css/ea-tooltip.style.js +4 -0
  155. package/dist/css/ea-tour-step.style.js +4 -0
  156. package/dist/css/ea-tour.style.js +4 -0
  157. package/dist/css/ea-transfer.style.js +5 -0
  158. package/dist/css/ea-tree.style.js +6 -0
  159. package/dist/css/ea-ui-component.style.js +4 -0
  160. package/dist/favicon.ico +0 -0
  161. package/dist/utils/Color.js +439 -0
  162. package/dist/utils/I18nManager.js +218 -0
  163. package/dist/utils/Utils.js +65 -0
  164. package/dist/utils/Variables.js +12 -0
  165. package/dist/utils/parseTime.js +73 -0
  166. package/dist/utils/timeout.js +9 -0
  167. package/package.json +1 -1
@@ -0,0 +1,1137 @@
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, $, P, W, j, U, M, 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 A;
388
+ const b = n, { template: m } = a, d = document.createElement("td");
389
+ d.part = "tbody-td", d.className = "ea-table__td";
390
+ const v = a.fixed && a.fixed !== "false";
391
+ if (d.classList.toggle("is-fixed", v), d.classList.toggle(`fixed-${a.fixed}`, v), d.classList.toggle(
392
+ `ea-table__cell--align-${a.align}`,
393
+ a.align
394
+ ), a.width && d.style.setProperty("--ea-table-cell-width", a.width), m) {
395
+ const D = m.content.cloneNode(!0);
396
+ D.querySelectorAll("*").forEach((nt) => {
397
+ nt.setAttribute("data-template-cell", "");
398
+ }), d.appendChild(D);
399
+ } else a.type ? d.innerHTML = (A = c[a.type]) == null ? void 0 : A.call(c) : d.setAttribute("data-scope", a.prop);
400
+ b.appendChild(d);
401
+ }), t.forEach((a, b) => {
402
+ const m = n.cloneNode(!0);
403
+ if (m.setAttribute("data-index", b), typeof this.selectable == "function") {
404
+ const d = !this.selectable(a);
405
+ m.querySelector(
406
+ 'ea-checkbox[data-type="selection"]'
407
+ ).toggleAttribute("disabled", d);
408
+ }
409
+ if (l.some((d) => d.type === "index") && typeof this.indexMethod == "function") {
410
+ const d = m.querySelector(".ea-table__index");
411
+ d.textContent = this.indexMethod(b);
412
+ }
413
+ m.querySelectorAll("[data-scope]").forEach((d) => {
414
+ const v = d.getAttribute("data-scope"), A = l.find((D) => D.prop === v);
415
+ A ? d.textContent = a[A.prop] : v in a && (d.textContent = a[v]);
416
+ }), s.appendChild(m), e(this, h).dataSource.set(m, a), a && typeof a == "object" && e(this, h).dataIndex.set(a, m);
417
+ }), this["show-summary"] && typeof this.summaryMethod == "function") {
418
+ const a = e(this, H).querySelectorAll(
419
+ ".ea-table__td[data-scope]"
420
+ ), b = this.summaryMethod({ columns: l, data: t });
421
+ a.forEach((m, d) => {
422
+ m.textContent = b[d];
423
+ });
424
+ }
425
+ e(this, w).appendChild(s), i && e(this, f).addEventListener("change", e(this, et), {
426
+ signal: e(this, g).signal
427
+ }), e(this, W).call(this), e(this, O).call(this), this.updateContainerClasslist(), e(this, h).isDataRendered = !0, this.emit("ea-table-data-rendered");
428
+ });
429
+ /**
430
+ * 排序
431
+ * @param {string} prop
432
+ * @param {"asc" | "desc"} order
433
+ */
434
+ x(this, "sort", (t, s = "asc") => {
435
+ const n = document.createDocumentFragment(), l = e(this, w).nextElementSibling;
436
+ n.appendChild(e(this, w)), [...n.querySelectorAll("tr")].sort((c, u) => {
437
+ const a = e(this, h).dataSource.get(c), b = e(this, h).dataSource.get(u);
438
+ return s === "asc" ? String(a[t]).localeCompare(b[t]) : String(b[t]).localeCompare(a[t]);
439
+ }).forEach((c) => {
440
+ e(this, w).appendChild(c);
441
+ }), e(this, f).insertBefore(n, l), this.dispatchEvent(
442
+ new kt({
443
+ prop: t,
444
+ order: s
445
+ })
446
+ );
447
+ });
448
+ /**
449
+ * 设置行样式
450
+ * @param {Function | String} handler
451
+ */
452
+ x(this, "setRowStylePart", async (t) => {
453
+ e(this, h).isDataRendered || await E.EaElement.addAsyncEventListener(
454
+ this,
455
+ "ea-table-data-rendered",
456
+ !0
457
+ );
458
+ const s = [...e(this, w).querySelectorAll("tr")];
459
+ if (typeof t == "function")
460
+ s.forEach((n, l) => {
461
+ const i = t({
462
+ row: e(this, h).dataSource.get(n),
463
+ rowIndex: l
464
+ });
465
+ i && n.part.add(i);
466
+ });
467
+ else if (typeof t == "string") {
468
+ if (!t) return;
469
+ s.forEach((n) => {
470
+ n.part.add(t);
471
+ });
472
+ }
473
+ });
474
+ /**
475
+ * 设置当前行是否被选中
476
+ * @param {any} row
477
+ * @param {Boolean} selected
478
+ * @param {boolean} [ignoreSelectable]
479
+ */
480
+ x(this, "toggleRowSelection", (t, s, n = !0) => {
481
+ if (!e(this, h).columns.some(
482
+ (a) => a.type === "selection"
483
+ )) return;
484
+ const i = e(this, h).dataIndex.get(t);
485
+ if (!i) return;
486
+ const c = `ea-checkbox[data-type="selection"]${n ? "" : ":not([disabled])"}`, u = i.querySelector(c);
487
+ u && (s ? u.toggleAttribute("checked", s) : u.toggleAttribute("checked", !u.checked), e(this, P).call(this), e(this, M).call(this));
488
+ });
489
+ /**
490
+ * 清空选择
491
+ */
492
+ x(this, "clearSelection", () => {
493
+ [
494
+ ...e(this, f).querySelectorAll('ea-checkbox[data-type="selection"]')
495
+ ].forEach((s) => {
496
+ s.removeAttribute("checked"), s.removeAttribute("indeterminate");
497
+ }), e(this, M).call(this);
498
+ });
499
+ /**
500
+ * 获取当前选中的行
501
+ * @returns {any[]}
502
+ */
503
+ p(this, $, () => [
504
+ ...e(this, w).querySelectorAll(
505
+ 'ea-checkbox[data-type="selection"][checked]'
506
+ )
507
+ ].map(
508
+ (t) => e(this, h).dataSource.get(t.closest('.ea-table__tr[part="tbody-tr"]'))
509
+ ));
510
+ /**
511
+ * 更新选中状态
512
+ */
513
+ p(this, P, () => {
514
+ const t = e(this, T).querySelector(
515
+ 'ea-checkbox[data-type="selection"]'
516
+ ), s = [
517
+ ...e(this, w).querySelectorAll(
518
+ 'ea-checkbox[data-type="selection"]:not([disabled])'
519
+ )
520
+ ].every((l) => l.hasAttribute("checked")), n = [
521
+ ...e(this, w).querySelectorAll('ea-checkbox[data-type="selection"]')
522
+ ].some((l) => l.hasAttribute("checked"));
523
+ s ? (t.toggleAttribute("checked", !0), t.removeAttribute("indeterminate")) : n ? (t.removeAttribute("checked"), t.toggleAttribute("indeterminate", !0)) : (t.removeAttribute("checked"), t.removeAttribute("indeterminate"));
524
+ });
525
+ /**
526
+ * 处理固定列的位置和阴影(box-shadow)
527
+ */
528
+ p(this, W, () => {
529
+ const t = [...e(this, f).querySelectorAll(".is-fixed")], s = t.filter(
530
+ (a) => a.classList.contains("fixed-left")
531
+ ), n = t.filter(
532
+ (a) => a.classList.contains("fixed-right")
533
+ ), l = (a) => {
534
+ const b = a.filter((d) => d.part.contains("thead-th"));
535
+ if (b.length <= 1) return [a];
536
+ const m = [];
537
+ for (let d = 0; d < a.length; d += b.length)
538
+ m.push(a.slice(d, d + b.length));
539
+ return m.reduce((d, v) => (v.forEach((A, D) => {
540
+ d[D] = [...d[D], A];
541
+ }), d), Array(b.length).fill([]));
542
+ }, i = (a) => {
543
+ if (!a.length) return;
544
+ const b = a.slice(-1)[0];
545
+ a.forEach((m, d) => {
546
+ const v = a[d - 1] || [];
547
+ m.forEach((A) => {
548
+ b && v[0] && A.style.setProperty(
549
+ "--ea-table-fixed-x",
550
+ `${d * v[0].offsetWidth}px`
551
+ );
552
+ });
553
+ }), b.forEach((m) => {
554
+ m.classList.add("is-last");
555
+ });
556
+ }, [c, u] = [
557
+ l(s),
558
+ l(n).reverse()
559
+ ];
560
+ i(c), i(u);
561
+ });
562
+ /**
563
+ * 设置高亮当前行样式
564
+ * @param {HTMLTableRowElement} currentRow
565
+ * @param {HTMLTableRowElement} [oldRow]
566
+ */
567
+ p(this, j, (t, s = e(this, h).currentRow.target) => {
568
+ var n, l;
569
+ 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"));
570
+ });
571
+ /**
572
+ * 取消高亮当前行样式
573
+ * @param {HTMLTableRowElement} currentRow
574
+ */
575
+ p(this, U, (t) => {
576
+ var s;
577
+ !this["highlight-current-row"] || !t || (s = t == null ? void 0 : t.classList) == null || s.remove("is-current");
578
+ });
579
+ /**
580
+ * 派发选择改变事件
581
+ */
582
+ p(this, M, () => {
583
+ const t = e(this, $).call(this);
584
+ this.dispatchEvent(
585
+ new gt({
586
+ newSelection: t
587
+ })
588
+ );
589
+ });
590
+ /**
591
+ * 点击事件: 行点击, 单元格点击
592
+ * @param {MouseEvent} e
593
+ */
594
+ p(this, z, (t) => {
595
+ var i;
596
+ const s = t.target.closest("tr[part='tbody-tr']");
597
+ if ((i = e(this, k).selectAbortController) == null || i.abort(), !s) return;
598
+ const n = () => {
599
+ var c;
600
+ (c = e(this, k).selectAbortController) == null || c.abort();
601
+ }, l = (c) => {
602
+ const u = c.target.closest("tr[part='tbody-tr']"), a = c.target.closest("td[part='tbody-td']");
603
+ if (n(), u !== s) return;
604
+ const b = e(this, h).dataSource.get(s), m = a == null ? void 0 : a.getAttribute("data-scope");
605
+ 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(
606
+ new bt({
607
+ target: s,
608
+ column: m,
609
+ row: b
610
+ })
611
+ ), this.dispatchEvent(
612
+ new pt({
613
+ target: s,
614
+ column: m,
615
+ row: b
616
+ })
617
+ ), a) {
618
+ this.dispatchEvent(
619
+ new ut({
620
+ cell: a,
621
+ column: m,
622
+ row: b
623
+ })
624
+ );
625
+ const d = c.target.closest("[data-template-cell]");
626
+ if (d) {
627
+ const v = Number(s.getAttribute("data-index"));
628
+ this.dispatchEvent(
629
+ new Nt({
630
+ target: d,
631
+ rowData: b,
632
+ rowIndex: v,
633
+ originalEvent: c
634
+ })
635
+ );
636
+ }
637
+ }
638
+ };
639
+ e(this, k).selectAbortController = new AbortController(), this.addEventListener("mouseout", n, {
640
+ once: !0,
641
+ signal: e(this, k).selectAbortController.signal
642
+ }), e(this, f).addEventListener("mouseup", l, {
643
+ once: !0,
644
+ signal: e(this, k).selectAbortController.signal
645
+ });
646
+ });
647
+ /**
648
+ * 鼠标相关事件的共同处理逻辑
649
+ * @param {MouseEvent} e
650
+ * @param {'body' | 'head'} part
651
+ * @returns {{
652
+ * cell: HTMLTableCellElement;
653
+ * row: HTMLTableRowElement;
654
+ * data: any;
655
+ * columnKey: string;
656
+ * } | {
657
+ * cell: HTMLTableCellElement;
658
+ * columnKey: string;
659
+ * }}
660
+ */
661
+ p(this, L, (t, s) => {
662
+ const n = t.target.closest(`tr[part='t${s}-tr']`);
663
+ if (!n) return { cell: null, row: null, data: null, columnKey: null };
664
+ 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");
665
+ return s === "body" ? {
666
+ cell: i,
667
+ row: n,
668
+ data: c,
669
+ columnKey: u
670
+ } : {
671
+ cell: i,
672
+ columnKey: u
673
+ };
674
+ });
675
+ /**
676
+ * 鼠标双击事件: 行双击, 单元格双击
677
+ * @param {MouseEvent} e
678
+ */
679
+ p(this, G, (t) => {
680
+ const { row: s, cell: n, data: l, columnKey: i } = e(this, L).call(this, t, "body");
681
+ s && (this.dispatchEvent(
682
+ new Rt({
683
+ target: s,
684
+ column: i,
685
+ row: l
686
+ })
687
+ ), this.dispatchEvent(
688
+ new Tt({
689
+ cell: n,
690
+ column: i,
691
+ row: l
692
+ })
693
+ ));
694
+ });
695
+ /**
696
+ * 鼠标右击事件: 行右击, 单元格右击
697
+ * @param {MouseEvent} e
698
+ */
699
+ p(this, J, (t) => {
700
+ const { row: s, cell: n, data: l, columnKey: i } = e(this, L).call(this, t, "body");
701
+ s && (this.dispatchEvent(
702
+ new qt({
703
+ target: s,
704
+ column: i,
705
+ row: l
706
+ })
707
+ ), this.dispatchEvent(
708
+ new Dt({
709
+ cell: n,
710
+ column: i,
711
+ row: l
712
+ })
713
+ ));
714
+ });
715
+ /**
716
+ * 滚动事件: 固定列样式
717
+ */
718
+ p(this, O, () => {
719
+ 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;
720
+ s < n ? s ? t.forEach((l) => {
721
+ l.classList.add("not-origin-position");
722
+ }) : t.forEach((l) => {
723
+ l.classList.toggle(
724
+ "not-origin-position",
725
+ !l.classList.contains("fixed-left")
726
+ );
727
+ }) : t.forEach((l) => {
728
+ l.classList.toggle(
729
+ "not-origin-position",
730
+ !l.classList.contains("fixed-right")
731
+ );
732
+ });
733
+ });
734
+ /**
735
+ * 鼠标进入单元格事件
736
+ * @param {MouseEvent} e
737
+ */
738
+ p(this, Q, (t) => {
739
+ const { row: s, cell: n, data: l, columnKey: i } = e(this, L).call(this, t, "body");
740
+ s && this.dispatchEvent(
741
+ new At({
742
+ column: i,
743
+ row: l,
744
+ cell: n
745
+ })
746
+ );
747
+ });
748
+ /**
749
+ * 鼠标进入单元格事件
750
+ * @param {MouseEvent} e
751
+ */
752
+ p(this, V, (t) => {
753
+ const { row: s, cell: n, data: l, columnKey: i } = e(this, L).call(this, t, "body");
754
+ s && this.dispatchEvent(
755
+ new Lt({
756
+ column: i,
757
+ row: l,
758
+ cell: n
759
+ })
760
+ );
761
+ });
762
+ /**
763
+ * 鼠标点击单元格事件
764
+ * @param {MouseEvent} e
765
+ */
766
+ p(this, X, (t) => {
767
+ const { cell: s, columnKey: n } = e(this, L).call(this, t, "head");
768
+ s && this.dispatchEvent(
769
+ new Mt({
770
+ column: n,
771
+ cell: s
772
+ })
773
+ );
774
+ });
775
+ /**
776
+ * 表头鼠标右键事件
777
+ * @param {MouseEvent} e
778
+ */
779
+ p(this, Y, (t) => {
780
+ const { cell: s, columnKey: n } = e(this, L).call(this, t, "head");
781
+ s && this.dispatchEvent(
782
+ new $t({
783
+ column: n,
784
+ cell: s
785
+ })
786
+ );
787
+ });
788
+ /**
789
+ * 监听默认插槽变化
790
+ */
791
+ p(this, Z, () => {
792
+ this.$render(), e(this, h).originData.length > 0 && this.setData(e(this, h).originData);
793
+ });
794
+ /**
795
+ * 监听子元素变化
796
+ * @param {Event} e
797
+ */
798
+ p(this, tt, (t) => {
799
+ t.stopImmediatePropagation(), this.$render(), e(this, h).originData.length > 0 && this.setData(e(this, h).originData);
800
+ });
801
+ /**
802
+ * 当存在 selection 列时,checkbox 的改变事件
803
+ * @param {Event} e
804
+ */
805
+ p(this, et, (t) => {
806
+ if (t.target.getAttribute("data-type") !== "selection") return;
807
+ t.stopImmediatePropagation();
808
+ const { checked: s } = t.detail;
809
+ if (t.target.closest(".ea-table__thead")) {
810
+ const l = [
811
+ ...e(this, w).querySelectorAll('ea-checkbox[data-type="selection"]')
812
+ ];
813
+ t.target.toggleAttribute("checked", t.target.hasAttribute("checked")), l.forEach((c) => {
814
+ c.hasAttribute("disabled") || c.toggleAttribute("checked", s);
815
+ });
816
+ const i = e(this, $).call(this);
817
+ this.dispatchEvent(new mt({ selection: i }));
818
+ } else {
819
+ const l = e(this, $).call(this), i = e(this, h).dataSource.get(
820
+ t.target.closest('.ea-table__tr[part="tbody-tr"]')
821
+ );
822
+ e(this, P).call(this), this.dispatchEvent(
823
+ new ft({ selection: l, row: i })
824
+ );
825
+ }
826
+ e(this, M).call(this);
827
+ });
828
+ this.stylesheet = ht, this.shadowRoot.innerHTML = this.html(`
829
+ <slot id='defaultSlot' part='default-slot'></slot>
830
+ <table class='ea-table' part='container'>
831
+ <colgroup class='ea-table__colgroup' part='colgroup'></colgroup>
832
+ <thead class='ea-table__thead' part='thead'></thead>
833
+ <tbody class='ea-table__tbody' part='tbody'></tbody>
834
+ <tfoot class='ea-table__tfoot' part='tfoot'></tfoot>
835
+ </table>
836
+ <slot class="ea-table__empty" name="empty">No Data</slot>
837
+ `), 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"));
838
+ }
839
+ static get observedAttributes() {
840
+ return [
841
+ ...super.observedAttributes,
842
+ "stripe",
843
+ "border",
844
+ "height",
845
+ "max-height",
846
+ "highlight-current-row",
847
+ "show-summary"
848
+ ];
849
+ }
850
+ /**
851
+ * 获取 classlist 列表
852
+ * @return {string} 属性值
853
+ */
854
+ updateContainerClasslist() {
855
+ const t = this.computedClasslist(
856
+ "ea-table",
857
+ {},
858
+ {
859
+ stripe: this.stripe,
860
+ border: this.border,
861
+ "sticky-header": CSS.supports("height", this.height) || CSS.supports("height", this.maxHeight),
862
+ data: e(this, h).originData.length > 0
863
+ }
864
+ );
865
+ return e(this, f).className = t, e(this, F).className = this.computedClasslist(
866
+ "ea-table__empty",
867
+ {},
868
+ {
869
+ data: e(this, h).originData.length > 0
870
+ }
871
+ ), t;
872
+ }
873
+ async $render() {
874
+ var t;
875
+ 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), {
876
+ signal: e(this, g).signal
877
+ }), e(this, f).addEventListener("mousedown", e(this, z), {
878
+ signal: e(this, g).signal
879
+ }), e(this, f).addEventListener("dblclick", e(this, G), {
880
+ signal: e(this, g).signal
881
+ }), e(this, f).addEventListener("contextmenu", e(this, J), {
882
+ signal: e(this, g).signal
883
+ }), e(this, T).addEventListener("click", e(this, X), {
884
+ signal: e(this, g).signal
885
+ }), e(this, T).addEventListener(
886
+ "contextmenu",
887
+ e(this, Y),
888
+ {
889
+ signal: e(this, g).signal
890
+ }
891
+ ), e(this, f).addEventListener("scroll", e(this, O), {
892
+ signal: e(this, g).signal
893
+ }), e(this, f).addEventListener("mouseover", e(this, Q), {
894
+ signal: e(this, g).signal
895
+ }), e(this, f).addEventListener("mouseout", e(this, V), {
896
+ signal: e(this, g).signal
897
+ });
898
+ }
899
+ /**
900
+ * 获取当前行数据
901
+ * @returns {Promise<Object>}
902
+ */
903
+ getCurrentRow() {
904
+ return e(this, h).currentRow;
905
+ }
906
+ /**
907
+ * 设置当前行数据
908
+ * @param {any} row 当前行数据
909
+ */
910
+ setCurrentRow(t) {
911
+ let s = null, n = null;
912
+ 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);
913
+ }
914
+ connectedCallback() {
915
+ var t;
916
+ super.connectedCallback(), (t = e(this, g)) == null || t.abort(), C(this, g, new AbortController()), this.$render(), e(this, I).addEventListener("slotchange", e(this, Z), {
917
+ signal: e(this, g).signal
918
+ });
919
+ }
920
+ $beforeUnmounted() {
921
+ var t;
922
+ (t = e(this, g)) == null || t.abort();
923
+ for (const s in e(this, h))
924
+ e(this, h)[s] = null;
925
+ }
926
+ }
927
+ 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(), $ = new WeakMap(), P = new WeakMap(), W = new WeakMap(), j = new WeakMap(), U = new WeakMap(), M = 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();
928
+ window.customElements.get("ea-table") || window.customElements.define("ea-table", Ht);
929
+ var R, q, N, st, y, _, lt;
930
+ class It extends rt {
931
+ constructor() {
932
+ super();
933
+ p(this, y);
934
+ /** @type {HTMLSpanElement | null} */
935
+ p(this, R);
936
+ /** @type {MutationObserver | null} */
937
+ p(this, q, null);
938
+ x(this, "state", this.properties({
939
+ type: {
940
+ type: ["selection", "index"],
941
+ default: "",
942
+ /** @param {"selection" | "index"} newVal */
943
+ observer: (t) => {
944
+ t === "selection" && !customElements.get("ea-checkbox") && import("./ea-checkbox.js"), S(this, y, _).call(this);
945
+ }
946
+ },
947
+ align: {
948
+ type: ["left", "center", "right"],
949
+ default: "left",
950
+ observer: () => {
951
+ S(this, y, _).call(this);
952
+ }
953
+ },
954
+ label: {
955
+ type: String,
956
+ default: "",
957
+ observer: () => {
958
+ e(this, R) && (e(this, R).textContent = `${this.label}[$${this.prop}]`), S(this, y, _).call(this);
959
+ }
960
+ },
961
+ prop: {
962
+ type: String,
963
+ default: "",
964
+ observer: () => {
965
+ e(this, R) && (e(this, R).textContent = `${this.label}[$${this.prop}]`), S(this, y, _).call(this);
966
+ }
967
+ },
968
+ colspan: {
969
+ type: Number,
970
+ default: () => this.querySelectorAll("ea-table-column").length || 1,
971
+ observer: () => {
972
+ S(this, y, _).call(this);
973
+ }
974
+ },
975
+ width: {
976
+ type: String,
977
+ default: "",
978
+ observer: () => {
979
+ S(this, y, _).call(this);
980
+ }
981
+ },
982
+ sortable: {
983
+ type: Boolean,
984
+ default: !1,
985
+ observer: () => {
986
+ S(this, y, _).call(this);
987
+ }
988
+ },
989
+ fixed: {
990
+ type: ["left", "right", "false"],
991
+ default: () => {
992
+ if (!this.hasAttribute("fixed")) return "false";
993
+ const t = this.getAttribute("fixed");
994
+ return t === "false" || t === "null" ? "false" : t === "" ? "left" : t || "left";
995
+ },
996
+ observer: () => {
997
+ S(this, y, _).call(this);
998
+ }
999
+ }
1000
+ }));
1001
+ x(this, "propState", this.properties({
1002
+ option: {
1003
+ props: !0,
1004
+ type: Object,
1005
+ default: {},
1006
+ observer: () => {
1007
+ S(this, y, _).call(this);
1008
+ }
1009
+ }
1010
+ }));
1011
+ x(this, "funcStates", this.properties({
1012
+ getColumnTree: {
1013
+ props: !0,
1014
+ type: Object,
1015
+ /**
1016
+ * @returns {TableColumnCtx}
1017
+ */
1018
+ default: () => {
1019
+ 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"];
1020
+ let c = null;
1021
+ if (s.length)
1022
+ c = s.map((u) => u.getColumnTree);
1023
+ else {
1024
+ const u = Array.from(l.assignedElements() || []).map((a) => {
1025
+ var b;
1026
+ return (b = a.outerHTML) == null ? void 0 : b.trim();
1027
+ }).join("");
1028
+ if (u) {
1029
+ const a = document.createElement("template");
1030
+ a.innerHTML = this.html(u), c = a;
1031
+ } else
1032
+ c = null;
1033
+ }
1034
+ return {
1035
+ label: this.label,
1036
+ prop: this.prop,
1037
+ type: this.type,
1038
+ colspan: this.colspan,
1039
+ rowspan: c ? 1 : e(this, st).call(this, t) - e(this, N).call(this, this, t) + 1,
1040
+ align: this.align,
1041
+ width: this.width,
1042
+ sortable: this.sortable,
1043
+ fixed: this.fixed,
1044
+ depth: e(this, N).call(this, this, t),
1045
+ props: [...this.attributes].filter(
1046
+ (u) => !i.includes(u.name)
1047
+ ),
1048
+ header: n.assignedElements().map((u) => {
1049
+ var a;
1050
+ return (a = u.outerHTML) == null ? void 0 : a.trim();
1051
+ }).join("") || null,
1052
+ template: c
1053
+ };
1054
+ }
1055
+ }
1056
+ }));
1057
+ /**
1058
+ * 获取当前组件的深度
1059
+ * @param {EaTableColumn} el
1060
+ * @param {import("../ea-table/index.js").EaTable} root
1061
+ * @returns {number}
1062
+ */
1063
+ p(this, N, (t, s) => {
1064
+ let n = 0;
1065
+ for (; t !== s; )
1066
+ t = t.parentElement, n++;
1067
+ return n;
1068
+ });
1069
+ /**
1070
+ * 获取最大深度
1071
+ * @param {import("../ea-table/index.js").EaTable} root
1072
+ * @returns {number}
1073
+ */
1074
+ p(this, st, (t) => {
1075
+ let s = 0;
1076
+ return t.querySelectorAll("ea-table-column").forEach((n) => {
1077
+ s = Math.max(s, e(this, N).call(this, n, t));
1078
+ }), s;
1079
+ });
1080
+ this.stylesheet = dt, this.$render();
1081
+ }
1082
+ static get observedAttributes() {
1083
+ return [
1084
+ ...super.observedAttributes,
1085
+ "type",
1086
+ "align",
1087
+ "label",
1088
+ "prop",
1089
+ "colspan",
1090
+ "width",
1091
+ "sortable",
1092
+ "fixed"
1093
+ ];
1094
+ }
1095
+ $render() {
1096
+ this.shadowRoot.innerHTML = `
1097
+ <div class='ea-table-column' part='container'>
1098
+ <header class='ea-table-column__label' part='label'>${this.label}[$${this.prop}]</header>
1099
+ <span class='ea-table-column__content' part='content'>
1100
+ <slot name="header"></slot>
1101
+ <slot id="defaultSlot" part="default-slot"></slot>
1102
+ </span>
1103
+ </div>
1104
+ `, C(this, R, this.shadowRoot.querySelector(".ea-table-column__label"));
1105
+ }
1106
+ connectedCallback() {
1107
+ super.connectedCallback(), S(this, y, lt).call(this);
1108
+ }
1109
+ $beforeUnmounted() {
1110
+ e(this, q) && (e(this, q).disconnect(), C(this, q, null));
1111
+ }
1112
+ }
1113
+ R = new WeakMap(), q = new WeakMap(), N = new WeakMap(), st = new WeakMap(), y = new WeakSet(), /**
1114
+ * 通知父组件更新
1115
+ */
1116
+ _ = function() {
1117
+ this.emit("ea-table-column-change", {
1118
+ bubbles: !0,
1119
+ composed: !0
1120
+ });
1121
+ }, /**
1122
+ * 监听默认插槽变化
1123
+ */
1124
+ lt = function() {
1125
+ C(this, q, new MutationObserver(() => {
1126
+ S(this, y, _).call(this);
1127
+ })), e(this, q).observe(this, {
1128
+ childList: !0,
1129
+ subtree: !0,
1130
+ characterData: !0
1131
+ });
1132
+ };
1133
+ window.customElements.get("ea-table-column") || window.customElements.define("ea-table-column", It);
1134
+ export {
1135
+ Ht as EaTable,
1136
+ It as EaTableColumn
1137
+ };