huiyi-select-table 0.0.1 → 0.0.2
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,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as j, resolveComponent as w, createElementBlock as C, openBlock as g, createVNode as I, withDirectives as A, unref as m, isRef as H, createElementVNode as N, withCtx as F, Fragment as K, renderList as U, createBlock as q, vShow as Q } from "vue";
|
|
2
|
+
const $ = { class: "spanDiv" }, z = /* @__PURE__ */ j({
|
|
3
3
|
name: "InputSelectCompont",
|
|
4
4
|
__name: "SelectTable",
|
|
5
5
|
props: {
|
|
@@ -8,37 +8,37 @@ const Q = { class: "spanDiv" }, $ = /* @__PURE__ */ M({
|
|
|
8
8
|
columnList: Object
|
|
9
9
|
},
|
|
10
10
|
emits: ["slectValue"],
|
|
11
|
-
setup(n, { emit:
|
|
12
|
-
const
|
|
13
|
-
s.value = !0, a.value ? (t.value =
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
}, x = () => {
|
|
19
|
-
p.value == !1 && (s.value = !1);
|
|
11
|
+
setup(n, { emit: u }) {
|
|
12
|
+
const r = n, a = ref(""), s = ref(!1), t = ref([]), _ = ref([]), p = ref(!1), o = ref(-1), f = 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), o.value = -1, f.value = -1) : t.value = r.originalData;
|
|
14
|
+
}, x = u, D = (e) => {
|
|
15
|
+
_.value = e;
|
|
16
|
+
}, k = (e) => {
|
|
17
|
+
_.value = e, e && (a.value = e[r.showValue], s.value = !1), x("slectValue", e);
|
|
20
18
|
}, R = () => {
|
|
21
|
-
p.value = !
|
|
19
|
+
p.value == !1 && (s.value = !1);
|
|
22
20
|
}, S = () => {
|
|
21
|
+
p.value = !0;
|
|
22
|
+
}, O = () => {
|
|
23
23
|
p.value = !1;
|
|
24
|
-
},
|
|
24
|
+
}, E = (e) => {
|
|
25
25
|
if (console.log(e.key, "event.key "), t.value.length !== 0)
|
|
26
26
|
if (e.key == "ArrowDown") {
|
|
27
27
|
e.preventDefault();
|
|
28
28
|
let l = o.value + 1;
|
|
29
|
-
l >= t.value.length && (l = 0), console.log(l, "newIndex"),
|
|
29
|
+
l >= t.value.length && (l = 0), console.log(l, "newIndex"), y(l);
|
|
30
30
|
} else if (e.key == "ArrowUp") {
|
|
31
31
|
e.preventDefault();
|
|
32
32
|
let l = o.value - 1;
|
|
33
|
-
l < 0 && (l = t.value.length - 1),
|
|
34
|
-
} else e.key === "Enter" && (e.preventDefault(), s.value == !0 ?
|
|
35
|
-
},
|
|
33
|
+
l < 0 && (l = t.value.length - 1), y(l);
|
|
34
|
+
} else e.key === "Enter" && (e.preventDefault(), s.value == !0 ? T() : d());
|
|
35
|
+
}, T = () => {
|
|
36
36
|
if (o.value >= 0) {
|
|
37
37
|
f.value === o.value ? f.value = -1 : f.value = o.value;
|
|
38
38
|
const e = t.value;
|
|
39
|
-
console.log(e[o.value], o.value, "hh[currentHighlightIndex]"),
|
|
39
|
+
console.log(e[o.value], o.value, "hh[currentHighlightIndex]"), k(t.value[o.value]);
|
|
40
40
|
}
|
|
41
|
-
},
|
|
41
|
+
}, y = (e) => {
|
|
42
42
|
o.value = e, nextTick(() => {
|
|
43
43
|
if (h.value && t.value.length > 0 && e >= 0 && e < t.value.length) {
|
|
44
44
|
const c = h.value.$el.querySelectorAll(".el-table__row");
|
|
@@ -47,25 +47,25 @@ const Q = { class: "spanDiv" }, $ = /* @__PURE__ */ M({
|
|
|
47
47
|
});
|
|
48
48
|
};
|
|
49
49
|
return (e, l) => {
|
|
50
|
-
const c =
|
|
51
|
-
return g(),
|
|
50
|
+
const c = w("el-input"), L = w("el-table-column"), B = w("el-table");
|
|
51
|
+
return g(), C("span", {
|
|
52
52
|
class: "spanInput",
|
|
53
|
-
onMouseover:
|
|
54
|
-
onMouseout:
|
|
53
|
+
onMouseover: S,
|
|
54
|
+
onMouseout: O
|
|
55
55
|
}, [
|
|
56
|
-
|
|
56
|
+
I(c, {
|
|
57
57
|
placeholder: "请输入搜索内容",
|
|
58
58
|
modelValue: m(a),
|
|
59
|
-
"onUpdate:modelValue": l[0] || (l[0] = (i) =>
|
|
59
|
+
"onUpdate:modelValue": l[0] || (l[0] = (i) => H(a) ? a.value = i : null),
|
|
60
60
|
id: "filterInput",
|
|
61
|
-
onInput:
|
|
61
|
+
onInput: d,
|
|
62
62
|
style: { width: "200px" },
|
|
63
|
-
onFocus:
|
|
64
|
-
onBlur:
|
|
65
|
-
onKeydown:
|
|
63
|
+
onFocus: d,
|
|
64
|
+
onBlur: R,
|
|
65
|
+
onKeydown: E
|
|
66
66
|
}, null, 8, ["modelValue"]),
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
A(N("div", $, [
|
|
68
|
+
I(B, {
|
|
69
69
|
ref_key: "singleTableRef",
|
|
70
70
|
ref: h,
|
|
71
71
|
border: "",
|
|
@@ -75,11 +75,11 @@ const Q = { class: "spanDiv" }, $ = /* @__PURE__ */ M({
|
|
|
75
75
|
data: m(t),
|
|
76
76
|
style: { width: "300px", height: "230px", position: "fixed" },
|
|
77
77
|
onCurrentChange: D,
|
|
78
|
-
onRowClick:
|
|
78
|
+
onRowClick: k
|
|
79
79
|
}, {
|
|
80
|
-
default:
|
|
81
|
-
(g(!0),
|
|
82
|
-
key:
|
|
80
|
+
default: F(() => [
|
|
81
|
+
(g(!0), C(K, null, U(n.columnList, (i, M) => (g(), q(L, {
|
|
82
|
+
key: M,
|
|
83
83
|
prop: i.prop,
|
|
84
84
|
label: i.label,
|
|
85
85
|
width: i.width,
|
|
@@ -90,29 +90,34 @@ const Q = { class: "spanDiv" }, $ = /* @__PURE__ */ M({
|
|
|
90
90
|
_: 1
|
|
91
91
|
}, 8, ["row-class-name", "data"])
|
|
92
92
|
], 512), [
|
|
93
|
-
[
|
|
93
|
+
[Q, m(s)]
|
|
94
94
|
])
|
|
95
95
|
], 32);
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
|
-
}),
|
|
99
|
-
const
|
|
100
|
-
for (const [a, s] of
|
|
101
|
-
|
|
102
|
-
return
|
|
103
|
-
}, v = /* @__PURE__ */ z
|
|
98
|
+
}), G = (n, u) => {
|
|
99
|
+
const r = n.__vccOpts || n;
|
|
100
|
+
for (const [a, s] of u)
|
|
101
|
+
r[a] = s;
|
|
102
|
+
return r;
|
|
103
|
+
}, v = /* @__PURE__ */ G(z, [["__scopeId", "data-v-2d4704ea"]]);
|
|
104
104
|
v.install = (n) => {
|
|
105
105
|
n.component(v.name, v);
|
|
106
106
|
};
|
|
107
|
-
const
|
|
107
|
+
const V = [
|
|
108
108
|
v
|
|
109
|
-
],
|
|
110
|
-
|
|
111
|
-
n.component(
|
|
109
|
+
], b = function(n) {
|
|
110
|
+
b.installed || V.forEach((u) => {
|
|
111
|
+
n.component(u.name, u);
|
|
112
112
|
});
|
|
113
113
|
};
|
|
114
|
-
typeof window < "u" && window.Vue &&
|
|
114
|
+
typeof window < "u" && window.Vue && b(window.Vue);
|
|
115
|
+
const P = {
|
|
116
|
+
install: b,
|
|
117
|
+
...V
|
|
118
|
+
};
|
|
115
119
|
export {
|
|
116
120
|
v as SelectTable,
|
|
117
|
-
|
|
121
|
+
P as default,
|
|
122
|
+
b as install
|
|
118
123
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(a,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(a=typeof globalThis<"u"?globalThis:a||self,l(a.HuiyiSelectTable={},a.Vue))})(this,(function(a,l){"use strict";const C={class:"spanDiv"},d=((s,c)=>{const i=s.__vccOpts||s;for(const[r,u]of c)i[r]=u;return i})(l.defineComponent({name:"InputSelectCompont",__name:"SelectTable",props:{originalData:Object,showValue:String,columnList:Object},emits:["slectValue"],setup(s,{emit:c}){const i=s,r=ref(""),u=ref(!1),n=ref([]),b=ref([]),g=ref(!1),o=ref(-1),w=ref(-1),m=ref(null),v=()=>{u.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,w.value=-1):n.value=i.originalData},V=c,S=e=>{b.value=e},y=e=>{b.value=e,e&&(r.value=e[i.showValue],u.value=!1),V("slectValue",e)},x=()=>{g.value==!1&&(u.value=!1)},D=()=>{g.value=!0},T=()=>{g.value=!1},R=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"),k(t)}else if(e.key=="ArrowUp"){e.preventDefault();let t=o.value-1;t<0&&(t=n.value.length-1),k(t)}else e.key==="Enter"&&(e.preventDefault(),u.value==!0?O():v())},O=()=>{if(o.value>=0){w.value===o.value?w.value=-1:w.value=o.value;const e=n.value;console.log(e[o.value],o.value,"hh[currentHighlightIndex]"),y(n.value[o.value])}},k=e=>{o.value=e,nextTick(()=>{if(m.value&&n.value.length>0&&e>=0&&e<n.value.length){const f=m.value.$el.querySelectorAll(".el-table__row");console.log(f,"rows"),f.length>0&&e<f.length&&f[e].scrollIntoView({behavior:"smooth",block:"nearest"}),m.value.setCurrentRow(n.value[o.value])}})};return(e,t)=>{const f=l.resolveComponent("el-input"),B=l.resolveComponent("el-table-column"),E=l.resolveComponent("el-table");return l.openBlock(),l.createElementBlock("span",{class:"spanInput",onMouseover:D,onMouseout:T},[l.createVNode(f,{placeholder:"请输入搜索内容",modelValue:l.unref(r),"onUpdate:modelValue":t[0]||(t[0]=p=>l.isRef(r)?r.value=p:null),id:"filterInput",onInput:v,style:{width:"200px"},onFocus:v,onBlur:x,onKeydown:R},null,8,["modelValue"]),l.withDirectives(l.createElementVNode("div",C,[l.createVNode(E,{ref_key:"singleTableRef",ref:m,border:"",class:"spanInputTable","row-class-name":e.tableRowClassName,"highlight-current-row":"",data:l.unref(n),style:{width:"300px",height:"230px",position:"fixed"},onCurrentChange:S,onRowClick:y},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(s.columnList,(p,M)=>(l.openBlock(),l.createBlock(B,{key:M,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),[[l.vShow,l.unref(u)]])],32)}}}),[["__scopeId","data-v-2d4704ea"]]);d.install=s=>{s.component(d.name,d)};const _=[d],h=function(s){h.installed||_.forEach(c=>{s.component(c.name,c)})};typeof window<"u"&&window.Vue&&h(window.Vue);const I={install:h,..._};a.SelectTable=d,a.default=I,a.install=h,Object.defineProperties(a,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huiyi-select-table",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "select,table",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"types": "dist/index.d.ts",
|
|
6
7
|
"main": "dist/huiyi-select-table.umd.js",
|
|
7
8
|
"module": "dist/huiyi-select-table.es.js",
|
|
8
9
|
"files": ["dist"],
|
|
9
10
|
"scripts": {
|
|
10
11
|
"dev": "vite",
|
|
11
|
-
"build": "vite build && tsc --emitDeclarationOnly --declaration",
|
|
12
|
+
"build": "vite build --config vite.config.lib.ts && tsc --emitDeclarationOnly --declaration",
|
|
12
13
|
"prepublishOnly": "npm run build"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
@@ -19,8 +20,8 @@
|
|
|
19
20
|
"@types/node": "^24.10.0",
|
|
20
21
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
21
22
|
"@vue/tsconfig": "^0.8.1",
|
|
22
|
-
"typescript": "
|
|
23
|
+
"typescript": "^5.7.3",
|
|
23
24
|
"vite": "^7.2.2",
|
|
24
|
-
"vue-tsc": "^
|
|
25
|
+
"vue-tsc": "^2.2.0"
|
|
25
26
|
}
|
|
26
|
-
}
|
|
27
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
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"})}));
|