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