huiyi-select-table 0.1.18 → 0.1.19
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/huiyi-select-table.mjs +256 -137
- package/huiyi-select-table.umd.js +1 -1
- package/package.json +1 -1
- package/style.css +1 -1
- package/huiyi-select-table-0.1.1.tgz +0 -0
package/huiyi-select-table.mjs
CHANGED
|
@@ -1,160 +1,279 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
|
|
1
|
+
import { defineComponent as F, openBlock as g, createElementBlock as L, createElementVNode as E, resolveComponent as C, createVNode as S, unref as m, isRef as Q, withCtx as D, normalizeClass as W, createBlock as I, Teleport as P, normalizeStyle as Z, Fragment as ee, renderList as ne, createCommentVNode as O } from "vue";
|
|
2
|
+
/*! Element Plus Icons Vue v2.3.2 */
|
|
3
|
+
var te = /* @__PURE__ */ F({
|
|
4
|
+
name: "ArrowDown",
|
|
5
|
+
__name: "arrow-down",
|
|
6
|
+
setup(u) {
|
|
7
|
+
return (d, _) => (g(), L("svg", {
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
viewBox: "0 0 1024 1024"
|
|
10
|
+
}, [
|
|
11
|
+
E("path", {
|
|
12
|
+
fill: "currentColor",
|
|
13
|
+
d: "M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"
|
|
14
|
+
})
|
|
15
|
+
]));
|
|
16
|
+
}
|
|
17
|
+
}), le = te;
|
|
18
|
+
const oe = /* @__PURE__ */ F({
|
|
3
19
|
name: "InputSelectCompont",
|
|
4
20
|
__name: "SelectTable",
|
|
5
21
|
props: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
options: Array,
|
|
23
|
+
readonly: Boolean,
|
|
24
|
+
required: Boolean,
|
|
25
|
+
value: String,
|
|
26
|
+
itemIndex: {
|
|
27
|
+
type: [String, Number, null],
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
column: Array
|
|
14
31
|
},
|
|
15
|
-
emits: ["
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
emits: ["getInputRef", "handleChangeSelectValue"],
|
|
33
|
+
setup(u, { emit: d }) {
|
|
34
|
+
const _ = d, t = u;
|
|
35
|
+
let i = ref(), f = ref(""), k = ref(), T = ref(), r = ref(!1), B = ref({
|
|
36
|
+
top: "0px",
|
|
37
|
+
left: "0px"
|
|
38
|
+
// width: "0px",
|
|
39
|
+
}), l = ref(-1), y = ref(!1), R = ref(!1);
|
|
40
|
+
watch(
|
|
41
|
+
() => t.value,
|
|
42
|
+
(e) => {
|
|
43
|
+
f.value = e || "";
|
|
44
|
+
},
|
|
45
|
+
{ immediate: !0 }
|
|
46
|
+
), onMounted(() => {
|
|
47
|
+
nextTick(() => {
|
|
48
|
+
_("getInputRef", k.value);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
const h = () => {
|
|
52
|
+
if (!T.value)
|
|
53
|
+
return;
|
|
54
|
+
const e = T.value.getBoundingClientRect(), n = window.pageYOffset || document.documentElement.scrollTop, a = window.pageXOffset || document.documentElement.scrollLeft;
|
|
55
|
+
B.value = {
|
|
56
|
+
top: `${e.bottom + n}px`,
|
|
57
|
+
left: `${e.left + a}px`
|
|
58
|
+
// width: `${rect.width}px`,
|
|
41
59
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
60
|
+
}, x = computed(() => {
|
|
61
|
+
const e = t.column?.map((c) => c.prop) || [
|
|
62
|
+
"name",
|
|
63
|
+
"engname",
|
|
64
|
+
"spell",
|
|
65
|
+
"zjm",
|
|
66
|
+
"infoOrder"
|
|
67
|
+
], n = t.options || [], a = f.value || "";
|
|
68
|
+
return l.value = -1, nextTick(() => {
|
|
69
|
+
const c = t.options || [], v = c.find((w) => w.name === t.value);
|
|
70
|
+
if (i.value && i.value.setCurrentRow(v), v) {
|
|
71
|
+
const w = z(
|
|
72
|
+
e,
|
|
73
|
+
a,
|
|
74
|
+
c
|
|
75
|
+
);
|
|
76
|
+
l.value = w.findIndex(
|
|
77
|
+
(o) => o.name === v.name
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
}), z(e, a, n);
|
|
81
|
+
}), N = (e) => {
|
|
82
|
+
e?.stopPropagation(), !t.readonly && (r.value ? s() : p());
|
|
47
83
|
}, q = () => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, E = (e) => {
|
|
52
|
-
if (console.log(e.key, "event.key "), t.value.length !== 0)
|
|
53
|
-
if (e.key == "ArrowDown") {
|
|
54
|
-
e.preventDefault();
|
|
55
|
-
let l = n.value + 1;
|
|
56
|
-
l >= t.value.length && (l = 0), console.log(l, "newIndex"), I(l);
|
|
57
|
-
} else if (e.key == "ArrowUp") {
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
let l = n.value - 1;
|
|
60
|
-
l < 0 && (l = t.value.length - 1), I(l);
|
|
61
|
-
} else
|
|
62
|
-
e.key === "Enter" && (e.preventDefault(), r.value == !0 ? F() : _());
|
|
63
|
-
}, F = () => {
|
|
64
|
-
if (n.value >= 0) {
|
|
65
|
-
v.value === n.value ? v.value = -1 : v.value = n.value;
|
|
66
|
-
const e = t.value;
|
|
67
|
-
console.log(e[n.value], n.value, "hh[currentHighlightIndex]"), x(t.value[n.value]);
|
|
84
|
+
if (t.readonly) {
|
|
85
|
+
s();
|
|
86
|
+
return;
|
|
68
87
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
88
|
+
r.value || p(), l.value = -1;
|
|
89
|
+
}, p = () => {
|
|
90
|
+
t.readonly || R.value || (R.value = !0, r.value = !0, nextTick(() => {
|
|
91
|
+
h(), y.value = !1, setTimeout(() => {
|
|
92
|
+
R.value = !1;
|
|
93
|
+
}, 100);
|
|
94
|
+
}));
|
|
95
|
+
}, s = () => {
|
|
96
|
+
r.value = !1, y.value = !1;
|
|
97
|
+
}, M = (e) => {
|
|
98
|
+
f.value = e.name, s(), nextTick(() => {
|
|
99
|
+
k.value?.focus();
|
|
100
|
+
}), _("handleChangeSelectValue", {
|
|
101
|
+
valueCode: e.code,
|
|
102
|
+
value: e.name,
|
|
103
|
+
index: t.itemIndex ? t.itemIndex : ""
|
|
104
|
+
});
|
|
105
|
+
}, K = (e) => {
|
|
106
|
+
y.value = !0, e.preventDefault();
|
|
107
|
+
}, U = (e) => {
|
|
108
|
+
e.stopPropagation(), s();
|
|
109
|
+
}, Y = async () => {
|
|
110
|
+
if (console.log("handleInput"), t.readonly) {
|
|
111
|
+
s();
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
p(), l.value = -1;
|
|
115
|
+
}, $ = () => {
|
|
116
|
+
if (console.log("handleFocus"), t.readonly) {
|
|
117
|
+
s();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
r.value || p(), l.value = -1;
|
|
121
|
+
}, j = () => {
|
|
122
|
+
console.log("handleBlur", y.value), setTimeout(() => {
|
|
123
|
+
if (y.value) {
|
|
124
|
+
nextTick(() => {
|
|
125
|
+
k.value?.focus();
|
|
126
|
+
});
|
|
127
|
+
return;
|
|
74
128
|
}
|
|
129
|
+
s();
|
|
130
|
+
}, 150);
|
|
131
|
+
}, H = (e) => {
|
|
132
|
+
x.value.length !== 0 && (e.key === "ArrowDown" ? (e.preventDefault(), r.value || p(), A(1)) : e.key === "ArrowUp" ? (e.preventDefault(), r.value || p(), A(-1)) : e.key === "Enter" ? (e.preventDefault(), r.value ? X() : p()) : (e.key === "Escape" || e.key === "Tab") && s());
|
|
133
|
+
}, A = (e) => {
|
|
134
|
+
const n = x.value;
|
|
135
|
+
if (n.length === 0)
|
|
136
|
+
return;
|
|
137
|
+
l.value === -1 ? e === 1 ? l.value = 0 : l.value = n.length - 1 : (l.value += e, l.value < 0 ? l.value = n.length - 1 : l.value >= n.length && (l.value = 0));
|
|
138
|
+
const a = n[l.value];
|
|
139
|
+
i.value && i.value.setCurrentRow(a), G();
|
|
140
|
+
}, X = () => {
|
|
141
|
+
const e = x.value;
|
|
142
|
+
if (e.length === 0 || l.value === -1)
|
|
143
|
+
return;
|
|
144
|
+
const n = e[l.value];
|
|
145
|
+
M(n);
|
|
146
|
+
}, G = () => {
|
|
147
|
+
nextTick(() => {
|
|
148
|
+
const e = i.value;
|
|
149
|
+
if (!e)
|
|
150
|
+
return;
|
|
151
|
+
const n = e.$el.querySelector(".el-table__body-wrapper");
|
|
152
|
+
if (!n)
|
|
153
|
+
return;
|
|
154
|
+
const a = n.querySelector(".current-row");
|
|
155
|
+
a && a.scrollIntoView({
|
|
156
|
+
behavior: "smooth",
|
|
157
|
+
block: "nearest"
|
|
158
|
+
});
|
|
75
159
|
});
|
|
160
|
+
}, z = (e, n, a) => {
|
|
161
|
+
const c = n.trim().toLowerCase();
|
|
162
|
+
return c ? a.filter(
|
|
163
|
+
(v) => e.some((w) => {
|
|
164
|
+
const o = v[w];
|
|
165
|
+
return o == null && o !== 0 ? !1 : String(o).toLowerCase().includes(c);
|
|
166
|
+
})
|
|
167
|
+
) : a;
|
|
76
168
|
};
|
|
77
|
-
return (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
169
|
+
return onMounted(() => {
|
|
170
|
+
window.addEventListener("resize", h), window.addEventListener("scroll", h, !0);
|
|
171
|
+
}), onUnmounted(() => {
|
|
172
|
+
window.removeEventListener("resize", h), window.removeEventListener("scroll", h, !0);
|
|
173
|
+
}), (e, n) => {
|
|
174
|
+
const a = C("el-icon"), c = C("el-input"), v = C("el-table-column"), w = C("el-table");
|
|
175
|
+
return g(), L("div", {
|
|
176
|
+
class: "custom-dropdown",
|
|
177
|
+
ref_key: "dropdownRef",
|
|
178
|
+
ref: T
|
|
85
179
|
}, [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
modelValue:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
180
|
+
S(c, {
|
|
181
|
+
modelValue: m(f),
|
|
182
|
+
"onUpdate:modelValue": n[0] || (n[0] = (o) => Q(f) ? f.value = o : f = o),
|
|
183
|
+
ref_key: "inputValueRef",
|
|
184
|
+
ref: k,
|
|
185
|
+
readonly: t.readonly,
|
|
186
|
+
onInput: Y,
|
|
187
|
+
onKeydown: H,
|
|
188
|
+
onFocus: $,
|
|
189
|
+
onBlur: j,
|
|
190
|
+
onClick: q
|
|
191
|
+
}, {
|
|
192
|
+
suffix: D(() => [
|
|
193
|
+
S(a, {
|
|
194
|
+
class: W(["el-input__icon dropdown-arrow", { "dropdown-arrow--open": m(r) }]),
|
|
195
|
+
onClick: N
|
|
196
|
+
}, {
|
|
197
|
+
default: D(() => [
|
|
198
|
+
S(m(le))
|
|
199
|
+
]),
|
|
200
|
+
_: 1
|
|
201
|
+
}, 8, ["class"])
|
|
202
|
+
]),
|
|
203
|
+
_: 1
|
|
204
|
+
}, 8, ["modelValue", "readonly"]),
|
|
205
|
+
m(r) ? (g(), I(P, {
|
|
206
|
+
key: 0,
|
|
207
|
+
to: "body"
|
|
208
|
+
}, [
|
|
209
|
+
E("div", {
|
|
210
|
+
class: "dropdown-panel",
|
|
211
|
+
style: Z(m(B)),
|
|
212
|
+
onMousedown: K
|
|
213
|
+
}, [
|
|
214
|
+
S(w, {
|
|
215
|
+
border: "",
|
|
216
|
+
data: m(x),
|
|
217
|
+
"highlight-current-row": "",
|
|
218
|
+
ref_key: "tableRef",
|
|
219
|
+
ref: i,
|
|
220
|
+
"max-height": "200px",
|
|
221
|
+
onRowClick: M,
|
|
222
|
+
style: { width: "100%" }
|
|
223
|
+
}, {
|
|
224
|
+
default: D(() => [
|
|
225
|
+
(g(!0), L(ee, null, ne(t.column, (o, J) => (g(), I(v, {
|
|
226
|
+
key: J,
|
|
227
|
+
prop: o.prop,
|
|
228
|
+
label: o.label,
|
|
229
|
+
width: o.width,
|
|
230
|
+
align: o.align,
|
|
231
|
+
type: o.type,
|
|
232
|
+
"header-align": o.headerAlign
|
|
233
|
+
}, null, 8, ["prop", "label", "width", "align", "type", "header-align"]))), 128))
|
|
234
|
+
]),
|
|
235
|
+
_: 1
|
|
236
|
+
}, 8, ["data"])
|
|
237
|
+
], 36)
|
|
238
|
+
])) : O("", !0),
|
|
239
|
+
m(r) ? (g(), I(P, {
|
|
240
|
+
key: 1,
|
|
241
|
+
to: "body"
|
|
102
242
|
}, [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"highlight-current-row": "",
|
|
110
|
-
data: t.value,
|
|
111
|
-
onCurrentChange: T,
|
|
112
|
-
onRowClick: x,
|
|
113
|
-
style: z(V.value)
|
|
114
|
-
}, {
|
|
115
|
-
default: K(() => [
|
|
116
|
-
(p(!0), k(N, null, U(o.columnList, (i, M) => (p(), R(L, {
|
|
117
|
-
key: M,
|
|
118
|
-
prop: i.prop,
|
|
119
|
-
align: i.align,
|
|
120
|
-
label: i.label,
|
|
121
|
-
width: i.width,
|
|
122
|
-
"header-align": i.headerAlign,
|
|
123
|
-
"show-overflow-tooltip": ""
|
|
124
|
-
}, null, 8, ["prop", "align", "label", "width", "header-align"]))), 128))
|
|
125
|
-
]),
|
|
126
|
-
_: 1
|
|
127
|
-
}, 8, ["data", "style"])
|
|
128
|
-
]))
|
|
129
|
-
], 544);
|
|
243
|
+
E("div", {
|
|
244
|
+
class: "dropdown-mask",
|
|
245
|
+
onMousedown: U
|
|
246
|
+
}, null, 32)
|
|
247
|
+
])) : O("", !0)
|
|
248
|
+
], 512);
|
|
130
249
|
};
|
|
131
250
|
}
|
|
132
251
|
});
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
for (const [
|
|
136
|
-
|
|
137
|
-
return
|
|
138
|
-
},
|
|
139
|
-
|
|
140
|
-
|
|
252
|
+
const ae = (u, d) => {
|
|
253
|
+
const _ = u.__vccOpts || u;
|
|
254
|
+
for (const [t, i] of d)
|
|
255
|
+
_[t] = i;
|
|
256
|
+
return _;
|
|
257
|
+
}, b = /* @__PURE__ */ ae(oe, [["__scopeId", "data-v-fcb596cf"]]);
|
|
258
|
+
b.install = (u) => {
|
|
259
|
+
u.component(b.name, b);
|
|
141
260
|
};
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
],
|
|
145
|
-
|
|
146
|
-
|
|
261
|
+
const re = [
|
|
262
|
+
b
|
|
263
|
+
], V = function(u) {
|
|
264
|
+
V.installed || re.forEach((d) => {
|
|
265
|
+
u.component(d.name, d);
|
|
147
266
|
});
|
|
148
267
|
};
|
|
149
|
-
typeof window < "u" && window.Vue &&
|
|
150
|
-
const
|
|
268
|
+
typeof window < "u" && window.Vue && V(window.Vue);
|
|
269
|
+
const se = {
|
|
151
270
|
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装
|
|
152
|
-
install:
|
|
271
|
+
install: V,
|
|
153
272
|
// 以下是具体的组件列表
|
|
154
|
-
SelectTable:
|
|
273
|
+
SelectTable: b
|
|
155
274
|
};
|
|
156
275
|
export {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
276
|
+
b as SelectTable,
|
|
277
|
+
se as default,
|
|
278
|
+
V as install
|
|
160
279
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.HuiyiSelectTable={},s.Vue))})(this,function(s,e){"use strict";const
|
|
1
|
+
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.HuiyiSelectTable={},s.Vue))})(this,function(s,e){"use strict";const $="";/*! Element Plus Icons Vue v2.3.2 */var D=e.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(i){return(p,g)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}}),I=D;const L=e.defineComponent({name:"InputSelectCompont",__name:"SelectTable",props:{options:Array,readonly:Boolean,required:Boolean,value:String,itemIndex:{type:[String,Number,null],default:null},column:Array},emits:["getInputRef","handleChangeSelectValue"],setup(i,{emit:p}){const g=p,o=i;let f=ref(),m=ref(""),x=ref(),T=ref(),c=ref(!1),B=ref({top:"0px",left:"0px"}),l=ref(-1),v=ref(!1),S=ref(!1);watch(()=>o.value,n=>{m.value=n||""},{immediate:!0}),onMounted(()=>{nextTick(()=>{g("getInputRef",x.value)})});const k=()=>{if(!T.value)return;const n=T.value.getBoundingClientRect(),t=window.pageYOffset||document.documentElement.scrollTop,r=window.pageXOffset||document.documentElement.scrollLeft;B.value={top:`${n.bottom+t}px`,left:`${n.left+r}px`}},C=computed(()=>{const n=o.column?.map(d=>d.prop)||["name","engname","spell","zjm","infoOrder"],t=o.options||[],r=m.value||"";return l.value=-1,nextTick(()=>{const d=o.options||[],_=d.find(y=>y.name===o.value);if(f.value&&f.value.setCurrentRow(_),_){const y=E(n,r,d);l.value=y.findIndex(a=>a.name===_.name)}}),E(n,r,t)}),A=n=>{n?.stopPropagation(),!o.readonly&&(c.value?u():w())},P=()=>{if(o.readonly){u();return}c.value||w(),l.value=-1},w=()=>{o.readonly||S.value||(S.value=!0,c.value=!0,nextTick(()=>{k(),v.value=!1,setTimeout(()=>{S.value=!1},100)}))},u=()=>{c.value=!1,v.value=!1},R=n=>{m.value=n.name,u(),nextTick(()=>{x.value?.focus()}),g("handleChangeSelectValue",{valueCode:n.code,value:n.name,index:o.itemIndex?o.itemIndex:""})},z=n=>{v.value=!0,n.preventDefault()},O=n=>{n.stopPropagation(),u()},q=async()=>{if(console.log("handleInput"),o.readonly){u();return}w(),l.value=-1},F=()=>{if(console.log("handleFocus"),o.readonly){u();return}c.value||w(),l.value=-1},j=()=>{console.log("handleBlur",v.value),setTimeout(()=>{if(v.value){nextTick(()=>{x.value?.focus()});return}u()},150)},K=n=>{C.value.length!==0&&(n.key==="ArrowDown"?(n.preventDefault(),c.value||w(),V(1)):n.key==="ArrowUp"?(n.preventDefault(),c.value||w(),V(-1)):n.key==="Enter"?(n.preventDefault(),c.value?U():w()):(n.key==="Escape"||n.key==="Tab")&&u())},V=n=>{const t=C.value;if(t.length===0)return;l.value===-1?n===1?l.value=0:l.value=t.length-1:(l.value+=n,l.value<0?l.value=t.length-1:l.value>=t.length&&(l.value=0));const r=t[l.value];f.value&&f.value.setCurrentRow(r),H()},U=()=>{const n=C.value;if(n.length===0||l.value===-1)return;const t=n[l.value];R(t)},H=()=>{nextTick(()=>{const n=f.value;if(!n)return;const t=n.$el.querySelector(".el-table__body-wrapper");if(!t)return;const r=t.querySelector(".current-row");r&&r.scrollIntoView({behavior:"smooth",block:"nearest"})})},E=(n,t,r)=>{const d=t.trim().toLowerCase();return d?r.filter(_=>n.some(y=>{const a=_[y];return a==null&&a!==0?!1:String(a).toLowerCase().includes(d)})):r};return onMounted(()=>{window.addEventListener("resize",k),window.addEventListener("scroll",k,!0)}),onUnmounted(()=>{window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0)}),(n,t)=>{const r=e.resolveComponent("el-icon"),d=e.resolveComponent("el-input"),_=e.resolveComponent("el-table-column"),y=e.resolveComponent("el-table");return e.openBlock(),e.createElementBlock("div",{class:"custom-dropdown",ref_key:"dropdownRef",ref:T},[e.createVNode(d,{modelValue:e.unref(m),"onUpdate:modelValue":t[0]||(t[0]=a=>e.isRef(m)?m.value=a:m=a),ref_key:"inputValueRef",ref:x,readonly:o.readonly,onInput:q,onKeydown:K,onFocus:F,onBlur:j,onClick:P},{suffix:e.withCtx(()=>[e.createVNode(r,{class:e.normalizeClass(["el-input__icon dropdown-arrow",{"dropdown-arrow--open":e.unref(c)}]),onClick:A},{default:e.withCtx(()=>[e.createVNode(e.unref(I))]),_:1},8,["class"])]),_:1},8,["modelValue","readonly"]),e.unref(c)?(e.openBlock(),e.createBlock(e.Teleport,{key:0,to:"body"},[e.createElementVNode("div",{class:"dropdown-panel",style:e.normalizeStyle(e.unref(B)),onMousedown:z},[e.createVNode(y,{border:"",data:e.unref(C),"highlight-current-row":"",ref_key:"tableRef",ref:f,"max-height":"200px",onRowClick:R,style:{width:"100%"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.column,(a,Y)=>(e.openBlock(),e.createBlock(_,{key:Y,prop:a.prop,label:a.label,width:a.width,align:a.align,type:a.type,"header-align":a.headerAlign},null,8,["prop","label","width","align","type","header-align"]))),128))]),_:1},8,["data"])],36)])):e.createCommentVNode("",!0),e.unref(c)?(e.openBlock(),e.createBlock(e.Teleport,{key:1,to:"body"},[e.createElementVNode("div",{class:"dropdown-mask",onMousedown:O},null,32)])):e.createCommentVNode("",!0)],512)}}}),X="",h=((i,p)=>{const g=i.__vccOpts||i;for(const[o,f]of p)g[o]=f;return g})(L,[["__scopeId","data-v-fcb596cf"]]);h.install=i=>{i.component(h.name,h)};const M=[h],b=function(i){b.installed||M.forEach(p=>{i.component(p.name,p)})};typeof window<"u"&&window.Vue&&b(window.Vue);const N={install:b,SelectTable:h};s.SelectTable=h,s.default=N,s.install=b,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
.custom-dropdown[data-v-fcb596cf]{position:relative;width:100%}.dropdown-panel[data-v-fcb596cf]{position:fixed;z-index:9999;background:white;border:1px solid #e4e7ed;border-radius:4px;box-shadow:0 2px 12px #0000001a;margin-top:4px;box-sizing:border-box;max-height:200px;overflow:hidden}.dropdown-mask[data-v-fcb596cf]{position:fixed;inset:0;z-index:9998;background:transparent}.dropdown-arrow[data-v-fcb596cf]{cursor:pointer;transition:transform .3s}.dropdown-arrow--open[data-v-fcb596cf]{transform:rotate(180deg)}
|
|
Binary file
|