huiyi-select-table 0.0.0 → 0.0.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
.el-table .warning-row[data-v-
|
|
1
|
+
.el-table .warning-row[data-v-2d4704ea]{--el-table-tr-bg-color: #141}.spanInput[data-v-2d4704ea]{display:inline-block;position:relative}.spanDiv[data-v-2d4704ea]{z-index:10000;position:absolute;top:35px;background-color:#fff;height:230px;border:1px solid #eee}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
3
|
-
name: "
|
|
1
|
+
import { defineComponent as M, resolveComponent as d, createElementBlock as y, openBlock as g, createVNode as C, withDirectives as j, unref as m, isRef as A, createElementVNode as H, withCtx as N, Fragment as F, renderList as K, createBlock as U, vShow as q } from "vue";
|
|
2
|
+
const Q = { class: "spanDiv" }, $ = /* @__PURE__ */ M({
|
|
3
|
+
name: "InputSelectCompont",
|
|
4
4
|
__name: "SelectTable",
|
|
5
5
|
props: {
|
|
6
6
|
originalData: Object,
|
|
@@ -8,81 +8,111 @@ const j = /* @__PURE__ */ I({
|
|
|
8
8
|
columnList: Object
|
|
9
9
|
},
|
|
10
10
|
emits: ["slectValue"],
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
11
|
+
setup(n, { emit: r }) {
|
|
12
|
+
const u = n, a = ref(""), s = ref(!1), t = ref([]), b = ref([]), p = ref(!1), o = ref(-1), f = ref(-1), h = ref(null), w = () => {
|
|
13
|
+
s.value = !0, a.value ? (t.value = u.originalData.filter((e) => Object.keys(e).some((l) => String(e[l]).toLowerCase().includes(a.value.toLowerCase()))), console.log(t.value), o.value = -1, f.value = -1) : t.value = u.originalData;
|
|
14
|
+
}, V = r, D = (e) => {
|
|
15
|
+
b.value = e;
|
|
16
|
+
}, _ = (e) => {
|
|
17
|
+
b.value = e, e && (a.value = e[u.showValue], s.value = !1), V("slectValue", e);
|
|
18
|
+
}, x = () => {
|
|
19
|
+
p.value == !1 && (s.value = !1);
|
|
20
|
+
}, R = () => {
|
|
21
|
+
p.value = !0;
|
|
22
|
+
}, S = () => {
|
|
23
|
+
p.value = !1;
|
|
24
|
+
}, O = (e) => {
|
|
25
|
+
if (console.log(e.key, "event.key "), t.value.length !== 0)
|
|
26
|
+
if (e.key == "ArrowDown") {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
let l = o.value + 1;
|
|
29
|
+
l >= t.value.length && (l = 0), console.log(l, "newIndex"), k(l);
|
|
30
|
+
} else if (e.key == "ArrowUp") {
|
|
31
|
+
e.preventDefault();
|
|
32
|
+
let l = o.value - 1;
|
|
33
|
+
l < 0 && (l = t.value.length - 1), k(l);
|
|
34
|
+
} else e.key === "Enter" && (e.preventDefault(), s.value == !0 ? E() : w());
|
|
35
|
+
}, E = () => {
|
|
36
|
+
if (o.value >= 0) {
|
|
37
|
+
f.value === o.value ? f.value = -1 : f.value = o.value;
|
|
38
|
+
const e = t.value;
|
|
39
|
+
console.log(e[o.value], o.value, "hh[currentHighlightIndex]"), _(t.value[o.value]);
|
|
40
|
+
}
|
|
41
|
+
}, k = (e) => {
|
|
42
|
+
o.value = e, nextTick(() => {
|
|
43
|
+
if (h.value && t.value.length > 0 && e >= 0 && e < t.value.length) {
|
|
44
|
+
const c = h.value.$el.querySelectorAll(".el-table__row");
|
|
45
|
+
console.log(c, "rows"), c.length > 0 && e < c.length && c[e].scrollIntoView({ behavior: "smooth", block: "nearest" }), h.value.setCurrentRow(t.value[o.value]);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
18
48
|
};
|
|
19
|
-
return (
|
|
20
|
-
const
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
49
|
+
return (e, l) => {
|
|
50
|
+
const c = d("el-input"), T = d("el-table-column"), L = d("el-table");
|
|
51
|
+
return g(), y("span", {
|
|
52
|
+
class: "spanInput",
|
|
53
|
+
onMouseover: R,
|
|
54
|
+
onMouseout: S
|
|
55
|
+
}, [
|
|
56
|
+
C(c, {
|
|
57
|
+
placeholder: "请输入搜索内容",
|
|
58
|
+
modelValue: m(a),
|
|
59
|
+
"onUpdate:modelValue": l[0] || (l[0] = (i) => A(a) ? a.value = i : null),
|
|
60
|
+
id: "filterInput",
|
|
61
|
+
onInput: w,
|
|
62
|
+
style: { width: "200px" },
|
|
63
|
+
onFocus: w,
|
|
64
|
+
onBlur: x,
|
|
65
|
+
onKeydown: O
|
|
66
|
+
}, null, 8, ["modelValue"]),
|
|
67
|
+
j(H("div", Q, [
|
|
68
|
+
C(L, {
|
|
69
|
+
ref_key: "singleTableRef",
|
|
70
|
+
ref: h,
|
|
71
|
+
border: "",
|
|
72
|
+
class: "spanInputTable",
|
|
73
|
+
"row-class-name": e.tableRowClassName,
|
|
74
|
+
"highlight-current-row": "",
|
|
75
|
+
data: m(t),
|
|
76
|
+
style: { width: "300px", height: "230px", position: "fixed" },
|
|
77
|
+
onCurrentChange: D,
|
|
78
|
+
onRowClick: _
|
|
33
79
|
}, {
|
|
34
|
-
default:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
data: w(v),
|
|
44
|
-
style: { width: "300px", height: "230px", position: "fixed" },
|
|
45
|
-
onCurrentChange: y,
|
|
46
|
-
onRowClick: x
|
|
47
|
-
}, {
|
|
48
|
-
default: p(() => [
|
|
49
|
-
(a(!0), _(h, null, b(e.columnList, (i, D) => (a(), f(R, {
|
|
50
|
-
key: D,
|
|
51
|
-
prop: i.prop,
|
|
52
|
-
label: i.label,
|
|
53
|
-
width: i.width,
|
|
54
|
-
"show-overflow-tooltip": "",
|
|
55
|
-
align: "center"
|
|
56
|
-
}, null, 8, ["prop", "label", "width"]))), 128))
|
|
57
|
-
]),
|
|
58
|
-
_: 2
|
|
59
|
-
}, 1032, ["row-class-name", "data"])
|
|
80
|
+
default: N(() => [
|
|
81
|
+
(g(!0), y(F, null, K(n.columnList, (i, B) => (g(), U(T, {
|
|
82
|
+
key: B,
|
|
83
|
+
prop: i.prop,
|
|
84
|
+
label: i.label,
|
|
85
|
+
width: i.width,
|
|
86
|
+
"show-overflow-tooltip": "",
|
|
87
|
+
align: "center"
|
|
88
|
+
}, null, 8, ["prop", "label", "width"]))), 128))
|
|
60
89
|
]),
|
|
61
|
-
_:
|
|
62
|
-
},
|
|
63
|
-
]),
|
|
64
|
-
|
|
65
|
-
|
|
90
|
+
_: 1
|
|
91
|
+
}, 8, ["row-class-name", "data"])
|
|
92
|
+
], 512), [
|
|
93
|
+
[q, m(s)]
|
|
94
|
+
])
|
|
95
|
+
], 32);
|
|
66
96
|
};
|
|
67
97
|
}
|
|
68
|
-
}),
|
|
69
|
-
const
|
|
70
|
-
for (const [
|
|
71
|
-
|
|
72
|
-
return
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
98
|
+
}), z = (n, r) => {
|
|
99
|
+
const u = n.__vccOpts || n;
|
|
100
|
+
for (const [a, s] of r)
|
|
101
|
+
u[a] = s;
|
|
102
|
+
return u;
|
|
103
|
+
}, v = /* @__PURE__ */ z($, [["__scopeId", "data-v-2d4704ea"]]);
|
|
104
|
+
v.install = (n) => {
|
|
105
|
+
n.component(v.name, v);
|
|
76
106
|
};
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
],
|
|
80
|
-
|
|
81
|
-
|
|
107
|
+
const G = [
|
|
108
|
+
v
|
|
109
|
+
], I = function(n) {
|
|
110
|
+
I.installed || G.forEach((r) => {
|
|
111
|
+
n.component(r.name, r);
|
|
82
112
|
});
|
|
83
113
|
};
|
|
84
|
-
typeof window < "u" && window.Vue &&
|
|
114
|
+
typeof window < "u" && window.Vue && I(window.Vue);
|
|
85
115
|
export {
|
|
86
|
-
|
|
87
|
-
|
|
116
|
+
v as SelectTable,
|
|
117
|
+
I as install
|
|
88
118
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(s,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(s=typeof globalThis<"u"?globalThis:s||self,l(s.HuiyiSelectTable={},s.Vue))})(this,(function(s,l){"use strict";const k={class:"spanDiv"},p=((a,u)=>{const i=a.__vccOpts||a;for(const[r,c]of u)i[r]=c;return i})(l.defineComponent({name:"InputSelectCompont",__name:"SelectTable",props:{originalData:Object,showValue:String,columnList:Object},emits:["slectValue"],setup(a,{emit:u}){const i=a,r=ref(""),c=ref(!1),n=ref([]),b=ref([]),g=ref(!1),o=ref(-1),h=ref(-1),w=ref(null),v=()=>{c.value=!0,r.value?(n.value=i.originalData.filter(e=>Object.keys(e).some(t=>String(e[t]).toLowerCase().includes(r.value.toLowerCase()))),console.log(n.value),o.value=-1,h.value=-1):n.value=i.originalData},I=u,V=e=>{b.value=e},_=e=>{b.value=e,e&&(r.value=e[i.showValue],c.value=!1),I("slectValue",e)},S=()=>{g.value==!1&&(c.value=!1)},x=()=>{g.value=!0},D=()=>{g.value=!1},T=e=>{if(console.log(e.key,"event.key "),n.value.length!==0)if(e.key=="ArrowDown"){e.preventDefault();let t=o.value+1;t>=n.value.length&&(t=0),console.log(t,"newIndex"),y(t)}else if(e.key=="ArrowUp"){e.preventDefault();let t=o.value-1;t<0&&(t=n.value.length-1),y(t)}else e.key==="Enter"&&(e.preventDefault(),c.value==!0?R():v())},R=()=>{if(o.value>=0){h.value===o.value?h.value=-1:h.value=o.value;const e=n.value;console.log(e[o.value],o.value,"hh[currentHighlightIndex]"),_(n.value[o.value])}},y=e=>{o.value=e,nextTick(()=>{if(w.value&&n.value.length>0&&e>=0&&e<n.value.length){const f=w.value.$el.querySelectorAll(".el-table__row");console.log(f,"rows"),f.length>0&&e<f.length&&f[e].scrollIntoView({behavior:"smooth",block:"nearest"}),w.value.setCurrentRow(n.value[o.value])}})};return(e,t)=>{const f=l.resolveComponent("el-input"),O=l.resolveComponent("el-table-column"),B=l.resolveComponent("el-table");return l.openBlock(),l.createElementBlock("span",{class:"spanInput",onMouseover:x,onMouseout:D},[l.createVNode(f,{placeholder:"请输入搜索内容",modelValue:l.unref(r),"onUpdate:modelValue":t[0]||(t[0]=d=>l.isRef(r)?r.value=d:null),id:"filterInput",onInput:v,style:{width:"200px"},onFocus:v,onBlur:S,onKeydown:T},null,8,["modelValue"]),l.withDirectives(l.createElementVNode("div",k,[l.createVNode(B,{ref_key:"singleTableRef",ref:w,border:"",class:"spanInputTable","row-class-name":e.tableRowClassName,"highlight-current-row":"",data:l.unref(n),style:{width:"300px",height:"230px",position:"fixed"},onCurrentChange:V,onRowClick:_},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(a.columnList,(d,E)=>(l.openBlock(),l.createBlock(O,{key:E,prop:d.prop,label:d.label,width:d.width,"show-overflow-tooltip":"",align:"center"},null,8,["prop","label","width"]))),128))]),_:1},8,["row-class-name","data"])],512),[[l.vShow,l.unref(c)]])],32)}}}),[["__scopeId","data-v-2d4704ea"]]);p.install=a=>{a.component(p.name,p)};const C=[p],m=function(a){m.installed||C.forEach(u=>{a.component(u.name,u)})};typeof window<"u"&&window.Vue&&m(window.Vue),s.SelectTable=p,s.install=m,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})}));
|