easy-component-ui 3.0.12 → 3.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +308 -304
- package/dist/assets/icon.css +0 -1
- package/dist/components/Base.js +0 -873
- package/dist/components/ea-alert.js +0 -196
- package/dist/components/ea-avatar.js +0 -159
- package/dist/components/ea-backtop.js +0 -136
- package/dist/components/ea-badge.js +0 -144
- package/dist/components/ea-breadcrumb.js +0 -148
- package/dist/components/ea-button.js +0 -265
- package/dist/components/ea-calendar.js +0 -10
- package/dist/components/ea-calendar2.js +0 -671
- package/dist/components/ea-card.js +0 -85
- package/dist/components/ea-carousel.js +0 -415
- package/dist/components/ea-checkbox.js +0 -446
- package/dist/components/ea-collapse.js +0 -313
- package/dist/components/ea-color-picker.js +0 -891
- package/dist/components/ea-container.js +0 -177
- package/dist/components/ea-countdown.js +0 -142
- package/dist/components/ea-date-picker.js +0 -649
- package/dist/components/ea-descriptions.js +0 -474
- package/dist/components/ea-dialog.js +0 -249
- package/dist/components/ea-drawer.js +0 -211
- package/dist/components/ea-dropdown.js +0 -228
- package/dist/components/ea-empty.js +0 -93
- package/dist/components/ea-icon.js +0 -68
- package/dist/components/ea-image-preview.js +0 -488
- package/dist/components/ea-image.js +0 -302
- package/dist/components/ea-infinite-scroll.js +0 -109
- package/dist/components/ea-input-number.js +0 -367
- package/dist/components/ea-input.js +0 -588
- package/dist/components/ea-layout.js +0 -125
- package/dist/components/ea-link.js +0 -101
- package/dist/components/ea-loading.js +0 -151
- package/dist/components/ea-menu.js +0 -433
- package/dist/components/ea-message-box.js +0 -624
- package/dist/components/ea-message.js +0 -251
- package/dist/components/ea-notification.js +0 -331
- package/dist/components/ea-overlay.js +0 -167
- package/dist/components/ea-page-header.js +0 -108
- package/dist/components/ea-pagination.js +0 -481
- package/dist/components/ea-popconfirm.js +0 -275
- package/dist/components/ea-popover.js +0 -123
- package/dist/components/ea-popper.js +0 -203
- package/dist/components/ea-progress.js +0 -286
- package/dist/components/ea-radio.js +0 -364
- package/dist/components/ea-rate.js +0 -241
- package/dist/components/ea-result.js +0 -100
- package/dist/components/ea-scrollbar.js +0 -235
- package/dist/components/ea-segmented.js +0 -215
- package/dist/components/ea-select.js +0 -609
- package/dist/components/ea-skeleton.js +0 -263
- package/dist/components/ea-slider.js +0 -421
- package/dist/components/ea-space.js +0 -123
- package/dist/components/ea-splitter.js +0 -217
- package/dist/components/ea-statistic.js +0 -74
- package/dist/components/ea-steps.js +0 -346
- package/dist/components/ea-switch.js +0 -271
- package/dist/components/ea-table.js +0 -1124
- package/dist/components/ea-tabs.js +0 -501
- package/dist/components/ea-tag.js +0 -228
- package/dist/components/ea-text.js +0 -113
- package/dist/components/ea-time-picker.js +0 -514
- package/dist/components/ea-timeline.js +0 -185
- package/dist/components/ea-tooltip.js +0 -121
- package/dist/components/ea-tour.js +0 -544
- package/dist/components/ea-transfer.js +0 -949
- package/dist/components/ea-tree.js +0 -1125
- package/dist/components/index.js +0 -61
- package/dist/core/FormBase.js +0 -238
- package/dist/css/ea-alert.style.js +0 -4
- package/dist/css/ea-aside.style.js +0 -4
- package/dist/css/ea-avatar.style.js +0 -4
- package/dist/css/ea-backtop.style.js +0 -4
- package/dist/css/ea-badge.style.js +0 -4
- package/dist/css/ea-breadcrumb-item.style.js +0 -4
- package/dist/css/ea-breadcrumb.style.js +0 -4
- package/dist/css/ea-button-group.style.js +0 -4
- package/dist/css/ea-button.style.js +0 -4
- package/dist/css/ea-calendar.style.js +0 -4
- package/dist/css/ea-card.style.js +0 -4
- package/dist/css/ea-carousel-item.style.js +0 -4
- package/dist/css/ea-carousel.style.js +0 -4
- package/dist/css/ea-check-tag.style.js +0 -4
- package/dist/css/ea-checkbox-group.style.js +0 -4
- package/dist/css/ea-checkbox.style.js +0 -4
- package/dist/css/ea-col.style.js +0 -4
- package/dist/css/ea-collapse-item.style.js +0 -4
- package/dist/css/ea-collapse.style.js +0 -4
- package/dist/css/ea-color-picker-panel.style.js +0 -4
- package/dist/css/ea-color-picker.style.js +0 -4
- package/dist/css/ea-container.style.js +0 -4
- package/dist/css/ea-date-picker.style.js +0 -4
- package/dist/css/ea-descriptions-item.style.js +0 -4
- package/dist/css/ea-descriptions.style.js +0 -4
- package/dist/css/ea-dialog.style.js +0 -4
- package/dist/css/ea-drawer.style.js +0 -4
- package/dist/css/ea-dropdown-item.style.js +0 -4
- package/dist/css/ea-dropdown-menu.style.js +0 -4
- package/dist/css/ea-dropdown.style.js +0 -4
- package/dist/css/ea-empty.style.js +0 -4
- package/dist/css/ea-footer.style.js +0 -4
- package/dist/css/ea-header.style.js +0 -4
- package/dist/css/ea-icon.style.js +0 -4
- package/dist/css/ea-image-preview.style.js +0 -4
- package/dist/css/ea-image.style.js +0 -4
- package/dist/css/ea-infinite-scroll.style.js +0 -4
- package/dist/css/ea-input-number.style.js +0 -4
- package/dist/css/ea-input.style.js +0 -4
- package/dist/css/ea-link.style.js +0 -4
- package/dist/css/ea-main.style.js +0 -4
- package/dist/css/ea-menu-item-group.style.js +0 -4
- package/dist/css/ea-menu-item.style.js +0 -4
- package/dist/css/ea-menu.style.js +0 -4
- package/dist/css/ea-message-box.style.js +0 -4
- package/dist/css/ea-message.style.js +0 -4
- package/dist/css/ea-notification.style.js +0 -4
- package/dist/css/ea-option-gropu.style.js +0 -4
- package/dist/css/ea-option.style.js +0 -4
- package/dist/css/ea-overlay.style.js +0 -4
- package/dist/css/ea-page-header.style.js +0 -4
- package/dist/css/ea-pagination.style.js +0 -4
- package/dist/css/ea-popconfirm.style.js +0 -4
- package/dist/css/ea-popover.style.js +0 -4
- package/dist/css/ea-popper.style.js +0 -4
- package/dist/css/ea-progress.style.js +0 -4
- package/dist/css/ea-radio-group.style.js +0 -4
- package/dist/css/ea-radio.style.js +0 -4
- package/dist/css/ea-rate.style.js +0 -4
- package/dist/css/ea-result.style.js +0 -4
- package/dist/css/ea-row.style.js +0 -4
- package/dist/css/ea-scrollbar.style.js +0 -4
- package/dist/css/ea-segmented.style.js +0 -4
- package/dist/css/ea-select.style.js +0 -4
- package/dist/css/ea-skeleton-item.style.js +0 -4
- package/dist/css/ea-skeleton.style.js +0 -4
- package/dist/css/ea-slider.style.js +0 -4
- package/dist/css/ea-space.style.js +0 -4
- package/dist/css/ea-splitter-bar.style.js +0 -4
- package/dist/css/ea-splitter-panel.style.js +0 -4
- package/dist/css/ea-splitter.style.js +0 -4
- package/dist/css/ea-statistic.style.js +0 -4
- package/dist/css/ea-step.style.js +0 -4
- package/dist/css/ea-steps.style.js +0 -4
- package/dist/css/ea-sub-menu.style.js +0 -4
- package/dist/css/ea-switch.style.js +0 -4
- package/dist/css/ea-tab-panel.style.js +0 -4
- package/dist/css/ea-tab.style.js +0 -4
- package/dist/css/ea-table-column.style.js +0 -4
- package/dist/css/ea-table.style.js +0 -4
- package/dist/css/ea-tabs.style.js +0 -4
- package/dist/css/ea-tag.style.js +0 -4
- package/dist/css/ea-text.style.js +0 -4
- package/dist/css/ea-time-picker.style.js +0 -4
- package/dist/css/ea-timeline-item.style.js +0 -4
- package/dist/css/ea-timeline.style.js +0 -4
- package/dist/css/ea-tooltip.style.js +0 -4
- package/dist/css/ea-tour-step.style.js +0 -4
- package/dist/css/ea-tour.style.js +0 -4
- package/dist/css/ea-transfer.style.js +0 -5
- package/dist/css/ea-tree.style.js +0 -6
- package/dist/css/ea-ui-component.style.js +0 -4
- package/dist/favicon.ico +0 -0
- package/dist/utils/Color.js +0 -439
- package/dist/utils/I18nManager.js +0 -218
- package/dist/utils/Utils.js +0 -65
- package/dist/utils/Variables.js +0 -12
- package/dist/utils/parseTime.js +0 -73
- package/dist/utils/timeout.js +0 -9
|
@@ -1,949 +0,0 @@
|
|
|
1
|
-
var wt = Object.defineProperty;
|
|
2
|
-
var bt = (u) => {
|
|
3
|
-
throw TypeError(u);
|
|
4
|
-
};
|
|
5
|
-
var At = (u, c, t) => c in u ? wt(u, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[c] = t;
|
|
6
|
-
var F = (u, c, t) => At(u, typeof c != "symbol" ? c + "" : c, t), pt = (u, c, t) => c.has(u) || bt("Cannot " + t);
|
|
7
|
-
var e = (u, c, t) => (pt(u, c, "read from private field"), t ? t.call(u) : c.get(u)), r = (u, c, t) => c.has(u) ? bt("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(u) : c.set(u, t), g = (u, c, t, s) => (pt(u, c, "write to private field"), s ? s.call(u, t) : c.set(u, t), t), b = (u, c, t) => (pt(u, c, "access private method"), t);
|
|
8
|
-
import { F as xt } from "../core/FormBase.js";
|
|
9
|
-
import { n as ut } from "./ea-calendar2.js";
|
|
10
|
-
import { i as D } from "../utils/I18nManager.js";
|
|
11
|
-
import { s as Pt, a as Mt } from "../css/ea-transfer.style.js";
|
|
12
|
-
import { B as Dt } from "./Base.js";
|
|
13
|
-
import "./ea-checkbox.js";
|
|
14
|
-
import "./ea-button.js";
|
|
15
|
-
import "./ea-icon.js";
|
|
16
|
-
import "./ea-input.js";
|
|
17
|
-
class mt extends Event {
|
|
18
|
-
constructor(c) {
|
|
19
|
-
super("ea-left-check-change", { bubbles: !0, composed: !0 }), this.detail = c;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
class yt extends Event {
|
|
23
|
-
constructor(c) {
|
|
24
|
-
super("ea-right-check-change", { bubbles: !0, composed: !0 }), this.detail = c;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
var U, k, Y, v, R, B, O, $, N, A, m, x, Z, tt, w, gt, vt, K, et, st, L, at, j, H, X;
|
|
28
|
-
class Kt extends Dt {
|
|
29
|
-
constructor() {
|
|
30
|
-
super();
|
|
31
|
-
r(this, w);
|
|
32
|
-
/** @type {HTMLElement} */
|
|
33
|
-
r(this, U);
|
|
34
|
-
/** @type {HTMLElement} */
|
|
35
|
-
r(this, k);
|
|
36
|
-
/** @type {HTMLElement} */
|
|
37
|
-
r(this, Y);
|
|
38
|
-
/** @type {HTMLElement} */
|
|
39
|
-
r(this, v);
|
|
40
|
-
/** @type {HTMLElement} */
|
|
41
|
-
r(this, R);
|
|
42
|
-
/** @type {HTMLElement} */
|
|
43
|
-
r(this, B);
|
|
44
|
-
/** @type {HTMLElement} */
|
|
45
|
-
r(this, O);
|
|
46
|
-
/** @type {HTMLElement} */
|
|
47
|
-
r(this, $);
|
|
48
|
-
/** @type {HTMLSlotElement} */
|
|
49
|
-
r(this, N);
|
|
50
|
-
/** @type {AbortController} */
|
|
51
|
-
r(this, A, new AbortController());
|
|
52
|
-
r(this, m, {
|
|
53
|
-
isEaInputDefined: !1,
|
|
54
|
-
selectedKeys: /* @__PURE__ */ new Set(),
|
|
55
|
-
filterText: "",
|
|
56
|
-
filteredData: []
|
|
57
|
-
});
|
|
58
|
-
r(this, x, {
|
|
59
|
-
/** @type {AbortController} */
|
|
60
|
-
filter: new AbortController()
|
|
61
|
-
});
|
|
62
|
-
F(this, "state", this.properties({
|
|
63
|
-
"data-title": {
|
|
64
|
-
type: String,
|
|
65
|
-
default: "",
|
|
66
|
-
observer: (t) => {
|
|
67
|
-
e(this, R) && (e(this, R).textContent = t || "");
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
filterable: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
default: !1,
|
|
73
|
-
observer: async (t) => {
|
|
74
|
-
var s;
|
|
75
|
-
e(this, m).isEaInputDefined || (await customElements.whenDefined("ea-input"), e(this, m).isEaInputDefined = !0), e(this, st).call(this, t), (s = e(this, x).filter) == null || s.abort(), t && (e(this, x).filter = new AbortController(), e(this, $).addEventListener(
|
|
76
|
-
"input",
|
|
77
|
-
(a) => {
|
|
78
|
-
a.stopImmediatePropagation();
|
|
79
|
-
const i = a.target.value.trim();
|
|
80
|
-
e(this, L).call(this, i);
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
signal: e(this, x).filter.signal
|
|
84
|
-
}
|
|
85
|
-
), e(this, $).addEventListener(
|
|
86
|
-
"ea-clear",
|
|
87
|
-
(a) => {
|
|
88
|
-
a.stopImmediatePropagation(), e(this, L).call(this, "");
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
signal: e(this, x).filter.signal
|
|
92
|
-
}
|
|
93
|
-
));
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"filter-placeholder": {
|
|
97
|
-
type: String,
|
|
98
|
-
default: "",
|
|
99
|
-
observer: (t) => {
|
|
100
|
-
this.filterable && b(this, w, X).call(this, t);
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
type: {
|
|
104
|
-
type: ["source", "target"],
|
|
105
|
-
default: "source",
|
|
106
|
-
observer: (t) => {
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}));
|
|
110
|
-
F(this, "propStates", this.properties({
|
|
111
|
-
data: {
|
|
112
|
-
props: !0,
|
|
113
|
-
type: Array,
|
|
114
|
-
default: [],
|
|
115
|
-
observer: (t) => {
|
|
116
|
-
e(this, et).call(this, t);
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
filterMethod: {
|
|
120
|
-
props: !0,
|
|
121
|
-
type: Function,
|
|
122
|
-
rawFunction: !0,
|
|
123
|
-
default: null
|
|
124
|
-
},
|
|
125
|
-
dataProps: {
|
|
126
|
-
props: !0,
|
|
127
|
-
type: Object,
|
|
128
|
-
default: () => ({
|
|
129
|
-
key: "key",
|
|
130
|
-
label: "label",
|
|
131
|
-
disabled: "disabled"
|
|
132
|
-
})
|
|
133
|
-
},
|
|
134
|
-
dataMap: {
|
|
135
|
-
props: !0,
|
|
136
|
-
type: Object,
|
|
137
|
-
default: () => /* @__PURE__ */ new Map()
|
|
138
|
-
}
|
|
139
|
-
}));
|
|
140
|
-
/**
|
|
141
|
-
* 处理单个项目选中变化
|
|
142
|
-
*/
|
|
143
|
-
r(this, Z, (t) => {
|
|
144
|
-
t.stopImmediatePropagation();
|
|
145
|
-
const s = t.target.closest(".ea-transfer-panel__item"), a = !!t.target.checked;
|
|
146
|
-
a ? e(this, m).selectedKeys.add(s) : e(this, m).selectedKeys.delete(s), e(this, j).call(this), this.emit("ea-transfer-panel-select-change", {
|
|
147
|
-
detail: {
|
|
148
|
-
type: this.type,
|
|
149
|
-
selectedKey: s,
|
|
150
|
-
isChecked: a
|
|
151
|
-
},
|
|
152
|
-
bubbles: !0,
|
|
153
|
-
composed: !0
|
|
154
|
-
}), e(this, K).call(this);
|
|
155
|
-
});
|
|
156
|
-
/**
|
|
157
|
-
* 处理全选变化
|
|
158
|
-
*/
|
|
159
|
-
r(this, tt, (t) => {
|
|
160
|
-
t.stopImmediatePropagation();
|
|
161
|
-
const s = !!t.target.checked, a = e(this, m).filterText && e(this, m).filterText.trim() !== "", i = b(this, w, gt).call(this, a);
|
|
162
|
-
t.target.indeterminate = !1, i.forEach((n) => {
|
|
163
|
-
const d = n.querySelector(
|
|
164
|
-
".ea-transfer-panel__item-checkbox:not([disabled])"
|
|
165
|
-
);
|
|
166
|
-
d && (d.checked = s, s ? e(this, m).selectedKeys.add(n) : e(this, m).selectedKeys.delete(n));
|
|
167
|
-
}), this.emit("ea-transfer-panel-select-all", {
|
|
168
|
-
detail: {
|
|
169
|
-
type: this.type,
|
|
170
|
-
selectedKeys: i,
|
|
171
|
-
isChecked: s,
|
|
172
|
-
isFiltering: a
|
|
173
|
-
},
|
|
174
|
-
bubbles: !0,
|
|
175
|
-
composed: !0
|
|
176
|
-
}), e(this, K).call(this);
|
|
177
|
-
});
|
|
178
|
-
/**
|
|
179
|
-
* 更新计数显示
|
|
180
|
-
*/
|
|
181
|
-
r(this, K, () => {
|
|
182
|
-
if (!e(this, B)) return;
|
|
183
|
-
const t = e(this, k).querySelectorAll(
|
|
184
|
-
".ea-transfer-panel__item"
|
|
185
|
-
).length, s = e(this, m).selectedKeys.size;
|
|
186
|
-
e(this, B).textContent = `${s}/${t}`;
|
|
187
|
-
});
|
|
188
|
-
/**
|
|
189
|
-
* 处理数据更新
|
|
190
|
-
* @param {Array} newData
|
|
191
|
-
*/
|
|
192
|
-
r(this, et, (t) => {
|
|
193
|
-
this.clearList(), t.forEach((s) => {
|
|
194
|
-
e(this, k).appendChild(s);
|
|
195
|
-
}), e(this, H).call(this), t.length === 0 ? (e(this, v).disabled = !0, e(this, v).checked = !1, e(this, v).indeterminate = !1) : e(this, v).disabled = !1;
|
|
196
|
-
});
|
|
197
|
-
/**
|
|
198
|
-
* 处理可筛选状态更新
|
|
199
|
-
* @param {boolean} filterable
|
|
200
|
-
*/
|
|
201
|
-
r(this, st, (t) => {
|
|
202
|
-
e(this, O) && (t ? b(this, w, X).call(this, this["filter-placeholder"]) : e(this, L).call(this, ""), this.updateContainerClasslist());
|
|
203
|
-
});
|
|
204
|
-
/**
|
|
205
|
-
* 处理筛选条件变化
|
|
206
|
-
* @param {string} filterText
|
|
207
|
-
*/
|
|
208
|
-
r(this, L, (t) => {
|
|
209
|
-
e(this, m).filterText = t, e(this, H).call(this), e(this, j).call(this);
|
|
210
|
-
});
|
|
211
|
-
/**
|
|
212
|
-
* 计算全选状态
|
|
213
|
-
* @returns {{isAllChecked: boolean, isSomeChecked: boolean}}
|
|
214
|
-
*/
|
|
215
|
-
r(this, at, () => {
|
|
216
|
-
const t = e(this, m).filterText && e(this, m).filterText.trim() !== "";
|
|
217
|
-
let s, a;
|
|
218
|
-
if (t) {
|
|
219
|
-
const i = e(this, k).querySelectorAll(
|
|
220
|
-
".ea-transfer-panel__item:not(.is-disabled):not(.is-filtered-out)"
|
|
221
|
-
).length, n = [...e(this, m).selectedKeys].filter(
|
|
222
|
-
(d) => !d.classList.contains("is-filtered-out")
|
|
223
|
-
).length;
|
|
224
|
-
s = n >= i, a = n > 0;
|
|
225
|
-
} else {
|
|
226
|
-
const i = e(this, k).querySelectorAll(
|
|
227
|
-
".ea-transfer-panel__item:not(.is-disabled)"
|
|
228
|
-
).length;
|
|
229
|
-
s = e(this, m).selectedKeys.size >= i, a = e(this, m).selectedKeys.size > 0;
|
|
230
|
-
}
|
|
231
|
-
return { isAllChecked: s, isSomeChecked: a };
|
|
232
|
-
});
|
|
233
|
-
/**
|
|
234
|
-
* 更新全选状态
|
|
235
|
-
*/
|
|
236
|
-
r(this, j, () => {
|
|
237
|
-
if (!e(this, v)) return;
|
|
238
|
-
const { isAllChecked: t, isSomeChecked: s } = e(this, at).call(this);
|
|
239
|
-
t ? (e(this, v).checked = !0, e(this, v).indeterminate = !1) : s ? (e(this, v).checked = !1, e(this, v).indeterminate = !0) : (e(this, v).checked = !1, e(this, v).indeterminate = !1);
|
|
240
|
-
});
|
|
241
|
-
/**
|
|
242
|
-
* 执行数据筛选
|
|
243
|
-
*/
|
|
244
|
-
r(this, H, () => {
|
|
245
|
-
const { key: t, label: s, disabled: a } = this.dataProps, i = e(this, m).filterText || "", n = i.toLowerCase(), d = [
|
|
246
|
-
...e(this, k).querySelectorAll(".ea-transfer-panel__item")
|
|
247
|
-
];
|
|
248
|
-
if (!i) {
|
|
249
|
-
d.forEach((p) => {
|
|
250
|
-
p.classList.remove("is-filtered-out");
|
|
251
|
-
}), e(this, K).call(this);
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
this.filterMethod && typeof this.filterMethod == "function" ? d.forEach((p) => {
|
|
255
|
-
var S;
|
|
256
|
-
const y = ((S = this.dataMap) == null ? void 0 : S.get(p)) || {}, C = this.filterMethod(i, y);
|
|
257
|
-
p.classList.toggle("is-filtered-out", !C);
|
|
258
|
-
}) : d.forEach((p) => {
|
|
259
|
-
var _;
|
|
260
|
-
const S = ((((_ = this.dataMap) == null ? void 0 : _.get(p)) || {})[s] || "").toLowerCase().includes(n);
|
|
261
|
-
p.classList.toggle("is-filtered-out", !S);
|
|
262
|
-
}), e(this, K).call(this);
|
|
263
|
-
});
|
|
264
|
-
this.stylesheet = Pt, this.$render();
|
|
265
|
-
}
|
|
266
|
-
static get observedAttributes() {
|
|
267
|
-
return [
|
|
268
|
-
...super.observedAttributes,
|
|
269
|
-
"data-title",
|
|
270
|
-
"type",
|
|
271
|
-
"filterable",
|
|
272
|
-
"filter-placeholder"
|
|
273
|
-
];
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* 获取 classlist 列表
|
|
277
|
-
* @return {string} 属性值
|
|
278
|
-
*/
|
|
279
|
-
updateContainerClasslist() {
|
|
280
|
-
var a, i;
|
|
281
|
-
const t = e(this, N).assignedElements()[0], s = this.computedClasslist(
|
|
282
|
-
"ea-transfer-panel",
|
|
283
|
-
{},
|
|
284
|
-
{
|
|
285
|
-
filterable: this.filterable,
|
|
286
|
-
"has-footer": ((i = (a = t == null ? void 0 : t.assignedElements) == null ? void 0 : a.call(t)) == null ? void 0 : i.length) > 0
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
return e(this, U).className = s, s;
|
|
290
|
-
}
|
|
291
|
-
$render() {
|
|
292
|
-
const t = ut("transfer-panel");
|
|
293
|
-
this.ns = t, D.locale = this.locale, this.shadowRoot.innerHTML = this.html(`
|
|
294
|
-
<div class='${t.b()}' part='container'>
|
|
295
|
-
<div class='${t.e("header")}' part='header'>
|
|
296
|
-
<ea-checkbox class='${t.e("checkbox")}' part='checkbox'>
|
|
297
|
-
<span class='${t.e("title")}' part='title'></span>
|
|
298
|
-
</ea-checkbox>
|
|
299
|
-
<span class='${t.e("count")}' part='count'></span>
|
|
300
|
-
</div>
|
|
301
|
-
<div class='${t.e("body")}' part='body'>
|
|
302
|
-
<div class='${t.e("filter-wrapper")}' part='filter-wrapper'>
|
|
303
|
-
<ea-input
|
|
304
|
-
class='${t.e("filter")}'
|
|
305
|
-
placeholder="${D.t("transfer.filterPlaceholder")}"
|
|
306
|
-
part='filter'
|
|
307
|
-
prefix-icon="icon-search"
|
|
308
|
-
clearable
|
|
309
|
-
></ea-input>
|
|
310
|
-
</div>
|
|
311
|
-
<div class='${t.e("empty")}' part='empty'>
|
|
312
|
-
<slot name="empty"></slot>
|
|
313
|
-
</div>
|
|
314
|
-
<ul class='${t.e("list")}' part='list'></ul>
|
|
315
|
-
<div class='${t.e("footer")}' part='footer'>
|
|
316
|
-
<slot name="footer"></slot>
|
|
317
|
-
</div>
|
|
318
|
-
</div>
|
|
319
|
-
</div>
|
|
320
|
-
`), g(this, U, this.shadowRoot.querySelector(t.cb())), g(this, Y, this.shadowRoot.querySelector(t.ce("header"))), g(this, v, this.shadowRoot.querySelector(t.ce("checkbox"))), g(this, R, this.shadowRoot.querySelector(t.ce("title"))), g(this, B, this.shadowRoot.querySelector(t.ce("count"))), g(this, k, this.shadowRoot.querySelector(t.ce("list"))), g(this, O, this.shadowRoot.querySelector(
|
|
321
|
-
t.ce("filter-wrapper")
|
|
322
|
-
)), g(this, $, this.shadowRoot.querySelector(t.ce("filter"))), g(this, N, this.shadowRoot.querySelector("slot[name='footer']")), this.updateContainerClasslist();
|
|
323
|
-
}
|
|
324
|
-
connectedCallback() {
|
|
325
|
-
super.connectedCallback(), b(this, w, vt).call(this), this.updateContainerClasslist();
|
|
326
|
-
}
|
|
327
|
-
$beforeUnmounted() {
|
|
328
|
-
var t;
|
|
329
|
-
(t = e(this, A)) == null || t.abort();
|
|
330
|
-
for (const s of Object.values(e(this, x)))
|
|
331
|
-
s == null || s.abort();
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* 清空列表项
|
|
335
|
-
*/
|
|
336
|
-
clearList() {
|
|
337
|
-
e(this, k).innerHTML = "";
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* 清空搜索关键词
|
|
341
|
-
*/
|
|
342
|
-
clearQuery() {
|
|
343
|
-
e(this, $) && (e(this, $).value = "", e(this, L).call(this, ""));
|
|
344
|
-
}
|
|
345
|
-
$updateLocalization(t) {
|
|
346
|
-
D.locale = t, b(this, w, X).call(this);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
U = new WeakMap(), k = new WeakMap(), Y = new WeakMap(), v = new WeakMap(), R = new WeakMap(), B = new WeakMap(), O = new WeakMap(), $ = new WeakMap(), N = new WeakMap(), A = new WeakMap(), m = new WeakMap(), x = new WeakMap(), Z = new WeakMap(), tt = new WeakMap(), w = new WeakSet(), /**
|
|
350
|
-
* 获取可选择的项目列表
|
|
351
|
-
*/
|
|
352
|
-
gt = function(t) {
|
|
353
|
-
return t ? [
|
|
354
|
-
...e(this, k).querySelectorAll(
|
|
355
|
-
".ea-transfer-panel__item:not(.is-disabled):not(.is-filtered-out)"
|
|
356
|
-
)
|
|
357
|
-
] : [
|
|
358
|
-
...e(this, k).querySelectorAll(
|
|
359
|
-
".ea-transfer-panel__item:not(.is-disabled)"
|
|
360
|
-
)
|
|
361
|
-
];
|
|
362
|
-
}, /**
|
|
363
|
-
* 绑定事件
|
|
364
|
-
*/
|
|
365
|
-
vt = function() {
|
|
366
|
-
var t;
|
|
367
|
-
(t = e(this, A)) == null || t.abort(), g(this, A, new AbortController()), e(this, k).addEventListener("change", e(this, Z), {
|
|
368
|
-
signal: e(this, A).signal
|
|
369
|
-
}), e(this, v).addEventListener("change", e(this, tt), {
|
|
370
|
-
signal: e(this, A).signal
|
|
371
|
-
});
|
|
372
|
-
}, K = new WeakMap(), et = new WeakMap(), st = new WeakMap(), L = new WeakMap(), at = new WeakMap(), j = new WeakMap(), H = new WeakMap(), /**
|
|
373
|
-
* 更新搜索框占位符
|
|
374
|
-
* @param {string} newPlaceholder
|
|
375
|
-
*/
|
|
376
|
-
X = function(t) {
|
|
377
|
-
e(this, $) && (this.hasAttribute("filter-placeholder") || (e(this, $).placeholder = t || D.t("transfer.filterPlaceholder")));
|
|
378
|
-
};
|
|
379
|
-
window.customElements.get("ea-transfer-panel") || window.customElements.define("ea-transfer-panel", Kt);
|
|
380
|
-
var T, h, o, P, M, E, Q, l, it, rt, lt, q, nt, ot, ht, f, V, W, z, kt, Ct, St, $t, G, J, I, dt, ct, Et;
|
|
381
|
-
class Lt extends xt {
|
|
382
|
-
constructor() {
|
|
383
|
-
super();
|
|
384
|
-
r(this, f);
|
|
385
|
-
/** @type {HTMLElement} */
|
|
386
|
-
r(this, T);
|
|
387
|
-
/** @type {HTMLElement} */
|
|
388
|
-
r(this, h);
|
|
389
|
-
/** @type {HTMLElement} */
|
|
390
|
-
r(this, o);
|
|
391
|
-
/** @type {HTMLElement} */
|
|
392
|
-
r(this, P);
|
|
393
|
-
/** @type {HTMLElement} */
|
|
394
|
-
r(this, M);
|
|
395
|
-
/** @type {AbortController} */
|
|
396
|
-
r(this, E, new AbortController());
|
|
397
|
-
r(this, Q, {});
|
|
398
|
-
r(this, l, {
|
|
399
|
-
isPanelDefined: !1,
|
|
400
|
-
sourceSelectedKeys: /* @__PURE__ */ new Set(),
|
|
401
|
-
targetSelectedKeys: /* @__PURE__ */ new Set(),
|
|
402
|
-
dataMap: /* @__PURE__ */ new Map()
|
|
403
|
-
});
|
|
404
|
-
F(this, "state", this.properties({
|
|
405
|
-
disabled: {
|
|
406
|
-
type: Boolean,
|
|
407
|
-
default: !1,
|
|
408
|
-
observer: (t) => {
|
|
409
|
-
this.updateContainerClasslist();
|
|
410
|
-
}
|
|
411
|
-
},
|
|
412
|
-
filterable: {
|
|
413
|
-
type: Boolean,
|
|
414
|
-
default: !1,
|
|
415
|
-
observer: async (t) => {
|
|
416
|
-
e(this, ot).call(this, t);
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
"filter-placeholder": {
|
|
420
|
-
type: String,
|
|
421
|
-
default: "请输入搜索内容",
|
|
422
|
-
observer: async (t) => {
|
|
423
|
-
e(this, ht).call(this, t);
|
|
424
|
-
}
|
|
425
|
-
},
|
|
426
|
-
required: {
|
|
427
|
-
type: Boolean,
|
|
428
|
-
default: !1
|
|
429
|
-
}
|
|
430
|
-
}));
|
|
431
|
-
F(this, "propStates", this.properties({
|
|
432
|
-
data: {
|
|
433
|
-
props: !0,
|
|
434
|
-
type: Array,
|
|
435
|
-
default: [],
|
|
436
|
-
observer: async (t) => {
|
|
437
|
-
e(this, l).isPanelDefined || (await customElements.whenDefined("ea-transfer-panel"), e(this, l).isPanelDefined = !0), e(this, rt).call(this, t);
|
|
438
|
-
}
|
|
439
|
-
},
|
|
440
|
-
value: {
|
|
441
|
-
props: !0,
|
|
442
|
-
type: Array,
|
|
443
|
-
default: [],
|
|
444
|
-
observer: async (t) => {
|
|
445
|
-
e(this, l).isPanelDefined || (await customElements.whenDefined("ea-transfer-panel"), e(this, l).isPanelDefined = !0), e(this, lt).call(this, t), this.setValue(t), this.emit("change", { detail: { value: t } });
|
|
446
|
-
}
|
|
447
|
-
},
|
|
448
|
-
dataProps: {
|
|
449
|
-
props: !0,
|
|
450
|
-
type: Object,
|
|
451
|
-
default: () => ({
|
|
452
|
-
key: "key",
|
|
453
|
-
label: "label",
|
|
454
|
-
disabled: "disabled"
|
|
455
|
-
}),
|
|
456
|
-
observer: (t) => {
|
|
457
|
-
e(this, it).call(this, t);
|
|
458
|
-
}
|
|
459
|
-
},
|
|
460
|
-
titles: {
|
|
461
|
-
props: !0,
|
|
462
|
-
type: Array,
|
|
463
|
-
default: [],
|
|
464
|
-
observer: (t) => {
|
|
465
|
-
e(this, W).call(this, t);
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
buttonTexts: {
|
|
469
|
-
props: !0,
|
|
470
|
-
type: Array,
|
|
471
|
-
default: () => [],
|
|
472
|
-
observer: (t) => {
|
|
473
|
-
e(this, nt).call(this, t);
|
|
474
|
-
}
|
|
475
|
-
},
|
|
476
|
-
filterMethod: {
|
|
477
|
-
props: !0,
|
|
478
|
-
type: Function,
|
|
479
|
-
rawFunction: !0,
|
|
480
|
-
default: null,
|
|
481
|
-
observer: async (t) => {
|
|
482
|
-
e(this, l).isPanelDefined || (await customElements.whenDefined("ea-transfer-panel"), e(this, l).isPanelDefined = !0);
|
|
483
|
-
}
|
|
484
|
-
},
|
|
485
|
-
leftDefaultChecked: {
|
|
486
|
-
props: !0,
|
|
487
|
-
type: Array,
|
|
488
|
-
default: [],
|
|
489
|
-
observer: (t) => {
|
|
490
|
-
}
|
|
491
|
-
},
|
|
492
|
-
rightDefaultChecked: {
|
|
493
|
-
props: !0,
|
|
494
|
-
type: Array,
|
|
495
|
-
default: [],
|
|
496
|
-
observer: (t) => {
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}));
|
|
500
|
-
/**
|
|
501
|
-
* 更新字段映射
|
|
502
|
-
* @param {Object} newProps
|
|
503
|
-
*/
|
|
504
|
-
r(this, it, (t) => {
|
|
505
|
-
e(this, h) && (e(this, h).dataProps = t), e(this, o) && (e(this, o).dataProps = t);
|
|
506
|
-
});
|
|
507
|
-
/**
|
|
508
|
-
* 处理数据更新
|
|
509
|
-
* @param {Array} newData
|
|
510
|
-
*/
|
|
511
|
-
r(this, rt, (t) => {
|
|
512
|
-
const { key: s } = this.dataProps;
|
|
513
|
-
if (e(this, h)) {
|
|
514
|
-
const a = t.filter((i) => {
|
|
515
|
-
const n = i[s];
|
|
516
|
-
return !this.value.includes(n);
|
|
517
|
-
});
|
|
518
|
-
e(this, h).clearList(), e(this, h).data = e(this, q).call(this, a, this.leftDefaultChecked), e(this, h).selected = this.leftDefaultChecked, e(this, h).originalData = t, e(this, h).dataMap = e(this, l).dataMap, e(this, h).dataProps = this.dataProps;
|
|
519
|
-
}
|
|
520
|
-
if (e(this, o)) {
|
|
521
|
-
const a = t.filter((i) => {
|
|
522
|
-
const n = i[s];
|
|
523
|
-
return this.value.includes(n);
|
|
524
|
-
});
|
|
525
|
-
e(this, o).clearList(), e(this, o).data = e(this, q).call(this, a, this.rightDefaultChecked), e(this, o).selected = this.rightDefaultChecked, e(this, o).originalData = t, e(this, o).dataMap = e(this, l).dataMap, e(this, o).dataProps = this.dataProps;
|
|
526
|
-
}
|
|
527
|
-
});
|
|
528
|
-
/**
|
|
529
|
-
* 处理 value 值更新,确保数据一致性
|
|
530
|
-
* @param {Array} newValue - 新的 value 值
|
|
531
|
-
*/
|
|
532
|
-
r(this, lt, (t) => {
|
|
533
|
-
const { key: s } = this.dataProps;
|
|
534
|
-
if (!(!this.data || this.data.length === 0)) {
|
|
535
|
-
if (e(this, h)) {
|
|
536
|
-
const a = this.data.filter((i) => {
|
|
537
|
-
const n = i[s];
|
|
538
|
-
return !t.includes(n);
|
|
539
|
-
});
|
|
540
|
-
e(this, h).clearList(), e(this, h).data = e(this, q).call(this, a, this.leftDefaultChecked), e(this, h).selected = this.leftDefaultChecked, e(this, h).originalData = this.data, e(this, h).dataMap = e(this, l).dataMap, e(this, h).dataProps = this.dataProps;
|
|
541
|
-
}
|
|
542
|
-
if (e(this, o)) {
|
|
543
|
-
const a = this.data.filter((i) => {
|
|
544
|
-
const n = i[s];
|
|
545
|
-
return t.includes(n);
|
|
546
|
-
}).sort((i, n) => {
|
|
547
|
-
const d = t.indexOf(i[s]), p = t.indexOf(n[s]);
|
|
548
|
-
return d - p;
|
|
549
|
-
});
|
|
550
|
-
e(this, o).clearList(), e(this, o).data = e(this, q).call(this, a, this.rightDefaultChecked), e(this, o).selected = this.rightDefaultChecked, e(this, o).originalData = this.data, e(this, o).dataMap = e(this, l).dataMap, e(this, o).dataProps = this.dataProps;
|
|
551
|
-
}
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
/**
|
|
555
|
-
* 创建面板数据
|
|
556
|
-
* @param {Array} data - 数据数组
|
|
557
|
-
* @param {Array} defaultChecked - 默认选中项数组
|
|
558
|
-
* @returns {Array} 列表项数组
|
|
559
|
-
*/
|
|
560
|
-
r(this, q, (t, s) => {
|
|
561
|
-
const { key: a, label: i, disabled: n } = this.dataProps, d = ut("transfer-panel");
|
|
562
|
-
return Array.from({ length: t.length }, (p, y) => {
|
|
563
|
-
const C = document.createElement("li"), S = t[y], _ = S[n], ft = s.includes(S[a]);
|
|
564
|
-
return C.className = this.computedClasslist(
|
|
565
|
-
d.e("item"),
|
|
566
|
-
{},
|
|
567
|
-
{
|
|
568
|
-
disabled: _,
|
|
569
|
-
checked: ft
|
|
570
|
-
}
|
|
571
|
-
), C.innerHTML = this.html(`
|
|
572
|
-
<ea-checkbox
|
|
573
|
-
class="${d.e("item-checkbox")}"
|
|
574
|
-
${_ ? "disabled" : ""}
|
|
575
|
-
${ft && !_ ? "checked" : ""}
|
|
576
|
-
part="item-checkbox"
|
|
577
|
-
>
|
|
578
|
-
<span class="${d.e("item-label")}" part="item-label">${S[i]}</span>
|
|
579
|
-
</ea-checkbox>
|
|
580
|
-
`), e(this, l).dataMap.set(C, S), C;
|
|
581
|
-
}).sort((p, y) => {
|
|
582
|
-
const C = e(this, l).dataMap.get(p)[a], S = e(this, l).dataMap.get(y)[a];
|
|
583
|
-
return C - S;
|
|
584
|
-
});
|
|
585
|
-
});
|
|
586
|
-
/**
|
|
587
|
-
* 更新按钮文本
|
|
588
|
-
* @param {Array} buttonTexts
|
|
589
|
-
*/
|
|
590
|
-
r(this, nt, (t) => {
|
|
591
|
-
if (Array.isArray(t) && t.length >= 2) {
|
|
592
|
-
const [s, a] = t;
|
|
593
|
-
if (e(this, P)) {
|
|
594
|
-
const i = e(this, P).querySelector(
|
|
595
|
-
".ea-transfer__button-text"
|
|
596
|
-
);
|
|
597
|
-
i && (i.textContent = s, i.style.display = "inline");
|
|
598
|
-
}
|
|
599
|
-
if (e(this, M)) {
|
|
600
|
-
const i = e(this, M).querySelector(
|
|
601
|
-
".ea-transfer__button-text"
|
|
602
|
-
);
|
|
603
|
-
i && (i.textContent = a, i.style.display = "inline");
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
/**
|
|
608
|
-
* 处理可过滤更新
|
|
609
|
-
* @param {boolean} filterable
|
|
610
|
-
*/
|
|
611
|
-
r(this, ot, (t) => {
|
|
612
|
-
this.filterable && (e(this, h) && e(this, h).toggleAttribute("filterable", t), e(this, o) && e(this, o).toggleAttribute("filterable", t));
|
|
613
|
-
});
|
|
614
|
-
/**
|
|
615
|
-
* 更新过滤占位符
|
|
616
|
-
* @param {string} placeholder
|
|
617
|
-
*/
|
|
618
|
-
r(this, ht, (t) => {
|
|
619
|
-
this.filterable && (e(this, h) && e(this, h).setAttribute("filter-placeholder", t), e(this, o) && e(this, o).setAttribute("filter-placeholder", t));
|
|
620
|
-
});
|
|
621
|
-
/**
|
|
622
|
-
* 更新标题
|
|
623
|
-
* @param {Array} titles
|
|
624
|
-
*/
|
|
625
|
-
r(this, W, (t) => {
|
|
626
|
-
if (Array.isArray(t) && t.length >= 2) {
|
|
627
|
-
const [s, a] = t;
|
|
628
|
-
e(this, h) && e(this, h).setAttribute("data-title", s), e(this, o) && e(this, o).setAttribute("data-title", a);
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
|
-
/**
|
|
632
|
-
* 获取可移动的选中项
|
|
633
|
-
* @param {NodeList} selectedKeys 选中项
|
|
634
|
-
* @param {string} disabledField 禁用字段
|
|
635
|
-
* @returns {NodeList} 可移动的选中项
|
|
636
|
-
*/
|
|
637
|
-
r(this, G, (t, s) => t.filter((a) => {
|
|
638
|
-
const i = e(this, l).dataMap.get(a);
|
|
639
|
-
return !i || !i[s];
|
|
640
|
-
}));
|
|
641
|
-
/**
|
|
642
|
-
* 处理可移动的选中项
|
|
643
|
-
* @param {NodeList} movableKeys 可移动的选中项
|
|
644
|
-
*/
|
|
645
|
-
r(this, J, (t) => {
|
|
646
|
-
t.forEach((s) => {
|
|
647
|
-
const a = s.querySelector(".ea-transfer-panel__item-checkbox");
|
|
648
|
-
a.checked = !1, a.dispatchEvent(
|
|
649
|
-
new CustomEvent("change", {
|
|
650
|
-
bubbles: !0,
|
|
651
|
-
composed: !0,
|
|
652
|
-
detail: {
|
|
653
|
-
checkbox: !1
|
|
654
|
-
}
|
|
655
|
-
})
|
|
656
|
-
), e(this, l).sourceSelectedKeys.delete(s);
|
|
657
|
-
});
|
|
658
|
-
});
|
|
659
|
-
/**
|
|
660
|
-
* 处理面板数据排序
|
|
661
|
-
* @param {string} keyField 排序字段
|
|
662
|
-
* @returns {function} 排序函数
|
|
663
|
-
*/
|
|
664
|
-
r(this, I, (t) => (s, a) => {
|
|
665
|
-
const i = e(this, l).dataMap.get(s), n = e(this, l).dataMap.get(a);
|
|
666
|
-
return i[t] - n[t] || 0;
|
|
667
|
-
});
|
|
668
|
-
/**
|
|
669
|
-
* 处理向右移动
|
|
670
|
-
* @param {Event} e 事件对象
|
|
671
|
-
*/
|
|
672
|
-
r(this, dt, (t) => {
|
|
673
|
-
t.stopImmediatePropagation();
|
|
674
|
-
const { key: s, label: a, disabled: i } = this.dataProps, n = [...e(this, l).sourceSelectedKeys], d = e(this, G).call(this, n, i);
|
|
675
|
-
e(this, J).call(this, d), e(this, o).data = [
|
|
676
|
-
...new Set(
|
|
677
|
-
[...e(this, o).data, ...d].sort(
|
|
678
|
-
e(this, I).call(this, s)
|
|
679
|
-
)
|
|
680
|
-
)
|
|
681
|
-
], e(this, h).data = e(this, h).data.filter((y) => !d.includes(y)).sort(e(this, I).call(this, s));
|
|
682
|
-
const p = e(this, o).data.map((y) => e(this, l).dataMap.get(y)[s]);
|
|
683
|
-
this.value = p, b(this, f, z).call(this);
|
|
684
|
-
});
|
|
685
|
-
/**
|
|
686
|
-
* 处理向左移动
|
|
687
|
-
* @param {Event} e 事件对象
|
|
688
|
-
*/
|
|
689
|
-
r(this, ct, (t) => {
|
|
690
|
-
t.stopImmediatePropagation();
|
|
691
|
-
const { key: s, label: a, disabled: i } = this.dataProps, n = [...e(this, l).targetSelectedKeys], d = e(this, G).call(this, n, i);
|
|
692
|
-
e(this, J).call(this, d), e(this, h).data = [
|
|
693
|
-
...new Set(
|
|
694
|
-
[...e(this, h).data, ...d].sort(
|
|
695
|
-
e(this, I).call(this, s)
|
|
696
|
-
)
|
|
697
|
-
)
|
|
698
|
-
], e(this, o).data = e(this, o).data.filter((y) => !d.includes(y)).sort(e(this, I).call(this, s));
|
|
699
|
-
const p = e(this, o).data.map((y) => e(this, l).dataMap.get(y)[s]);
|
|
700
|
-
this.value = p, b(this, f, z).call(this);
|
|
701
|
-
});
|
|
702
|
-
this.stylesheet = Mt, this.$render();
|
|
703
|
-
}
|
|
704
|
-
static get observedAttributes() {
|
|
705
|
-
return [
|
|
706
|
-
...super.observedAttributes,
|
|
707
|
-
"disabled",
|
|
708
|
-
"filterable",
|
|
709
|
-
"filter-placeholder",
|
|
710
|
-
"required"
|
|
711
|
-
];
|
|
712
|
-
}
|
|
713
|
-
/**
|
|
714
|
-
* 获取 classlist 列表
|
|
715
|
-
* @return {string} 属性值
|
|
716
|
-
*/
|
|
717
|
-
updateContainerClasslist() {
|
|
718
|
-
const t = this.computedClasslist(
|
|
719
|
-
"ea-transfer",
|
|
720
|
-
{},
|
|
721
|
-
{
|
|
722
|
-
disabled: this.disabled
|
|
723
|
-
}
|
|
724
|
-
);
|
|
725
|
-
return e(this, T).className = t, t;
|
|
726
|
-
}
|
|
727
|
-
$render() {
|
|
728
|
-
const t = ut("transfer");
|
|
729
|
-
this.ns = t, D.locale = this.locale, this.shadowRoot.innerHTML = this.html(`
|
|
730
|
-
<div class='${t.b()}' part='container'>
|
|
731
|
-
<ea-transfer-panel
|
|
732
|
-
class='${t.e("panel")} ${t.m("panel", "source")}'
|
|
733
|
-
part='panel source-panel'
|
|
734
|
-
type="source"
|
|
735
|
-
data-title="${b(this, f, V).call(this, "source")}"
|
|
736
|
-
filter-placeholder="${this["filter-placeholder"]}"
|
|
737
|
-
>
|
|
738
|
-
<slot name="left-empty" slot="empty"></slot>
|
|
739
|
-
<slot name="left-footer" slot="footer"></slot>
|
|
740
|
-
</ea-transfer-panel>
|
|
741
|
-
|
|
742
|
-
<div class='${t.e("buttons")}' part='buttons'>
|
|
743
|
-
<ea-button
|
|
744
|
-
class='${t.e("button")} ${t.e("move-to-right-btn")}'
|
|
745
|
-
part='button move-to-right-btn'
|
|
746
|
-
type="primary"
|
|
747
|
-
size="small"
|
|
748
|
-
disabled
|
|
749
|
-
>
|
|
750
|
-
<ea-icon icon="icon-angle-right"></ea-icon>
|
|
751
|
-
<span class="${t.e("button-text")}"></span>
|
|
752
|
-
</ea-button>
|
|
753
|
-
<ea-button
|
|
754
|
-
class='${t.e("button")} ${t.e("move-to-left-btn")}'
|
|
755
|
-
part='button move-to-left-btn'
|
|
756
|
-
type="primary"
|
|
757
|
-
size="small"
|
|
758
|
-
disabled
|
|
759
|
-
>
|
|
760
|
-
<ea-icon icon="icon-angle-left"></ea-icon>
|
|
761
|
-
<span class="${t.e("button-text")}"></span>
|
|
762
|
-
</ea-button>
|
|
763
|
-
</div>
|
|
764
|
-
|
|
765
|
-
<ea-transfer-panel
|
|
766
|
-
class='${t.e("panel")} ${t.m("panel", "target")}'
|
|
767
|
-
part='panel target-panel'
|
|
768
|
-
type="target"
|
|
769
|
-
data-title="${b(this, f, V).call(this, "target")}"
|
|
770
|
-
filter-placeholder="${this["filter-placeholder"]}"
|
|
771
|
-
>
|
|
772
|
-
<slot name="right-empty" slot="empty"></slot>
|
|
773
|
-
<slot name="right-footer" slot="footer"></slot>
|
|
774
|
-
</ea-transfer-panel>
|
|
775
|
-
</div>
|
|
776
|
-
`), g(this, T, this.shadowRoot.querySelector(t.cb())), g(this, h, this.shadowRoot.querySelector(
|
|
777
|
-
`${t.ce("panel")}${t.cm("source")}`
|
|
778
|
-
)), g(this, o, this.shadowRoot.querySelector(
|
|
779
|
-
`${t.ce("panel")}${t.cm("target")}`
|
|
780
|
-
)), g(this, P, this.shadowRoot.querySelector(
|
|
781
|
-
`${t.ce("button")}${t.ce("move-to-right-btn")}`
|
|
782
|
-
)), g(this, M, this.shadowRoot.querySelector(
|
|
783
|
-
`${t.ce("button")}${t.ce("move-to-left-btn")}`
|
|
784
|
-
));
|
|
785
|
-
}
|
|
786
|
-
$updateLocalization(t) {
|
|
787
|
-
this.locale = t, D.locale = t, (!this.titles || this.titles.length === 0) && e(this, W).call(this, [
|
|
788
|
-
b(this, f, V).call(this, "source"),
|
|
789
|
-
b(this, f, V).call(this, "target")
|
|
790
|
-
]);
|
|
791
|
-
}
|
|
792
|
-
connectedCallback() {
|
|
793
|
-
super.connectedCallback(), b(this, f, Et).call(this);
|
|
794
|
-
}
|
|
795
|
-
$beforeUnmounted() {
|
|
796
|
-
var t, s;
|
|
797
|
-
(t = e(this, E)) == null || t.abort();
|
|
798
|
-
for (const a in e(this, Q))
|
|
799
|
-
(s = e(this, Q)[a]) == null || s.abort();
|
|
800
|
-
}
|
|
801
|
-
/**
|
|
802
|
-
* 清空指定面板的搜索关键词
|
|
803
|
-
* @param {'left' | 'right'} which - 面板类型
|
|
804
|
-
*/
|
|
805
|
-
clearQuery(t) {
|
|
806
|
-
t === "left" && e(this, h) ? e(this, h).clearQuery() : t === "right" && e(this, o) && e(this, o).clearQuery();
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* 获取验证目标元素
|
|
810
|
-
* @returns {HTMLElement}
|
|
811
|
-
*/
|
|
812
|
-
get validationTarget() {
|
|
813
|
-
return this;
|
|
814
|
-
}
|
|
815
|
-
/**
|
|
816
|
-
* 更新表单验证状态
|
|
817
|
-
*/
|
|
818
|
-
updateValidity() {
|
|
819
|
-
const t = this.value, s = !t || Array.isArray(t) && t.length === 0;
|
|
820
|
-
this.required && s ? this.internals.setValidity(
|
|
821
|
-
{ valueMissing: !0 },
|
|
822
|
-
"请至少选择一项",
|
|
823
|
-
this
|
|
824
|
-
) : this.internals.setValidity({}, "", this);
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* 检查表单字段的有效性
|
|
828
|
-
* @returns {boolean} 如果字段有效返回 true,否则返回 false
|
|
829
|
-
*/
|
|
830
|
-
checkValidity() {
|
|
831
|
-
return this.updateValidity(), this.internals.checkValidity();
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* 报告表单字段的有效性(显示验证提示)
|
|
835
|
-
* @returns {boolean} 如果字段有效返回 true,否则返回 false
|
|
836
|
-
*/
|
|
837
|
-
reportValidity() {
|
|
838
|
-
return this.updateValidity(), this.internals.reportValidity();
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
T = new WeakMap(), h = new WeakMap(), o = new WeakMap(), P = new WeakMap(), M = new WeakMap(), E = new WeakMap(), Q = new WeakMap(), l = new WeakMap(), it = new WeakMap(), rt = new WeakMap(), lt = new WeakMap(), q = new WeakMap(), nt = new WeakMap(), ot = new WeakMap(), ht = new WeakMap(), f = new WeakSet(), /**
|
|
842
|
-
* 获取默认标题
|
|
843
|
-
* @param {"source" | "target"} type - 面板类型
|
|
844
|
-
* @returns {string} 默认标题
|
|
845
|
-
*/
|
|
846
|
-
V = function(t) {
|
|
847
|
-
return t === "source" ? D.t("transfer.list1") : D.t("transfer.list2");
|
|
848
|
-
}, W = new WeakMap(), /**
|
|
849
|
-
* 更新按钮状态
|
|
850
|
-
*/
|
|
851
|
-
z = function() {
|
|
852
|
-
e(this, P).disabled = e(this, l).sourceSelectedKeys.size === 0, e(this, M).disabled = e(this, l).targetSelectedKeys.size === 0;
|
|
853
|
-
}, /**
|
|
854
|
-
* 触发check-change事件
|
|
855
|
-
* @param {string} type 面板类型
|
|
856
|
-
* @param {Node} selectedKey 选中项
|
|
857
|
-
*/
|
|
858
|
-
kt = function(t, s) {
|
|
859
|
-
const a = [...e(this, l)[`${t}SelectedKeys`]], { key: i } = this.dataProps, d = {
|
|
860
|
-
value: a.map((p) => {
|
|
861
|
-
const y = e(this, l).dataMap.get(p);
|
|
862
|
-
return y ? y[i] : null;
|
|
863
|
-
}).filter(Boolean),
|
|
864
|
-
movedKeys: [e(this, l).dataMap.get(s)[i]]
|
|
865
|
-
};
|
|
866
|
-
if (t === "source") {
|
|
867
|
-
const p = new mt(d);
|
|
868
|
-
this.dispatchEvent(p);
|
|
869
|
-
} else if (t === "target") {
|
|
870
|
-
const p = new yt(d);
|
|
871
|
-
this.dispatchEvent(p);
|
|
872
|
-
}
|
|
873
|
-
}, /**
|
|
874
|
-
* 触发check-all-change事件
|
|
875
|
-
* @param {string} type 面板类型
|
|
876
|
-
* @param {NodeList} selectedKeys 选中项
|
|
877
|
-
*/
|
|
878
|
-
Ct = function(t, s) {
|
|
879
|
-
const { key: a } = this.dataProps, i = s.map((d) => {
|
|
880
|
-
const p = e(this, l).dataMap.get(d);
|
|
881
|
-
return p ? p[a] : null;
|
|
882
|
-
}).filter(Boolean), n = [...e(this, l)[`${t}SelectedKeys`]].map((d) => {
|
|
883
|
-
const p = e(this, l).dataMap.get(d);
|
|
884
|
-
return p ? p[a] : null;
|
|
885
|
-
}).filter(Boolean);
|
|
886
|
-
t === "source" ? this.dispatchEvent(
|
|
887
|
-
new mt({
|
|
888
|
-
value: n,
|
|
889
|
-
movedKeys: i
|
|
890
|
-
})
|
|
891
|
-
) : t === "target" && this.dispatchEvent(
|
|
892
|
-
new yt({
|
|
893
|
-
value: n,
|
|
894
|
-
movedKeys: i
|
|
895
|
-
})
|
|
896
|
-
);
|
|
897
|
-
}, /**
|
|
898
|
-
* 处理选中项变化
|
|
899
|
-
* @param {string} type 面板类型
|
|
900
|
-
* @param {NodeList} selectedKey 选中项
|
|
901
|
-
* @param {boolean} isChecked 是否选中
|
|
902
|
-
*/
|
|
903
|
-
St = function(t, s, a) {
|
|
904
|
-
a ? e(this, l)[`${t}SelectedKeys`].add(s) : e(this, l)[`${t}SelectedKeys`].delete(s), b(this, f, z).call(this), b(this, f, kt).call(this, t, s);
|
|
905
|
-
}, /**
|
|
906
|
-
* 处理全选变化
|
|
907
|
-
* @param {string} type 面板类型
|
|
908
|
-
* @param {NodeList} selectedKeys 选中项
|
|
909
|
-
* @param {boolean} isChecked 是否选中
|
|
910
|
-
*/
|
|
911
|
-
$t = function(t, s, a) {
|
|
912
|
-
a ? s.forEach((i) => e(this, l)[`${t}SelectedKeys`].add(i)) : s.forEach(
|
|
913
|
-
(i) => e(this, l)[`${t}SelectedKeys`].delete(i)
|
|
914
|
-
), b(this, f, z).call(this), b(this, f, Ct).call(this, t, s);
|
|
915
|
-
}, G = new WeakMap(), J = new WeakMap(), I = new WeakMap(), dt = new WeakMap(), ct = new WeakMap(), /**
|
|
916
|
-
* 绑定事件
|
|
917
|
-
*/
|
|
918
|
-
Et = function() {
|
|
919
|
-
var t;
|
|
920
|
-
(t = e(this, E)) == null || t.abort(), g(this, E, new AbortController()), e(this, T).addEventListener(
|
|
921
|
-
"ea-transfer-panel-select-change",
|
|
922
|
-
(s) => {
|
|
923
|
-
s.stopImmediatePropagation();
|
|
924
|
-
const { type: a, selectedKey: i, isChecked: n } = s.detail;
|
|
925
|
-
b(this, f, St).call(this, a, i, n);
|
|
926
|
-
},
|
|
927
|
-
{
|
|
928
|
-
signal: e(this, E).signal
|
|
929
|
-
}
|
|
930
|
-
), e(this, T).addEventListener(
|
|
931
|
-
"ea-transfer-panel-select-all",
|
|
932
|
-
(s) => {
|
|
933
|
-
s.stopImmediatePropagation();
|
|
934
|
-
const { type: a, selectedKeys: i, isChecked: n } = s.detail;
|
|
935
|
-
b(this, f, $t).call(this, a, i, n);
|
|
936
|
-
},
|
|
937
|
-
{
|
|
938
|
-
signal: e(this, E).signal
|
|
939
|
-
}
|
|
940
|
-
), e(this, P).addEventListener("click", e(this, dt), {
|
|
941
|
-
signal: e(this, E).signal
|
|
942
|
-
}), e(this, M).addEventListener("click", e(this, ct), {
|
|
943
|
-
signal: e(this, E).signal
|
|
944
|
-
});
|
|
945
|
-
};
|
|
946
|
-
customElements.get("ea-transfer") || customElements.define("ea-transfer", Lt);
|
|
947
|
-
export {
|
|
948
|
-
Lt as EaTransfer
|
|
949
|
-
};
|