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