huiyi-select-table 0.0.8 → 0.1.0

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