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