huiyi-select-table 0.0.7 → 0.0.9
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 +106 -74
- package/huiyi-select-table.umd.js +1 -1
- package/package.json +24 -8
- package/style.css +1 -1
- package/favicon.ico +0 -0
- package/index.html +0 -17
package/huiyi-select-table.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
3
|
-
name: "
|
|
1
|
+
import { defineComponent as M, ref as a, resolveComponent as g, openBlock as _, createElementBlock as x, createVNode as I, withDirectives as j, createElementVNode as A, withCtx as H, Fragment as F, renderList as K, createBlock as N, vShow as U } from "vue";
|
|
2
|
+
const q = { class: "spanDiv" }, Q = /* @__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: c }) {
|
|
12
|
+
const r = o, s = a(""), u = a(!1), t = a([]), b = a([]), f = a(!1), n = a(-1), p = a(-1), d = a(null), w = () => {
|
|
13
|
+
u.value = !0, s.value ? (t.value = r.originalData.filter((e) => Object.keys(e).some((l) => String(e[l]).toLowerCase().includes(s.value.toLowerCase()))), console.log(t.value), n.value = -1, p.value = -1) : t.value = r.originalData;
|
|
14
|
+
}, C = c, D = (e) => {
|
|
15
|
+
b.value = e;
|
|
16
|
+
}, y = (e) => {
|
|
17
|
+
b.value = e, e && (s.value = e[r.showValue], u.value = !1), C("slectValue", e);
|
|
18
|
+
}, V = () => {
|
|
19
|
+
f.value == !1 && (u.value = !1);
|
|
20
|
+
}, S = () => {
|
|
21
|
+
f.value = !0;
|
|
22
|
+
}, R = () => {
|
|
23
|
+
f.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(), u.value == !0 ? O() : w());
|
|
36
|
+
}, O = () => {
|
|
37
|
+
if (n.value >= 0) {
|
|
38
|
+
p.value === n.value ? p.value = -1 : p.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 (d.value && t.value.length > 0 && e >= 0 && e < t.value.length) {
|
|
45
|
+
const i = d.value.$el.querySelectorAll(".el-table__row");
|
|
46
|
+
console.log(i, "rows"), i.length > 0 && e < i.length && i[e].scrollIntoView({ behavior: "smooth", block: "nearest" }), d.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 i = g("el-input"), E = g("el-table-column"), L = g("el-table");
|
|
52
|
+
return _(), x("span", {
|
|
53
|
+
class: "spanInput",
|
|
54
|
+
onMouseover: S,
|
|
55
|
+
onMouseout: R
|
|
56
|
+
}, [
|
|
57
|
+
I(i, {
|
|
58
|
+
placeholder: "请输入搜索内容",
|
|
59
|
+
modelValue: s.value,
|
|
60
|
+
"onUpdate:modelValue": l[0] || (l[0] = (v) => s.value = v),
|
|
61
|
+
id: "filterInput",
|
|
62
|
+
onInput: w,
|
|
63
|
+
style: { width: "200px" },
|
|
64
|
+
onFocus: w,
|
|
65
|
+
onBlur: V,
|
|
66
|
+
onKeydown: T
|
|
67
|
+
}, null, 8, ["modelValue"]),
|
|
68
|
+
j(A("div", q, [
|
|
69
|
+
I(L, {
|
|
70
|
+
ref_key: "singleTableRef",
|
|
71
|
+
ref: d,
|
|
72
|
+
border: "",
|
|
73
|
+
class: "spanInputTable",
|
|
74
|
+
"row-class-name": o.originalData,
|
|
75
|
+
"highlight-current-row": "",
|
|
76
|
+
data: t.value,
|
|
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: H(() => [
|
|
82
|
+
(_(!0), x(F, null, K(o.columnList, (v, B) => (_(), N(E, {
|
|
83
|
+
key: B,
|
|
84
|
+
prop: v.prop,
|
|
85
|
+
label: v.label,
|
|
86
|
+
width: v.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
|
+
[U, u.value]
|
|
95
|
+
])
|
|
96
|
+
], 32);
|
|
66
97
|
};
|
|
67
98
|
}
|
|
68
|
-
})
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
99
|
+
});
|
|
100
|
+
const $ = (o, c) => {
|
|
101
|
+
const r = o.__vccOpts || o;
|
|
102
|
+
for (const [s, u] of c)
|
|
103
|
+
r[s] = u;
|
|
72
104
|
return r;
|
|
73
|
-
},
|
|
74
|
-
|
|
75
|
-
|
|
105
|
+
}, h = /* @__PURE__ */ $(Q, [["__scopeId", "data-v-1352b6c0"]]);
|
|
106
|
+
h.install = (o) => {
|
|
107
|
+
o.component(h.name, h);
|
|
76
108
|
};
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
],
|
|
80
|
-
|
|
81
|
-
|
|
109
|
+
const z = [
|
|
110
|
+
h
|
|
111
|
+
], m = function(o) {
|
|
112
|
+
m.installed || z.forEach((c) => {
|
|
113
|
+
o.component(c.name, c);
|
|
82
114
|
});
|
|
83
115
|
};
|
|
84
|
-
typeof window < "u" && window.Vue &&
|
|
85
|
-
const
|
|
116
|
+
typeof window < "u" && window.Vue && m(window.Vue);
|
|
117
|
+
const J = {
|
|
86
118
|
// 导出的对象必须具有 install,才能被 Vue.use() 方法安装
|
|
87
|
-
install:
|
|
119
|
+
install: m,
|
|
88
120
|
// 以下是具体的组件列表
|
|
89
|
-
|
|
121
|
+
SelectTable: h
|
|
90
122
|
};
|
|
91
123
|
export {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
124
|
+
h as SelectTable,
|
|
125
|
+
J 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=e.ref(""),c=e.ref(!1),n=e.ref([]),m=e.ref([]),g=e.ref(!1),o=e.ref(-1),w=e.ref(-1),_=e.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},O=()=>{g.value=!1},R=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:O},[e.createVNode(d,{placeholder:"请输入搜索内容",modelValue:r.value,"onUpdate:modelValue":t[0]||(t[0]=p=>r.value=p),id:"filterInput",onInput:v,style:{width:"200px"},onFocus:v,onBlur:T,onKeydown:R},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:n.value,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,c.value]])],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-1352b6c0"]]);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,20 +1,36 @@
|
|
|
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.9",
|
|
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",
|
|
17
16
|
"peerDependencies": {
|
|
18
17
|
"vue": "^3.0.0"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"huiyi-select-table.umd.js",
|
|
21
|
+
"huiyi-select-table.mjs",
|
|
22
|
+
"style.css"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "vite build",
|
|
26
|
+
"release": "npm version patch && npm publish"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/yourname/huiyi-select-table.git"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/yourname/huiyi-select-table#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/yourname/huiyi-select-table/issues"
|
|
19
35
|
}
|
|
20
36
|
}
|
package/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.el-table .warning-row[data-v-
|
|
1
|
+
.el-table .warning-row[data-v-1352b6c0]{--el-table-tr-bg-color: #141}.spanInput[data-v-1352b6c0]{display:inline-block;position:relative}.spanDiv[data-v-1352b6c0]{z-index:10000;position:absolute;top:35px;background-color:#fff;height:230px;border:1px solid #eee}
|
package/favicon.ico
DELETED
|
Binary file
|
package/index.html
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
7
|
-
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
|
8
|
-
<title><%= htmlWebpackPlugin.options.title %></title>
|
|
9
|
-
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<noscript>
|
|
12
|
-
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
|
13
|
-
</noscript>
|
|
14
|
-
<div id="app"></div>
|
|
15
|
-
<!-- built files will be auto injected -->
|
|
16
|
-
</body>
|
|
17
|
-
</html>
|