slim-select 2.0.2 → 2.2.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.
- package/README.md +8 -0
- package/dist/index.d.ts +1 -1
- package/dist/render.d.ts +10 -3
- package/dist/select.d.ts +6 -6
- package/dist/settings.d.ts +0 -3
- package/dist/slimselect.cjs.js +202 -67
- package/dist/slimselect.css +1 -1
- package/dist/slimselect.css.map +1 -1
- package/dist/slimselect.es.js +202 -67
- package/dist/slimselect.global.js +202 -67
- package/dist/slimselect.js +202 -67
- package/dist/slimselect.min.js +1 -1
- package/dist/slimselect.umd.js +202 -67
- package/dist/slimselect.umd.min.js +1 -1
- package/dist/store.d.ts +5 -0
- package/docs/assets/data.js +7 -3
- package/docs/assets/home.css +1 -1
- package/docs/assets/home.js +1 -1
- package/docs/assets/index.css +1 -1
- package/docs/assets/index.js +7 -7
- package/docs/assets/index2.js +119 -35
- package/docs/assets/index3.js +39 -23
- package/docs/assets/index4.js +1 -1
- package/docs/assets/index5.js +147 -9
- package/docs/assets/install.js +4 -4
- package/docs/assets/selects.js +1 -1
- package/package.json +11 -3
- package/src/docs/app.vue +6 -5
- package/src/docs/{images → assets/images}/check-mark.svg +0 -0
- package/src/docs/{images → assets/images}/chrome.svg +0 -0
- package/src/docs/{images → assets/images}/firefox.svg +0 -0
- package/src/docs/{images → assets/images}/github.png +0 -0
- package/src/docs/{images → assets/images}/ie.svg +0 -0
- package/src/docs/{images → assets/images}/npm.png +0 -0
- package/src/docs/{images → assets/images}/opera.svg +0 -0
- package/src/docs/{images → assets/images}/safari.svg +0 -0
- package/src/docs/assets/scss/misc.scss +7 -0
- package/src/docs/env.d.ts +1 -0
- package/src/docs/pages/data.vue +4 -0
- package/src/docs/pages/events/addable.vue +22 -6
- package/src/docs/pages/events/before_after_change.vue +15 -1
- package/src/docs/pages/events/search.vue +31 -16
- package/src/docs/pages/frameworks/vue.vue +375 -7
- package/src/docs/pages/home.vue +104 -57
- package/src/docs/pages/methods/get_data.vue +2 -1
- package/src/docs/pages/methods/open_close.vue +1 -1
- package/src/docs/pages/settings/closable.vue +128 -0
- package/src/docs/pages/settings/index.vue +6 -3
- package/src/docs/pages/settings/select_all.vue +88 -0
- package/src/slim-select/index.ts +4 -2
- package/src/slim-select/render.ts +247 -59
- package/src/slim-select/rollup.config.mjs +5 -0
- package/src/slim-select/select.ts +48 -31
- package/src/slim-select/settings.ts +0 -4
- package/src/slim-select/slimselect.scss +112 -11
- package/src/slim-select/store.ts +19 -1
- package/src/vue/README.md +48 -0
- package/src/vue/dist/slimselectvue.es.js +1752 -0
- package/src/vue/dist/slimselectvue.global.js +1755 -0
- package/src/vue/dist/slimselectvue.ssr.js +1754 -0
- package/src/vue/hello.ts +5 -0
- package/src/vue/package.json +28 -0
- package/src/vue/rollup.config.mjs +44 -0
- package/src/vue/slimselect.vue +39 -5
- package/src/vue/tsconfig.json +14 -0
- package/src/docs/pages/settings/select_by_group.vue +0 -46
package/docs/assets/index3.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as _,S as
|
|
1
|
+
import{d as _,S as i,_ as g,o as l,c as r,f as s,t as d,i as v,a as e,F as y,j as O,k as V,O as M,r as p,b as f}from"./index.js";const A=_({name:"Error",data(){return{errorSingle:null,errMsg:""}},mounted(){this.errorSingle=new i({select:this.$refs.errorSingle,events:{error:t=>{this.errMsg=t.message}}})}}),k={id:"error",class:"content"},j=e("h2",{class:"header"},"error",-1),F=e("p",null,"The error event is fired when an error occurs. The error message is passed as the first argument.",-1),T=e("div",{class:"alert info"}," If you are are having issues with slim select finding the select element. Try delaying new SlimSelect() call as the select dom element might not be available yet. ",-1),E={key:0},x=e("b",null,"Error:",-1),B={class:"row"},D={ref:"notError"},L=e("option",{value:"1"},"Option 1",-1),N=e("option",{value:"2"},"Option 2",-1),P=e("option",{value:"3"},"Option 3",-1),R=[L,N,P],H=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
|
|
2
2
|
var select = new SlimSelect({
|
|
3
3
|
select: '#selectElement',
|
|
4
4
|
events: {
|
|
@@ -7,8 +7,8 @@ import{d as _,S as r,_ as g,o as a,c as l,f as n,t as d,i as v,a as e,F as O,j a
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
})
|
|
10
|
-
`),
|
|
11
|
-
`)],-1);function
|
|
10
|
+
`),s(`
|
|
11
|
+
`)],-1);function I(t,n,c,h,u,o){return l(),r("div",k,[j,F,T,t.errMsg!==""?(l(),r("div",E,[x,s(" "+d(t.errMsg),1)])):v("",!0),e("div",B,[e("select",D,R,512)]),H])}const J=g(A,[["render",I]]),U=_({name:"BeforeAfterChange",data(){return{beforeChangeSingle:[],beforeChangeMultiple:[],afterChangeSingle:[],afterChangeMultiple:[]}},mounted(){new i({select:this.$refs.beforeChangeSingle,settings:{allowDeselect:!0},events:{beforeChange:(t,n)=>(this.beforeChangeSingle=n,!0)}}),new i({select:this.$refs.beforeChangeMultiple,events:{beforeChange:(t,n)=>(this.beforeChangeMultiple=n,!0)}}),new i({select:this.$refs.afterChangeSingle,settings:{allowDeselect:!0},events:{afterChange:t=>{this.afterChangeSingle=t}}}),new i({select:this.$refs.afterChangeMultiple,events:{afterChange:t=>{this.afterChangeMultiple=t}}})}}),z={id:"beforeChange",class:"content"},q=e("h2",{class:"header"},"beforeChange",-1),G=e("p",null," beforeOnChange will trigger a callback on an option click and will allow you the ability to halt if the value it produces isnt to your liking. In order to stop the change from happening just return false on the callback. Returning nothing or true will allow it to continue as normal. ",-1),K=e("div",{class:"alert info"}," Be sure to return true to allow for the change to happen. False or nothing to cancel change. ",-1),Q={key:0},W={ref:"beforeChangeSingle"},X=e("option",{"data-placeholder":"true"},"Select Option",-1),Y=e("option",{value:"value1"},"Value 1",-1),Z=e("option",{value:"value2"},"Value 2",-1),ee=e("option",{value:"value3"},"Value 3",-1),te=[X,Y,Z,ee],ne=e("br",null,null,-1),se={key:1},oe={ref:"beforeChangeMultiple",multiple:""},ae=e("option",{value:"value1",selected:""},"Value 1",-1),le=e("option",{value:"value2"},"Value 2",-1),re=e("option",{value:"value3"},"Value 3",-1),ie=[ae,le,re],ce=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
|
|
12
12
|
new SlimSelect({
|
|
13
13
|
select: '#selectElement',
|
|
14
14
|
events: {
|
|
@@ -18,8 +18,8 @@ import{d as _,S as r,_ as g,o as a,c as l,f as n,t as d,i as v,a as e,F as O,j a
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
})
|
|
21
|
-
`),
|
|
22
|
-
`)],-1),
|
|
21
|
+
`),s(`
|
|
22
|
+
`)],-1),he={id:"afterChange",class:"content"},ue=e("h2",{class:"header"},"afterChange",-1),de=e("p",null,"afterChange will trigger a callback after the value of the select dropdown has changed.",-1),_e={key:0},pe={ref:"afterChangeSingle"},fe=e("option",{"data-placeholder":"true"},"Select Option",-1),ge=e("option",{value:"value1"},"Value 1",-1),ve=e("option",{value:"value2"},"Value 2",-1),me=e("option",{value:"value3"},"Value 3",-1),$e=[fe,ge,ve,me],be=e("br",null,null,-1),Se={key:1},Ce={ref:"afterChangeMultiple",multiple:""},we=e("option",{value:"value1",selected:""},"Value 1",-1),Oe=e("option",{value:"value2"},"Value 2",-1),ye=e("option",{value:"value3"},"Value 3",-1),Ve=[we,Oe,ye],Me=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
|
|
23
23
|
new SlimSelect({
|
|
24
24
|
select: '#selectElement',
|
|
25
25
|
events: {
|
|
@@ -28,8 +28,8 @@ import{d as _,S as r,_ as g,o as a,c as l,f as n,t as d,i as v,a as e,F as O,j a
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
})
|
|
31
|
-
`),
|
|
32
|
-
`)],-1);function
|
|
31
|
+
`),s(`
|
|
32
|
+
`)],-1);function Ae(t,n,c,h,u,o){return l(),r(y,null,[e("div",z,[q,G,K,t.beforeChangeSingle?(l(),r("div",Q,[e("strong",null,"Before change: "+d(t.beforeChangeSingle),1)])):v("",!0),e("select",W,te,512),ne,t.beforeChangeMultiple?(l(),r("div",se,[e("strong",null,"Before change: "+d(t.beforeChangeMultiple),1)])):v("",!0),e("select",oe,ie,512),ce]),e("div",he,[ue,de,t.afterChangeSingle?(l(),r("div",_e,[e("strong",null,"After change: "+d(t.afterChangeSingle),1)])):v("",!0),e("select",pe,$e,512),be,t.afterChangeMultiple?(l(),r("div",Se,[e("strong",null,"After change: "+d(t.afterChangeMultiple),1)])):v("",!0),e("select",Ce,Ve,512),Me])],64)}const ke=g(U,[["render",Ae]]),je=_({name:"BeForeAfterOpenClose",data(){return{beforeAfterOpenCloseSingle:null,singleState:"",beforeAfterOpenCloseMultiple:null,multipleState:""}},mounted(){this.beforeAfterOpenCloseSingle=new i({select:this.$refs.beforeAfterOpenCloseSingle,events:{beforeOpen:()=>{this.setState("single","beforeOpen")},afterOpen:()=>{this.setState("single","afterOpen")},beforeClose:()=>{this.setState("single","beforeClose")},afterClose:()=>{this.setState("single","afterClose")}}}),this.beforeAfterOpenCloseMultiple=new i({select:this.$refs.beforeAfterOpenCloseMultiple,events:{beforeOpen:()=>{this.setState("multiple","beforeOpen")},afterOpen:()=>{this.setState("multiple","afterOpen")},beforeClose:()=>{this.setState("multiple","beforeClose")},afterClose:()=>{this.setState("multiple","afterClose")}}})},methods:{setState(t,n){t==="single"?this.singleState=n:this.multipleState=n,setTimeout(()=>{t==="single"?this.singleState="":this.multipleState=""},1e3)}}}),Fe={id:"open",class:"content"},Te=e("h2",{class:"header"},"beforeOpen / afterOpen / beforeClose / afterClose",-1),Ee=e("p",null," The beforeOpen, afterOpen, beforeClose, and afterClose events will fire before and after the select is opened and closed. ",-1),xe={class:"row"},Be={ref:"beforeAfterOpenCloseSingle"},De=e("option",{value:"value1"},"Value 1",-1),Le=e("option",{value:"value2"},"Value 2",-1),Ne=e("option",{value:"value3"},"Value 3",-1),Pe=[De,Le,Ne],Re={ref:"beforeAfterOpenCloseMultiple",multiple:""},He=e("option",{value:"value1"},"Value 1",-1),Ie=e("option",{value:"value2"},"Value 2",-1),Je=e("option",{value:"value3"},"Value 3",-1),Ue=[He,Ie,Je],ze=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
|
|
33
33
|
var select = new SlimSelect({
|
|
34
34
|
select: '#selectElement',
|
|
35
35
|
events: {
|
|
@@ -47,8 +47,8 @@ import{d as _,S as r,_ as g,o as a,c as l,f as n,t as d,i as v,a as e,F as O,j a
|
|
|
47
47
|
},
|
|
48
48
|
},
|
|
49
49
|
})
|
|
50
|
-
`),
|
|
51
|
-
`)],-1);function
|
|
50
|
+
`),s(`
|
|
51
|
+
`)],-1);function qe(t,n,c,h,u,o){return l(),r("div",Fe,[Te,Ee,e("div",xe,[e("div",null,[e("div",null,"State: "+d(t.singleState),1),e("select",Be,Pe,512)]),e("div",null,[e("div",null,"State: "+d(t.multipleState),1),e("select",Re,Ue,512)])]),ze])}const Ge=g(je,[["render",qe]]),Ke={id:"search",class:"content"},Qe=e("h2",{class:"header"},"search",-1),We=e("p",null,[s(" Slim select allows you to syncronize result values from your promise response."),e("br"),s(" Call callback() method with slimselect data, false or string with specific string. ")],-1),Xe={class:"row"},Ye=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
|
|
52
52
|
new SlimSelect({
|
|
53
53
|
select: '#selectElement',
|
|
54
54
|
events: {
|
|
@@ -76,13 +76,20 @@ import{d as _,S as r,_ as g,o as a,c as l,f as n,t as d,i as v,a as e,F as O,j a
|
|
|
76
76
|
})
|
|
77
77
|
.then((response) => response.json())
|
|
78
78
|
.then((data) => {
|
|
79
|
-
// Take data and
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
// Take the data and create an array of options
|
|
80
|
+
// excluding any that are already selected in currentData
|
|
81
|
+
const options = data
|
|
82
|
+
.filter((person) => {
|
|
83
|
+
return !currentData.some((optionData) => {
|
|
84
|
+
return optionData.value === \`\${person.first_name} \${person.last_name}\`
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
.map((person) => {
|
|
88
|
+
return {
|
|
89
|
+
text: \`\${person.first_name} \${person.last_name}\`,
|
|
90
|
+
value: \`\${person.first_name} \${person.last_name}\`,
|
|
91
|
+
}
|
|
92
|
+
})
|
|
86
93
|
|
|
87
94
|
resolve(options)
|
|
88
95
|
})
|
|
@@ -90,8 +97,8 @@ import{d as _,S as r,_ as g,o as a,c as l,f as n,t as d,i as v,a as e,F as O,j a
|
|
|
90
97
|
}
|
|
91
98
|
}
|
|
92
99
|
})
|
|
93
|
-
`),
|
|
94
|
-
`)],-1),
|
|
100
|
+
`),s(`
|
|
101
|
+
`)],-1),Ze=_({__name:"search",setup(t){let n=[],c=O(null),h=O(null);fetch("https://api.gofakeit.com/json",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"array",rowcount:1e3,indent:!1,fields:[{name:"first_name",function:"firstname",params:{}},{name:"last_name",function:"lastname",params:{}}]})}).then(o=>o.json()).then(o=>{n=o}),V(()=>{new i({select:c.value,settings:{placeholderText:"Search First or Last Name",searchingText:"Searching Users...",searchHighlight:!0},events:{search:u}}),new i({select:h.value,settings:{placeholderText:"Search First or Last Name",searchingText:"Searching Users...",searchHighlight:!0},events:{search:u}})});function u(o,m){return new Promise((S,$)=>{if(o.length<2)return $("Search must be at least 2 characters");const b=n.filter(a=>a.first_name.toLowerCase().includes(o.toLowerCase())||a.last_name.toLowerCase().includes(o.toLowerCase()));if(b.length===0)return $("No results found");const C=b.filter(a=>!m.some(w=>w instanceof M&&w.value===`${a.first_name} ${a.last_name}`)).map(a=>({text:`${a.first_name} ${a.last_name}`,value:`${a.first_name} ${a.last_name}`}));setTimeout(()=>{S(C)},300)})}return(o,m)=>(l(),r("div",Ke,[Qe,We,e("div",Xe,[e("select",{ref_key:"searchSingle",ref:c},null,512),e("select",{ref_key:"searchMultiple",ref:h,multiple:""},null,512)]),Ye]))}}),et=_({name:"SearchFilter",mounted(){new i({select:this.$refs.searchFilter,events:{searchFilter:(t,n)=>t.text.substr(0,n.length)===n}})}}),tt={id:"searchFilter",class:"content"},nt=e("h2",{class:"header"},"searchFilter",-1),st=e("p",null,"searchFilter event is used to replace the default matching algorithm.",-1),ot=e("p",null,[s("See Data for the proper object interface of "),e("em",null,"option"),s(".")],-1),at={ref:"searchFilter"},lt=e("option",{value:"apple"},"Apple",-1),rt=e("option",{value:"orange"},"Orange",-1),it=e("option",{value:"pineapple"},"Pineapple",-1),ct=[lt,rt,it],ht=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
|
|
95
102
|
new SlimSelect({
|
|
96
103
|
select: '#selectElement',
|
|
97
104
|
events: {
|
|
@@ -101,8 +108,8 @@ import{d as _,S as r,_ as g,o as a,c as l,f as n,t as d,i as v,a as e,F as O,j a
|
|
|
101
108
|
}
|
|
102
109
|
}
|
|
103
110
|
})
|
|
104
|
-
`),
|
|
105
|
-
`)],-1);function
|
|
111
|
+
`),s(`
|
|
112
|
+
`)],-1);function ut(t,n,c,h,u,o){return l(),r("div",tt,[nt,st,ot,e("select",at,ct,512),ht])}const dt=g(et,[["render",ut]]),_t=_({name:"Addable",mounted(){new i({select:this.$refs.addableSingle,events:{addable:t=>({text:t,value:t.toLowerCase()})}}),new i({select:this.$refs.addableMultiple,events:{addable:t=>new Promise(n=>{setTimeout(()=>{n({text:t,value:t})},100)})}})}}),pt={id:"addable",class:"content"},ft=e("h2",{class:"header"},"addable",-1),gt=e("p",null,"Slim select has the ability to dynamically add options via the search input field",-1),vt=e("p",null," addable is a callback which takes a function parameter. The return value can either be a string or an option object. ",-1),mt={class:"row"},$t={ref:"addableSingle"},bt=e("option",{value:"value1"},"Value 1",-1),St=e("option",{value:"value2"},"Value 2",-1),Ct=e("option",{value:"value3"},"Value 3",-1),wt=[bt,St,Ct],Ot={ref:"addableMultiple",multiple:""},yt=e("option",{value:"value1"},"Value 1",-1),Vt=e("option",{value:"value2"},"Value 2",-1),Mt=e("option",{value:"value3"},"Value 3",-1),At=[yt,Vt,Mt],kt=e("pre",null,[s(" "),e("code",{class:"language-javascript"},`
|
|
106
113
|
new SlimSelect({
|
|
107
114
|
select: '#selectElement',
|
|
108
115
|
|
|
@@ -114,13 +121,22 @@ import{d as _,S as r,_ as g,o as a,c as l,f as n,t as d,i as v,a as e,F as O,j a
|
|
|
114
121
|
// Return the value string
|
|
115
122
|
return value // Optional - value alteration // ex: value.toLowerCase()
|
|
116
123
|
|
|
117
|
-
// Optional - Return a valid data object.
|
|
124
|
+
// Optional - Return a valid data object.
|
|
125
|
+
// See methods/setData for list of valid options
|
|
118
126
|
return {
|
|
119
127
|
text: value,
|
|
120
128
|
value: value.toLowerCase()
|
|
121
129
|
}
|
|
130
|
+
|
|
131
|
+
// Optional - Return a promise with either a string or data object
|
|
132
|
+
return new Promise((resolve) => {
|
|
133
|
+
resolve({
|
|
134
|
+
text: value,
|
|
135
|
+
value: value,
|
|
136
|
+
})
|
|
137
|
+
})
|
|
122
138
|
}
|
|
123
139
|
}
|
|
124
140
|
})
|
|
125
|
-
`),
|
|
126
|
-
`)],-1);function
|
|
141
|
+
`),s(`
|
|
142
|
+
`)],-1);function jt(t,n,c,h,u,o){return l(),r("div",pt,[ft,gt,vt,e("div",mt,[e("select",$t,wt,512),e("select",Ot,At,512)]),kt])}const Ft=g(_t,[["render",jt]]),Tt=_({name:"Events",components:{Error:J,BeforeAfterChange:ke,BeforeAfterOpenClose:Ge,Search:Ze,SearchFilter:dt,Addable:Ft}}),Et={id:"events",class:"contents"};function xt(t,n,c,h,u,o){const m=p("Error"),S=p("BeforeAfterChange"),$=p("BeforeAfterOpenClose"),b=p("Search"),C=p("SearchFilter"),a=p("Addable");return l(),r("div",Et,[f(m),f(S),f($),f(b),f(C),f(a)])}const Dt=g(Tt,[["render",xt]]);export{Dt as default};
|
package/docs/assets/index4.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as u,S as i,_ as r,o,c as a,a as e,f as l,t as $,i as g,
|
|
1
|
+
import{d as u,S as i,_ as r,o,c as a,a as e,f as l,t as $,i as g,e as y,r as c,b as d,w}from"./index.js";const M=u({name:"GetSelected",data(){return{selectedSingle:null,selectedSingleValue:[],selectedMultiple:null,selectedMultipleValue:[]}},mounted(){this.selectedSingle=new i({select:this.$refs.selectedSingle}),this.selectedMultiple=new i({select:this.$refs.selectedMultiple})},methods:{getSelected(){this.selectedSingleValue=this.selectedSingle.getSelected(),this.selectedMultipleValue=this.selectedMultiple.getSelected()}}}),E={id:"getSelected",class:"content"},k=e("h2",{class:"header"},"getSelected",-1),O=e("p",null,"The getSelected method will return an array of the currently selected value strings.",-1),C=e("div",{class:"alert info"}," Whether or not its a single or multiple select, getSelected will always return an array. ",-1),G={class:"row"},T={ref:"selectedSingle"},j=e("option",{value:"value1"},"Value 1",-1),N=e("option",{value:"value2"},"Value 2",-1),B=e("option",{value:"value3"},"Value 3",-1),W=[j,N,B],I={key:0,class:"pad-t-m pad-b-m"},A=e("b",null,"Single Select Value:",-1),J={ref:"selectedMultiple",multiple:""},P=e("option",{value:"value1"},"Value 1",-1),Y=e("option",{value:"value2",selected:""},"Value 2",-1),q=e("option",{value:"value3",selected:""},"Value 3",-1),z=[P,Y,q],F={key:0,class:"pad-t-m pad-b-m"},H=e("b",null,"Multi Select Value:",-1),K=e("pre",null,[l(" "),e("code",{class:"language-javascript"},`
|
|
2
2
|
var select = new SlimSelect({
|
|
3
3
|
select: '#selectElement'
|
|
4
4
|
})
|
package/docs/assets/index5.js
CHANGED
|
@@ -1,11 +1,149 @@
|
|
|
1
|
-
import{d as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import{d as m,S as O,_,o as c,c as d,l as y,r as g,a as e,b as s,w as i,f as n,t as r,i as C,F as S,h as f}from"./index.js";const b=m({name:"SlimSelect",props:{data:{type:Array},settings:{type:Object},events:{type:Object}},data(){return{slim:null}},mounted(){let t={select:this.$refs.slim};this.data&&(t.data=this.data),this.settings&&(t.settings=this.settings),this.events&&(t.events=this.events),this.slim=new O(t)},beforeUnmount(){this.slim&&this.slim.destroy()},watch:{data:{handler:function(t){this.slim&&this.slim.setData(t)},deep:!0}},methods:{getSlimSelect(){return this.slim}}}),w={ref:"slim"};function D(t,o,p,u,h,v){return c(),d("select",w,[y(t.$slots,"default")],512)}const $=_(b,[["render",D]]),V=m({name:"Vue",components:{SlimSelect:$},data(){return{settings:{showSearch:!1},data:[{value:"value1",text:"Value 1"},{value:"value2",text:"Value 2"},{value:"value3",text:"Value 3"}],dynamicData:[],afterChangeData:[],events:{afterChange:this.afterChange}}},mounted(){},methods:{changeData(){this.$refs.dataSingle.getSlimSelect().open(),this.$refs.dataMultiple.getSlimSelect().open(),setTimeout(()=>{this.data=[{value:"value4",text:"Value 4"},{value:"value5",text:"Value 5"},{value:"value6",text:"Value 6"}]},500)},afterChange(t){this.afterChangeData=t},randomDynamicData(){fetch("https://api.gofakeit.com/json",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:"array",rowcount:20,indent:!1,fields:[{name:"key",function:"password",params:{lower:!0,upper:!0,numeric:!0,special:!1,space:!1,length:10}},{name:"first_name",function:"firstname",params:{}},{name:"last_name",function:"lastname",params:{}},{name:"selected",function:"number",params:{min:1,max:10}}]})}).then(t=>t.json()).then(t=>{this.dynamicData=t.map(o=>({id:o.id,text:`${o.first_name} ${o.last_name}`,value:`${o.first_name} ${o.last_name}`,selected:o.selected>=8}))})}}}),j={id:"vue",class:"content"},x=e("h2",{class:"header"},"Vue",-1),k=e("h3",null,"Install",-1),M=e("p",null,"The vue component is in a sub package under SlimSelect",-1),T=e("pre",null,[n(" "),e("code",{class:"language-bash"},`
|
|
2
|
+
npm install @slim-select/vue
|
|
3
|
+
`),n(`
|
|
4
|
+
`)],-1),N=e("br",null,null,-1),B=e("h3",null,"Simple example",-1),E={class:"row"},F=e("option",{value:"1"},"Option 1",-1),R=e("option",{value:"2"},"Option 2",-1),A=e("option",{value:"3"},"Option 3",-1),I=e("option",{value:"1"},"Option 1",-1),J=e("option",{value:"2"},"Option 2",-1),L=e("option",{value:"3"},"Option 3",-1),P=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
|
|
5
|
+
import { defineComponent } from 'vue'
|
|
6
|
+
import SlimSelect from '@slim-select/vue'
|
|
7
|
+
|
|
8
|
+
export default defineComponent({
|
|
9
|
+
components: {
|
|
10
|
+
SlimSelect,
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
`),n(`
|
|
14
|
+
`)],-1),U=e("pre",null,[n(" "),e("code",{class:"language-html"},`
|
|
15
|
+
<SlimSelect>
|
|
16
|
+
<option value="1">Option 1</option>
|
|
17
|
+
<option value="2">Option 2</option>
|
|
18
|
+
<option value="3">Option 3</option>
|
|
19
|
+
</SlimSelect>
|
|
20
|
+
|
|
21
|
+
<SlimSelect multiple>
|
|
22
|
+
<option value="1">Option 1</option>
|
|
23
|
+
<option value="2">Option 2</option>
|
|
24
|
+
<option value="3">Option 3</option>
|
|
25
|
+
</SlimSelect>
|
|
26
|
+
`),n(`
|
|
27
|
+
`)],-1),Y=e("br",null,null,-1),q=e("div",{class:"separator"},null,-1),z=e("br",null,null,-1),G=e("h3",null,"Settings",-1),H=e("p",null," Settings just like its passed as an object in normal SlimSelct will also be passed as an object to the component prop ",-1),K={class:"row"},Q=e("option",{value:"1"},"Option 1",-1),W=e("option",{value:"2"},"Option 2",-1),X=e("option",{value:"3"},"Option 3",-1),Z=e("option",{value:"1"},"Option 1",-1),ee=e("option",{value:"2"},"Option 2",-1),te=e("option",{value:"3"},"Option 3",-1),ne=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
|
|
28
|
+
import { defineComponent } from 'vue'
|
|
29
|
+
import SlimSelect from '@slim-select/vue'
|
|
30
|
+
|
|
31
|
+
export default defineComponent({
|
|
32
|
+
components: {
|
|
33
|
+
SlimSelect,
|
|
34
|
+
},
|
|
35
|
+
data() {
|
|
36
|
+
return {
|
|
37
|
+
settings: {
|
|
38
|
+
showSearch: false,
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
`),n(`
|
|
44
|
+
`)],-1),oe=e("pre",null,[n(" "),e("code",{class:"language-html"},`
|
|
45
|
+
<SlimSelect :settings="settings">
|
|
46
|
+
<option value="1">Option 1</option>
|
|
47
|
+
<option value="2">Option 2</option>
|
|
48
|
+
<option value="3">Option 3</option>
|
|
49
|
+
</SlimSelect>
|
|
50
|
+
|
|
51
|
+
<SlimSelect :settings="settings" multiple>
|
|
52
|
+
<option value="1">Option 1</option>
|
|
53
|
+
<option value="2">Option 2</option>
|
|
54
|
+
<option value="3">Option 3</option>
|
|
55
|
+
</SlimSelect>
|
|
56
|
+
`),n(`
|
|
57
|
+
`)],-1),le=e("br",null,null,-1),ae=e("div",{class:"separator"},null,-1),se=e("br",null,null,-1),ie=e("h3",null,"Data",-1),ce=e("p",null," Data just like its passed as an array in normal SlimSelct will also be passed as an array to the component prop. ",-1),de=e("div",{class:"alert info"}," You may pass data as a prop if you would like. But you can also have reactive options that when options change the select will update as well. See Reactivity below for more info. ",-1),pe={class:"row"},ue=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
|
|
58
|
+
import { defineComponent } from 'vue'
|
|
59
|
+
import SlimSelect from '@slim-select/vue'
|
|
60
|
+
|
|
61
|
+
export default defineComponent({
|
|
62
|
+
components: {
|
|
63
|
+
SlimSelect,
|
|
64
|
+
},
|
|
65
|
+
data() {
|
|
66
|
+
return {
|
|
67
|
+
data: [
|
|
68
|
+
{ value: 'value1', text: 'Value 1' },
|
|
69
|
+
{ value: 'value2', text: 'Value 2' },
|
|
70
|
+
{ value: 'value3', text: 'Value 3' },
|
|
71
|
+
],
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
`),n(`
|
|
76
|
+
`)],-1),re=e("pre",null,[n(" "),e("code",{class:"language-html"},`
|
|
77
|
+
<SlimSelect :data="data" />
|
|
78
|
+
|
|
79
|
+
<SlimSelect :data="data" multiple />
|
|
80
|
+
`),n(`
|
|
81
|
+
`)],-1),me=e("br",null,null,-1),_e=e("div",{class:"separator"},null,-1),he=e("br",null,null,-1),ve=e("h3",null,"Events",-1),Se=e("p",null," Events just like its passed as an object in normal SlimSelct will also be passed as an object to the component prop. ",-1),fe={key:0},ge=e("strong",null,"afterChange:",-1),Oe={class:"row"},ye=e("option",{value:"1"},"Option 1",-1),Ce=e("option",{value:"2"},"Option 2",-1),be=e("option",{value:"3"},"Option 3",-1),we=e("option",{value:"1"},"Option 1",-1),De=e("option",{value:"2"},"Option 2",-1),$e=e("option",{value:"3"},"Option 3",-1),Ve=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
|
|
82
|
+
import { defineComponent } from 'vue'
|
|
83
|
+
import SlimSelect from '@slim-select/vue'
|
|
84
|
+
|
|
85
|
+
export default defineComponent({
|
|
86
|
+
components: {
|
|
87
|
+
SlimSelect,
|
|
88
|
+
},
|
|
89
|
+
data() {
|
|
90
|
+
return {
|
|
91
|
+
events: {
|
|
92
|
+
afterChange: this.afterChange,
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
methods: {
|
|
97
|
+
afterChange(newVal) {
|
|
98
|
+
console.log(newVal)
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
})
|
|
102
|
+
`),n(`
|
|
103
|
+
`)],-1),je=e("pre",null,[n(" "),e("code",{class:"language-html"},`
|
|
104
|
+
<SlimSelect :events="events">
|
|
105
|
+
<option value="1">Option 1</option>
|
|
106
|
+
<option value="2">Option 2</option>
|
|
107
|
+
<option value="3">Option 3</option>
|
|
108
|
+
</SlimSelect>
|
|
109
|
+
|
|
110
|
+
<SlimSelect :events="events" multiple>
|
|
111
|
+
<option value="1">Option 1</option>
|
|
112
|
+
<option value="2">Option 2</option>
|
|
113
|
+
<option value="3">Option 3</option>
|
|
114
|
+
</SlimSelect>
|
|
115
|
+
`),n(`
|
|
116
|
+
`)],-1),xe=e("br",null,null,-1),ke=e("div",{class:"separator"},null,-1),Me=e("br",null,null,-1),Te=e("h3",null,"Reactivity",-1),Ne=e("p",null," Slim select will look out for any options changes that happen to the select options and SlimSelect will update accordingly. This is done via mutation observers. ",-1),Be={class:"row"},Ee=["value","selected"],Fe=["value","selected"],Re=e("pre",null,[n(" "),e("code",{class:"language-javascript"},`
|
|
117
|
+
import { defineComponent } from 'vue'
|
|
118
|
+
import SlimSelect from '@slim-select/vue'
|
|
119
|
+
|
|
120
|
+
export default defineComponent({
|
|
121
|
+
components: {
|
|
122
|
+
SlimSelect,
|
|
123
|
+
},
|
|
124
|
+
data() {
|
|
125
|
+
return {
|
|
126
|
+
dynamicData: []
|
|
7
127
|
}
|
|
8
|
-
}
|
|
128
|
+
},
|
|
129
|
+
methods: {
|
|
130
|
+
changeData() {
|
|
131
|
+
this.dynamicData = [
|
|
132
|
+
{ id: 1, value: 1, text: 'Option 1', selected: true },
|
|
133
|
+
{ id: 2, value: 2, text: 'Option 2', selected: false },
|
|
134
|
+
{ id: 3, value: 3, text: 'Option 3', selected: false },
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
},
|
|
9
138
|
})
|
|
10
|
-
`),
|
|
11
|
-
`)],-1)
|
|
139
|
+
`),n(`
|
|
140
|
+
`)],-1),Ae=e("pre",null,[n(" "),e("code",{class:"language-html"},`
|
|
141
|
+
<SlimSelect :events="events">
|
|
142
|
+
<option v-for="d in dynamicData" :key="d.id" :value="d.value" :selected="d.selected">{{ d.text }}</option>
|
|
143
|
+
</SlimSelect>
|
|
144
|
+
|
|
145
|
+
<SlimSelect :events="events" multiple>
|
|
146
|
+
<option v-for="d in dynamicData" :value="d.value" :selected="d.selected">{{ d.text }}</option>
|
|
147
|
+
</SlimSelect>
|
|
148
|
+
`),n(`
|
|
149
|
+
`)],-1);function Ie(t,o,p,u,h,v){const l=g("SlimSelect");return c(),d("div",j,[x,k,M,T,N,B,e("div",E,[s(l,null,{default:i(()=>[F,R,A]),_:1}),s(l,{multiple:""},{default:i(()=>[I,J,L]),_:1})]),P,U,Y,q,z,G,H,e("div",K,[s(l,{settings:t.settings},{default:i(()=>[Q,W,X]),_:1},8,["settings"]),s(l,{settings:t.settings,multiple:""},{default:i(()=>[Z,ee,te]),_:1},8,["settings"])]),ne,oe,le,ae,se,ie,ce,de,e("div",pe,[e("div",{class:"btn info",onClick:o[0]||(o[0]=(...a)=>t.changeData&&t.changeData(...a))},"Change data"),s(l,{ref:"dataSingle",data:t.data},null,8,["data"]),s(l,{ref:"dataMultiple",data:t.data,multiple:""},null,8,["data"])]),ue,re,me,_e,he,ve,Se,t.afterChangeData.length?(c(),d("div",fe,[ge,n(" "+r(t.afterChangeData),1)])):C("",!0),e("div",Oe,[s(l,{events:t.events},{default:i(()=>[ye,Ce,be]),_:1},8,["events"]),s(l,{events:t.events,multiple:""},{default:i(()=>[we,De,$e]),_:1},8,["events"])]),Ve,je,xe,ke,Me,Te,Ne,e("div",Be,[e("div",{class:"btn info",onClick:o[1]||(o[1]=(...a)=>t.randomDynamicData&&t.randomDynamicData(...a))},"Change data"),s(l,{ref:"randomDynamic"},{default:i(()=>[(c(!0),d(S,null,f(t.dynamicData,a=>(c(),d("option",{key:a.id,value:a.value,selected:a.selected},r(a.text),9,Ee))),128))]),_:1},512),s(l,{multiple:""},{default:i(()=>[(c(!0),d(S,null,f(t.dynamicData,a=>(c(),d("option",{value:a.value,selected:a.selected},r(a.text),9,Fe))),256))]),_:1})]),Re,Ae])}const Je=_(V,[["render",Ie]]),Le=m({name:"Events",components:{Vue:Je}}),Pe={id:"frameworks",class:"contents"};function Ue(t,o,p,u,h,v){const l=g("Vue");return c(),d("div",Pe,[s(l)])}const qe=_(Le,[["render",Ue]]);export{qe as default};
|
package/docs/assets/install.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{g as M,d as $,_ as I,o as O,c as V,a as o,f as B,t as E,e as L}from"./index.js";var R={exports:{}};(function(d,w){(function(y,v){d.exports=v()})(M,function(){return function y(v,k,j){var n=window,p="application/octet-stream",r=j||p,e=v,c=!k&&!j&&e,t=document.createElement("a"),_=function(s){return String(s)},i=n.Blob||n.MozBlob||n.WebKitBlob||_,m=k||"download",l,S;if(i=i.call?i.bind(n):Blob,String(this)==="true"&&(e=[e,r],r=e[0],e=e[1]),c&&c.length<2048&&(m=c.split("/").pop().split("?")[0],t.href=c,t.href.indexOf(c)!==-1)){var u=new XMLHttpRequest;return u.open("GET",c,!0),u.responseType="blob",u.onload=function(s){y(s.target.response,m,p)},setTimeout(function(){u.send()},0),u}if(/^data:([\w+-]+\/[\w+.-]+)?[,;]/.test(e))if(e.length>1024*1024*1.999&&i!==_)e=x(e),r=e.type||p;else return navigator.msSaveBlob?navigator.msSaveBlob(x(e),m):f(e);else if(/([\x80-\xff])/.test(e)){var b=0,C=new Uint8Array(e.length),N=C.length;for(b;b<N;++b)C[b]=e.charCodeAt(b);e=new i([C],{type:r})}l=e instanceof i?e:new i([e],{type:r});function x(s){var a=s.split(/[:;,]/),h=a[1],A=a[2]=="base64"?atob:decodeURIComponent,D=A(a.pop()),U=D.length,g=0,T=new Uint8Array(U);for(g;g<U;++g)T[g]=D.charCodeAt(g);return new i([T],{type:h})}function f(s,a){if("download"in t)return t.href=s,t.setAttribute("download",m),t.className="download-js-link",t.innerHTML="downloading...",t.style.display="none",document.body.appendChild(t),setTimeout(function(){t.click(),document.body.removeChild(t),a===!0&&setTimeout(function(){n.URL.revokeObjectURL(t.href)},250)},66),!0;if(/(Version)\/(\d+)\.(\d+)(?:\.(\d+))?.*Safari\//.test(navigator.userAgent))return/^data:/.test(s)&&(s="data:"+s.replace(/^data:([\w\/\-\+]+)/,p)),window.open(s)||confirm(`Displaying New Document
|
|
2
2
|
|
|
3
|
-
Use Save As... to download, then click back to return to this page.`)&&(location.href=s),!0;var h=document.createElement("iframe");document.body.appendChild(h),!a&&/^data:/.test(s)&&(s="data:"+s.replace(/^data:([\w\/\-\+]+)/,
|
|
3
|
+
Use Save As... to download, then click back to return to this page.`)&&(location.href=s),!0;var h=document.createElement("iframe");document.body.appendChild(h),!a&&/^data:/.test(s)&&(s="data:"+s.replace(/^data:([\w\/\-\+]+)/,p)),h.src=s,setTimeout(function(){document.body.removeChild(h)},333)}if(navigator.msSaveBlob)return navigator.msSaveBlob(l,m);if(n.URL)f(n.URL.createObjectURL(l),!0);else{if(typeof l=="string"||l.constructor===_)try{return f("data:"+r+";base64,"+n.btoa(l))}catch{return f("data:"+r+","+encodeURIComponent(l))}S=new FileReader,S.onload=function(s){f(this.result)},S.readAsDataURL(l)}return!0}})})(R);const H=R.exports,G="slim-select",J="Slim advanced select dropdown",q="2.2.0",z="Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",F="https://slimselectjs.com",K="MIT",W={url:"https://github.com/brianvoe/slim-select/issues"},X="dist/slimselect.ssr.js",P="dist/slimselect.umd.js",Q="dist/slimselect.es.js",Y="dist/slimselect.umd.min.js",Z="dist/index.d.ts",ee="dist/index.d.ts",se="dist/slimselect.css",te="src/slim-select/slimselect.scss",ne=["src/vue"],oe={type:"git",url:"git+https://github.com/brianvoe/slim-select.git"},ie=["select","vanilla","dropdown","search","multiselect"],le={dev:"vite --port=1111",format:'prettier --write --cache --parser typescript "src/**/*.ts"',build:"npm run build:clean && npm run build:docs && npm run build:library && npm run build:frameworks","build:clean":"rimraf ./dist/*","build:docs":"vite build","build:library":"npm run build:library:js && npm run build:library:css","build:library:js":"cd src/slim-select && rollup --config ./rollup.config.mjs && cd ../../","build:library:css":"cd src/slim-select && sass ./slimselect.scss ../../dist/slimselect.css --style=compressed && cd ../../","build:frameworks":"npm run build --workspaces",publish:"npm publish && npm publish --workspace=src/vue --access public",test:"jest"},re={"@jest/globals":"^29.3.1","@rollup/plugin-babel":"^6.0.2","@rollup/plugin-commonjs":"^23.0.2","@rollup/plugin-node-resolve":"^15.0.1","@rollup/plugin-terser":"^0.1.0","@rollup/plugin-typescript":"^9.0.2","@slim-select/vue":"workspace:src/vue","@types/downloadjs":"^1.4.3","@vitejs/plugin-vue":"^3.2.0",clipboard:"^2.0.11",downloadjs:"^1.4.7",jest:"^29.3.1","jest-environment-jsdom":"^29.3.1",prettier:"^2.7.1",prismjs:"^1.29.0",rimraf:"^3.0.2",rollup:"^2.79.1","rollup-plugin-typescript2":"^0.34.1","rollup-plugin-vue":"^6.0.0",sass:"^1.56.1","ts-jest":"^29.0.3",tslib:"^2.4.1",typescript:"^4.9.3",vite:"^3.2.4",vue:"^3.2.45","vue-router":"^4.1.6","vue-tsc":"^1.0.9",vuex:"^4.0.2"},ce={name:G,description:J,version:q,author:z,homepage:F,license:K,bugs:W,main:X,browser:P,module:Q,unpkg:Y,types:Z,typings:ee,style:se,sass:te,workspaces:ne,repository:oe,keywords:ie,scripts:le,devDependencies:re},ae=$({name:"Install",data:()=>({version:ce.version}),methods:{downloadLink(){H(`https://cdnjs.cloudflare.com/ajax/libs/slim-select/${this.version}/slimselect.min.js`)}}}),de={id:"install",class:"contents"},pe=L(`<div id="npm" class="content"><h2>Npm</h2><p>Most common usage is npm</p><pre class="install-code"> <code class="language-bash">
|
|
4
4
|
npm install slim-select
|
|
5
5
|
</code>
|
|
6
6
|
</pre><pre class="example-code"> <code class="language-javascript">
|
|
@@ -10,7 +10,7 @@ Use Save As... to download, then click back to return to this page.`)&&(location
|
|
|
10
10
|
select: '#selectElement'
|
|
11
11
|
})
|
|
12
12
|
</code>
|
|
13
|
-
</pre></div>`,1),me={id:"cdn",class:"content"},
|
|
13
|
+
</pre></div>`,1),me={id:"cdn",class:"content"},ue=L('<h2>Cdn</h2><p> Cdn has a url link you can grab. Cdn exists on both <a target="_blank" href="https://cdnjs.com">cdnjs.com</a> and <a target="_blank" href="https://unpkg.com">unpkg.com</a></p><p> See full list of available options.<br><strong>cdnjs</strong> - <a target="_blank" href="https://cdnjs.com/libraries/slim-select">cdnjs.com/libraries/slim-select</a><br><strong>unpkg</strong> - <a target="_blank" href="https://unpkg.com/browse/slim-select/dist/">https://unpkg.com/browse/slim-select/dist/</a></p><ul><li>slimselct.js - UMD unminified</li><li>slimselct.min.js - UMD minified</li><li>slimselect.cjs.js - CommonJS (for Node) and ES module (for bundlers) build</li><li>slimselect.umd.js - UMD build for browsers</li><li>slimselect.es.js - ES module build for modern browsers</li><li>slimselect.global.js - IIFE build for modern browsers</li></ul><div class="alert info">New releases may be delayed until the next time its indexed</div>',5),be={class:"install-code"},fe={class:"language-html"},he={id:"download",class:"content"},ge=o("h2",null,"Download",-1),ve=o("p",null,"Download the latest minified umd version of slim select",-1),we=o("p",null,[B(" See full list of available downloadable options. "),o("a",{target:"_blank",href:"https://cdnjs.com/libraries/slim-select"},"cdnjs.com/libraries/slim-select")],-1);function ye(d,w,y,v,k,j){return O(),V("div",de,[pe,o("div",me,[ue,o("pre",be,[B(" "),o("code",fe,`
|
|
14
14
|
<html>
|
|
15
15
|
<head>
|
|
16
16
|
<script src="unpkg.com/slim-select@`+E(d.version)+`/dist/slimselect.min.js"><\/script>
|
|
@@ -31,4 +31,4 @@ Use Save As... to download, then click back to return to this page.`)&&(location
|
|
|
31
31
|
</body>
|
|
32
32
|
</html>
|
|
33
33
|
`,1),B(`
|
|
34
|
-
`)])]),o("div",
|
|
34
|
+
`)])]),o("div",he,[ge,ve,we,o("div",{class:"btn",onClick:w[0]||(w[0]=n=>d.downloadLink())},"Click Here To Download")])])}const je=I(ae,[["render",ye]]);export{je as default};
|
package/docs/assets/selects.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as c,S as p,_ as v,o as a,c as s,a as e,F as n,
|
|
1
|
+
import{d as c,S as p,_ as v,o as a,c as s,a as e,F as n,h as i,f as l,t as r}from"./index.js";const b=c({name:"Selects",data(){return{states:[{abv:"AL",state:"Alabama"},{abv:"AK",state:"Alaska"},{abv:"AZ",state:"Arizona"},{abv:"AR",state:"Arkansas"},{abv:"CA",state:"California"},{abv:"CO",state:"Colorado"},{abv:"CT",state:"Connecticut"},{abv:"DE",state:"Delaware"},{abv:"FL",state:"Florida"},{abv:"GA",state:"Georgia"},{abv:"HI",state:"Hawaii"},{abv:"ID",state:"Idaho"},{abv:"IL",state:"Illinois"},{abv:"IN",state:"Indiana"},{abv:"IA",state:"Iowa"},{abv:"KS",state:"Kansas"},{abv:"KY",state:"Kentucky"},{abv:"LA",state:"Louisiana"},{abv:"ME",state:"Maine"},{abv:"MD",state:"Maryland"},{abv:"MA",state:"Massachusetts"},{abv:"MI",state:"Michigan"},{abv:"MN",state:"Minnesota"},{abv:"MS",state:"Mississippi"},{abv:"MO",state:"Missouri"},{abv:"MT",state:"Montana"},{abv:"NE",state:"Nebraska"},{abv:"NV",state:"Nevada"},{abv:"NH",state:"New Hampshire"},{abv:"NJ",state:"New Jersey"},{abv:"NM",state:"New Mexico"},{abv:"NY",state:"New York"},{abv:"NC",state:"North Carolina"},{abv:"ND",state:"North Dakota"},{abv:"OH",state:"Ohio"},{abv:"OK",state:"Oklahoma"},{abv:"OR",state:"Oregon"},{abv:"PA",state:"Pennsylvania"},{abv:"RI",state:"Rhode Island"},{abv:"SC",state:"South Carolina"},{abv:"SD",state:"South Dakota"},{abv:"TN",state:"Tennessee",selected:!0},{abv:"TX",state:"Texas"},{abv:"UT",state:"Utah"},{abv:"VT",state:"Vermont"},{abv:"VA",state:"Virginia"},{abv:"WA",state:"Washington"},{abv:"WV",state:"West Virginia"},{abv:"WI",state:"Wisconsin"},{abv:"WY",state:"Wyoming"}],foods:[{label:"Dairy",options:["Milk","Cheese","Butter","Ice Cream"]},{label:"Meat",options:["Beef","Ham","Pork","Sausage","Chicken","Turkey"]},{label:"Fruits",options:["Apple","Banana","Grape","Orange","Strawberry","Blueberry","Raspberry"]},{label:"Vegetables",options:["Carrot","Tomato","Broccoli","Celery","Corn","Pumpkin","Kale","Spinach"]}]}},mounted(){new p({select:this.$refs.single}),new p({select:this.$refs.singleOptgroup}),new p({select:this.$refs.multiple}),new p({select:this.$refs.multipleOptgroup}).setSelected(["Cheese","Apple","Corn"])}}),d={id:"selects",class:"contents"},h={id:"single",class:"content"},_=e("h2",{class:"header"},"Single",-1),g=e("p",null," Basic single select usage with Slim Select is extremely easy. Just set the select value to your select element. ",-1),m={class:"row"},V=e("h4",null,"Options",-1),y={ref:"single"},k=["value","selected"],M=e("h4",null,"Optgroups",-1),S={ref:"singleOptgroup"},N=["label"],O=["value"],f=e("pre",null,[l(" "),e("code",{class:"language-javascript"},`
|
|
2
2
|
new SlimSelect({
|
|
3
3
|
select: '#single'
|
|
4
4
|
})
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slim-select",
|
|
3
3
|
"description": "Slim advanced select dropdown",
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"author": "Brian Voelker <brian@webiswhatido.com> (http://webiswhatido.com)",
|
|
6
6
|
"homepage": "https://slimselectjs.com",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/brianvoe/slim-select/issues"
|
|
10
10
|
},
|
|
11
|
-
"main": "dist/slimselect.
|
|
11
|
+
"main": "dist/slimselect.ssr.js",
|
|
12
12
|
"browser": "dist/slimselect.umd.js",
|
|
13
13
|
"module": "dist/slimselect.es.js",
|
|
14
14
|
"unpkg": "dist/slimselect.umd.min.js",
|
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
"typings": "dist/index.d.ts",
|
|
17
17
|
"style": "dist/slimselect.css",
|
|
18
18
|
"sass": "src/slim-select/slimselect.scss",
|
|
19
|
+
"workspaces": [
|
|
20
|
+
"src/vue"
|
|
21
|
+
],
|
|
19
22
|
"repository": {
|
|
20
23
|
"type": "git",
|
|
21
24
|
"url": "git+https://github.com/brianvoe/slim-select.git"
|
|
@@ -30,12 +33,14 @@
|
|
|
30
33
|
"scripts": {
|
|
31
34
|
"dev": "vite --port=1111",
|
|
32
35
|
"format": "prettier --write --cache --parser typescript \"src/**/*.ts\"",
|
|
33
|
-
"build": "npm run build:clean && npm run build:docs && npm run build:library",
|
|
36
|
+
"build": "npm run build:clean && npm run build:docs && npm run build:library && npm run build:frameworks",
|
|
34
37
|
"build:clean": "rimraf ./dist/*",
|
|
35
38
|
"build:docs": "vite build",
|
|
36
39
|
"build:library": "npm run build:library:js && npm run build:library:css",
|
|
37
40
|
"build:library:js": "cd src/slim-select && rollup --config ./rollup.config.mjs && cd ../../",
|
|
38
41
|
"build:library:css": "cd src/slim-select && sass ./slimselect.scss ../../dist/slimselect.css --style=compressed && cd ../../",
|
|
42
|
+
"build:frameworks": "npm run build --workspaces",
|
|
43
|
+
"publish": "npm publish && npm publish --workspace=src/vue --access public",
|
|
39
44
|
"test": "jest"
|
|
40
45
|
},
|
|
41
46
|
"devDependencies": {
|
|
@@ -45,6 +50,7 @@
|
|
|
45
50
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
46
51
|
"@rollup/plugin-terser": "^0.1.0",
|
|
47
52
|
"@rollup/plugin-typescript": "^9.0.2",
|
|
53
|
+
"@slim-select/vue": "workspace:src/vue",
|
|
48
54
|
"@types/downloadjs": "^1.4.3",
|
|
49
55
|
"@vitejs/plugin-vue": "^3.2.0",
|
|
50
56
|
"clipboard": "^2.0.11",
|
|
@@ -55,6 +61,8 @@
|
|
|
55
61
|
"prismjs": "^1.29.0",
|
|
56
62
|
"rimraf": "^3.0.2",
|
|
57
63
|
"rollup": "^2.79.1",
|
|
64
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
65
|
+
"rollup-plugin-vue": "^6.0.0",
|
|
58
66
|
"sass": "^1.56.1",
|
|
59
67
|
"ts-jest": "^29.0.3",
|
|
60
68
|
"tslib": "^2.4.1",
|
package/src/docs/app.vue
CHANGED
|
@@ -55,7 +55,8 @@ export default defineComponent({
|
|
|
55
55
|
{ text: 'search', value: 'settings#search', class: 'mar-l-l' },
|
|
56
56
|
{ text: 'closeOnSelect', value: 'settings#closeOnSelect', class: 'mar-l-l' },
|
|
57
57
|
{ text: 'showOptionTooltips', value: 'settings#showOptionTooltips', class: 'mar-l-l' },
|
|
58
|
-
{ text: '
|
|
58
|
+
{ text: 'selectAll', value: 'settings#selectAll', class: 'mar-l-l' },
|
|
59
|
+
{ text: 'closable', value: 'settings#closable', class: 'mar-l-l' },
|
|
59
60
|
{ text: 'hideSelected', value: 'settings#hideSelected', class: 'mar-l-l' },
|
|
60
61
|
|
|
61
62
|
// Events
|
|
@@ -79,8 +80,8 @@ export default defineComponent({
|
|
|
79
80
|
{ text: 'destroy', value: 'methods#destroy', class: 'mar-l-l' },
|
|
80
81
|
|
|
81
82
|
// Frameworks
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
{ text: 'Frameworks', value: 'frameworks', class: 'label' },
|
|
84
|
+
{ text: 'vue', value: 'frameworks#vue', class: 'mar-l-l' },
|
|
84
85
|
],
|
|
85
86
|
}
|
|
86
87
|
},
|
|
@@ -196,10 +197,10 @@ export default defineComponent({
|
|
|
196
197
|
</div>
|
|
197
198
|
<div class="socials">
|
|
198
199
|
<a href="https://github.com/brianvoe/slim-select" target="_blank">
|
|
199
|
-
<img src="./images/github.png" />
|
|
200
|
+
<img src="./assets/images/github.png" />
|
|
200
201
|
</a>
|
|
201
202
|
<a href="https://www.npmjs.com/package/slim-select" target="_blank">
|
|
202
|
-
<img src="./images/npm.png" />
|
|
203
|
+
<img src="./assets/images/npm.png" />
|
|
203
204
|
</a>
|
|
204
205
|
</div>
|
|
205
206
|
</div>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|