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