huiyi-select-table 0.0.0 → 0.0.1

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