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