huiyi-select-table 0.0.7 → 0.0.9

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,6 +1,6 @@
1
- import { defineComponent as L, resolveComponent as c, createBlock as f, openBlock as a, unref as _, isRef as O, withCtx as d, createElementBlock as h, Fragment as b, renderList as g, createVNode as j } from "vue";
2
- const E = /* @__PURE__ */ L({
3
- name: "InputSelectCom",
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: "spanDiv" }, Q = /* @__PURE__ */ M({
3
+ name: "InputSelectCompont",
4
4
  __name: "SelectTable",
5
5
  props: {
6
6
  originalData: Object,
@@ -8,88 +8,120 @@ const E = /* @__PURE__ */ L({
8
8
  columnList: Object
9
9
  },
10
10
  emits: ["slectValue"],
11
- setup(e, { emit: l }) {
12
- const r = e, n = ref(""), u = ref(""), v = ref(!1), V = ref([]), m = ref([]);
13
- ref(!1), ref(-1), ref(-1);
14
- const k = ref(null), x = l, y = (t) => {
15
- m.value = t;
16
- }, R = (t) => {
17
- m.value = t, t && (u.value = t[r.showValue], v.value = !1), x("slectValue", t);
11
+ setup(o, { emit: c }) {
12
+ const r = o, s = a(""), u = a(!1), t = a([]), b = a([]), f = a(!1), n = a(-1), p = a(-1), d = 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, p.value = -1) : t.value = r.originalData;
14
+ }, 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
+ f.value == !1 && (u.value = !1);
20
+ }, S = () => {
21
+ f.value = !0;
22
+ }, R = () => {
23
+ f.value = !1;
24
+ }, T = (e) => {
25
+ if (console.log(e.key, "event.key "), t.value.length !== 0)
26
+ if (e.key == "ArrowDown") {
27
+ e.preventDefault();
28
+ let l = n.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 = n.value - 1;
33
+ l < 0 && (l = t.value.length - 1), k(l);
34
+ } else
35
+ e.key === "Enter" && (e.preventDefault(), u.value == !0 ? O() : w());
36
+ }, O = () => {
37
+ if (n.value >= 0) {
38
+ p.value === n.value ? p.value = -1 : p.value = n.value;
39
+ const e = t.value;
40
+ console.log(e[n.value], n.value, "hh[currentHighlightIndex]"), y(t.value[n.value]);
41
+ }
42
+ }, k = (e) => {
43
+ n.value = e, nextTick(() => {
44
+ if (d.value && t.value.length > 0 && e >= 0 && e < t.value.length) {
45
+ const i = d.value.$el.querySelectorAll(".el-table__row");
46
+ console.log(i, "rows"), i.length > 0 && e < i.length && i[e].scrollIntoView({ behavior: "smooth", block: "nearest" }), d.value.setCurrentRow(t.value[n.value]);
47
+ }
48
+ });
18
49
  };
19
- return (t, w) => {
20
- const S = c("el-table-column"), T = c("el-table"), B = c("el-option"), D = c("el-select");
21
- return a(), f(D, {
22
- modelValue: _(n),
23
- "onUpdate:modelValue": w[0] || (w[0] = (o) => O(n) ? n.value = o : null),
24
- filterable: "",
25
- placeholder: "Select",
26
- style: { width: "240px" }
27
- }, {
28
- default: d(() => [
29
- (a(!0), h(b, null, g(e.originalData, (o) => (a(), f(B, {
30
- key: o.name,
31
- label: o.name,
32
- value: o.name
50
+ return (e, l) => {
51
+ const i = g("el-input"), E = g("el-table-column"), L = g("el-table");
52
+ return _(), x("span", {
53
+ class: "spanInput",
54
+ onMouseover: S,
55
+ onMouseout: R
56
+ }, [
57
+ I(i, {
58
+ placeholder: "请输入搜索内容",
59
+ modelValue: s.value,
60
+ "onUpdate:modelValue": l[0] || (l[0] = (v) => s.value = v),
61
+ id: "filterInput",
62
+ onInput: w,
63
+ style: { width: "200px" },
64
+ onFocus: w,
65
+ onBlur: V,
66
+ onKeydown: T
67
+ }, null, 8, ["modelValue"]),
68
+ j(A("div", q, [
69
+ I(L, {
70
+ ref_key: "singleTableRef",
71
+ ref: d,
72
+ border: "",
73
+ class: "spanInputTable",
74
+ "row-class-name": o.originalData,
75
+ "highlight-current-row": "",
76
+ data: t.value,
77
+ style: { width: "300px", height: "230px", position: "fixed" },
78
+ onCurrentChange: D,
79
+ onRowClick: y
33
80
  }, {
34
- default: d(() => [
35
- j(T, {
36
- ref_for: !0,
37
- ref_key: "singleTableRef",
38
- ref: k,
39
- border: "",
40
- class: "spanInputTable",
41
- "row-class-name": t.tableRowClassName,
42
- "highlight-current-row": "",
43
- data: _(V),
44
- style: { width: "300px", height: "230px", position: "fixed" },
45
- onCurrentChange: y,
46
- onRowClick: R
47
- }, {
48
- default: d(() => [
49
- (a(!0), h(b, null, g(e.columnList, (i, I) => (a(), f(S, {
50
- key: I,
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"])
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))
60
90
  ]),
61
- _: 2
62
- }, 1032, ["label", "value"]))), 128))
63
- ]),
64
- _: 1
65
- }, 8, ["modelValue"]);
91
+ _: 1
92
+ }, 8, ["row-class-name", "data"])
93
+ ], 512), [
94
+ [U, u.value]
95
+ ])
96
+ ], 32);
66
97
  };
67
98
  }
68
- }), N = (e, l) => {
69
- const r = e.__vccOpts || e;
70
- for (const [n, u] of l)
71
- r[n] = u;
99
+ });
100
+ const $ = (o, c) => {
101
+ const r = o.__vccOpts || o;
102
+ for (const [s, u] of c)
103
+ r[s] = u;
72
104
  return r;
73
- }, s = /* @__PURE__ */ N(E, [["__scopeId", "data-v-3cde86ca"]]);
74
- s.install = (e) => {
75
- e.component(s.name, s);
105
+ }, h = /* @__PURE__ */ $(Q, [["__scopeId", "data-v-1352b6c0"]]);
106
+ h.install = (o) => {
107
+ o.component(h.name, h);
76
108
  };
77
- const C = [
78
- s
79
- ], p = function(e) {
80
- p.installed || C.forEach((l) => {
81
- e.component(l.name, l);
109
+ const z = [
110
+ h
111
+ ], m = function(o) {
112
+ m.installed || z.forEach((c) => {
113
+ o.component(c.name, c);
82
114
  });
83
115
  };
84
- typeof window < "u" && window.Vue && p(window.Vue);
85
- const Q = {
116
+ typeof window < "u" && window.Vue && m(window.Vue);
117
+ const J = {
86
118
  // 导出的对象必须具有 install,才能被 Vue.use() 方法安装
87
- install: p,
119
+ install: m,
88
120
  // 以下是具体的组件列表
89
- ...C
121
+ SelectTable: h
90
122
  };
91
123
  export {
92
- s as SelectTable,
93
- Q as default,
94
- p as install
124
+ h as SelectTable,
125
+ J as default,
126
+ m as install
95
127
  };
@@ -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 i=t.__vccOpts||t;for(const[c,f]of o)i[c]=f;return i})(e.defineComponent({name:"InputSelectCom",__name:"SelectTable",props:{originalData:Object,showValue:String,columnList:Object},emits:["slectValue"],setup(t,{emit:o}){const i=t,c=ref(""),f=ref(""),h=ref(!1),w=ref([]),u=ref([]);ref(!1),ref(-1),ref(-1);const b=ref(null),k=o,C=l=>{u.value=l},g=l=>{u.value=l,l&&(f.value=l[i.showValue],h.value=!1),k("slectValue",l)};return(l,m)=>{const y=e.resolveComponent("el-table-column"),V=e.resolveComponent("el-table"),x=e.resolveComponent("el-option"),B=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(B,{modelValue:e.unref(c),"onUpdate:modelValue":m[0]||(m[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(x,{key:r.name,label:r.name,value:r.name},{default:e.withCtx(()=>[e.createVNode(V,{ref_for:!0,ref_key:"singleTableRef",ref:b,border:"",class:"spanInputTable","row-class-name":l.tableRowClassName,"highlight-current-row":"",data:e.unref(w),style:{width:"300px",height:"230px",position:"fixed"},onCurrentChange:C,onRowClick:g},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnList,(d,S)=>(e.openBlock(),e.createBlock(y,{key:S,prop:d.prop,label:d.label,width:d.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 p=[a],s=function(t){s.installed||p.forEach(o=>{t.component(o.name,o)})};typeof window<"u"&&window.Vue&&s(window.Vue);const _={install:s,...p};n.SelectTable=a,n.default=_,n.install=s,Object.defineProperties(n,{__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:"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=e.ref(""),c=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=()=>{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},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(),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:O},[e.createVNode(d,{placeholder:"请输入搜索内容",modelValue:r.value,"onUpdate:modelValue":t[0]||(t[0]=p=>r.value=p),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:"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,(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,c.value]])],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-1352b6c0"]]);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"}})});
package/package.json CHANGED
@@ -1,20 +1,36 @@
1
1
  {
2
2
  "name": "huiyi-select-table",
3
- "version": "0.0.7",
4
- "description": "A Vue.js time range picker component",
5
- "main": "huiyi-select-table.umd.min.js",
6
- "module": "huiyi-select-table.common.js",
7
- "unpkg": "huiyi-select-table.umd.min.js",
8
- "browser": "huiyi-select-table.umd.min.js",
3
+ "version": "0.0.9",
4
+ "description": "A Vue.js select table component",
5
+ "main": "huiyi-select-table.umd.js",
6
+ "module": "huiyi-select-table.mjs",
7
+ "unpkg": "huiyi-select-table.umd.js",
8
+ "browser": "huiyi-select-table.umd.js",
9
9
  "keywords": [
10
10
  "vue",
11
11
  "component",
12
- "time-picker",
13
- "date-range"
12
+ "select-table"
14
13
  ],
15
14
  "author": "Time Components Up",
16
15
  "license": "MIT",
17
16
  "peerDependencies": {
18
17
  "vue": "^3.0.0"
18
+ },
19
+ "files": [
20
+ "huiyi-select-table.umd.js",
21
+ "huiyi-select-table.mjs",
22
+ "style.css"
23
+ ],
24
+ "scripts": {
25
+ "build": "vite build",
26
+ "release": "npm version patch && npm publish"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/yourname/huiyi-select-table.git"
31
+ },
32
+ "homepage": "https://github.com/yourname/huiyi-select-table#readme",
33
+ "bugs": {
34
+ "url": "https://github.com/yourname/huiyi-select-table/issues"
19
35
  }
20
36
  }
package/style.css CHANGED
@@ -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-1352b6c0]{--el-table-tr-bg-color: #141}.spanInput[data-v-1352b6c0]{display:inline-block;position:relative}.spanDiv[data-v-1352b6c0]{z-index:10000;position:absolute;top:35px;background-color:#fff;height:230px;border:1px solid #eee}
package/favicon.ico DELETED
Binary file
package/index.html DELETED
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
7
- <link rel="icon" href="<%= BASE_URL %>favicon.ico">
8
- <title><%= htmlWebpackPlugin.options.title %></title>
9
- </head>
10
- <body>
11
- <noscript>
12
- <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13
- </noscript>
14
- <div id="app"></div>
15
- <!-- built files will be auto injected -->
16
- </body>
17
- </html>