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