Skip to content

Commit f34899e

Browse files
committed
Merge branch 'master' of https://github.com/yuche/vue-strap into gh-pages
2 parents d953e1a + 878d92f commit f34899e

File tree

8 files changed

+1598
-1184
lines changed

8 files changed

+1598
-1184
lines changed

build/build-docs.js

Lines changed: 883 additions & 717 deletions
Large diffs are not rendered by default.

build/build-docs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-strap.js

Lines changed: 592 additions & 426 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-strap.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-strap.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-strap",
3-
"version": "1.1.32",
3+
"version": "1.1.33",
44
"description": "Bootstrap components built with Vue.js",
55
"main": "dist/vue-strap.js",
66
"repository": {

src/Spinner.vue

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
</template>
99

1010
<script>
11-
// import styling
12-
import './utils/spinner.scss'
1311
import {coerce} from './utils/utils.js'
1412
1513
const MIN_WAIT = 500 // in ms
@@ -97,3 +95,82 @@ export default {
9795
}
9896
}
9997
</script>
98+
99+
<style>
100+
@keyframes spin {
101+
100% {
102+
transform: rotate(360deg);
103+
}
104+
}
105+
.spinner-gritcode {
106+
top: 0;
107+
left: 0;
108+
bottom: 0;
109+
right: 0;
110+
z-index: 9998;
111+
position: absolute;
112+
width: 100%;
113+
text-align: center;
114+
background: rgba(255, 255, 255, 0.9);
115+
}
116+
.spinner-gritcode.spinner-fixed {
117+
position: fixed;
118+
}
119+
.spinner-gritcode .spinner-wrapper {
120+
position: absolute;
121+
top: 50%;
122+
left: 50%;
123+
transform: translate(-50%, -50%);
124+
-ms-transform: translate(-50%, -50%);
125+
}
126+
.spinner-gritcode .spinner-circle {
127+
position: relative;
128+
border: 4px solid #ccc;
129+
border-right-color: #337ab7;
130+
border-radius: 50%;
131+
display: inline-block;
132+
animation: spin 0.6s linear;
133+
animation-iteration-count: infinite;
134+
width: 3em;
135+
height: 3em;
136+
z-index: 2;
137+
}
138+
.spinner-gritcode .spinner-text {
139+
position: relative;
140+
text-align: center;
141+
margin-top: 0.5em;
142+
z-index: 2;
143+
width: 100%;
144+
font-size: 95%;
145+
color: #337ab7;
146+
}
147+
.spinner-gritcode.spinner-sm .spinner-circle {
148+
width: 1.5em;
149+
height: 1.5em;
150+
}
151+
.spinner-gritcode.spinner-md .spinner-circle {
152+
width: 2em;
153+
height: 2em;
154+
}
155+
.spinner-gritcode.spinner-lg .spinner-circle {
156+
width: 2.5em;
157+
height: 2.5em;
158+
}
159+
.spinner-gritcode.spinner-xl .spinner-circle {
160+
width: 3.5em;
161+
height: 3.5em;
162+
}
163+
.lt-ie10 .spinner-gritcode .spinner-circle,
164+
.ie9 .spinner-gritcode .spinner-circle,
165+
.oldie .spinner-gritcode .spinner-circle,
166+
.no-csstransitions .spinner-gritcode .spinner-circle,
167+
.no-csstransforms3d .spinner-gritcode .spinner-circle {
168+
background: url("http://i2.wp.com/www.thegreatnovelingadventure.com/wp-content/plugins/wp-polls/images/loading.gif") center center no-repeat;
169+
animation: none;
170+
margin-left: 0;
171+
margin-top: 5px;
172+
border: none;
173+
width: 32px;
174+
height: 32px;
175+
}
176+
</style>

src/utils/NodeList.js

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@ class NodeList {
2929
}
3030
}
3131

32-
concat () {
32+
concat (...args) {
3333
let nodes = ArrayProto.slice.call(this)
3434
function flatten (arr) {
3535
ArrayProto.forEach.call(arr, el => {
3636
if (isNode(el)) {
3737
if (!~nodes.indexOf(el)) nodes.push(el)
38-
} else if (el) {
38+
} else if (isNodeList(el)) {
3939
flatten(el)
4040
}
4141
})
4242
}
43-
ArrayProto.forEach.call(arguments, arg => {
43+
ArrayProto.forEach.call(args, arg => {
4444
if (isNode(arg)) {
4545
if (!~nodes.indexOf(arg)) nodes.push(arg)
4646
} else if (isNodeList(arg)) {
@@ -63,12 +63,12 @@ class NodeList {
6363
if (notRemoved.length) console.warn('NodeList: Some nodes could not be deleted.')
6464
return notRemoved
6565
}
66-
each () {
67-
ArrayProto.forEach.apply(this, arguments)
66+
each (...args) {
67+
ArrayProto.forEach.apply(this, args)
6868
return this
6969
}
70-
filter () {
71-
return NodeListJS(ArrayProto.filter.apply(this, arguments), this)
70+
filter (...args) {
71+
return NodeListJS(ArrayProto.filter.apply(this, args), this)
7272
}
7373
find (element) {
7474
let nodes = []
@@ -79,15 +79,15 @@ class NodeList {
7979
if (element) return this.find(element).filter(el => this.includes(el.parentElement))
8080
return flatten(this.map(el => el.children))
8181
}
82-
forEach () {
83-
ArrayProto.forEach.apply(this, arguments)
82+
forEach (...args) {
83+
ArrayProto.forEach.apply(this, args)
8484
return this
8585
}
8686
includes (element, index) {
8787
return ~this.indexOf(element, index)
8888
}
89-
map () {
90-
var mapped = ArrayProto.map.apply(this, arguments)
89+
map (...args) {
90+
var mapped = ArrayProto.map.apply(this, args)
9191
return mapped.some(el => (isNode(el) || isNodeList(el))) ? flatten(mapped, this) : mapped
9292
}
9393
parent () {
@@ -100,8 +100,8 @@ class NodeList {
100100
while (amount--) nodes.push(pop())
101101
return NodeListJS(nodes, this)
102102
}
103-
push () {
104-
ArrayProto.forEach.call(arguments, arg => {
103+
push (...args) {
104+
ArrayProto.forEach.call(args, arg => {
105105
if (!isNode(arg)) throw nodeError
106106
if (!~this.indexOf(arg)) ArrayProto.push.call(this, arg)
107107
})
@@ -111,10 +111,10 @@ class NodeList {
111111
if (typeof amount !== 'number') { amount = 1 }
112112
let nodes = []
113113
while (amount--) nodes.push(ArrayProto.shift.call(this))
114-
return NodeListJS(nodes, this)
114+
return nodes.length == 1 ? nodes[0] : NodeListJS(nodes, this)
115115
}
116-
slice () {
117-
return NodeListJS(ArrayProto.slice.apply(this, arguments), this)
116+
slice (...args) {
117+
return NodeListJS(ArrayProto.slice.apply(this, args), this)
118118
}
119119
splice (...args) {
120120
for (let i = 2, l = args.length; i < l; i++) {
@@ -139,11 +139,19 @@ class NodeList {
139139
return this.toggleClass(classes, false)
140140
}
141141
toggleClass (classes, value) {
142-
const method = (value === undefined || value === null) ? 'toggle' : value ? 'add' : 'remove'
142+
var method = (value === undefined || value === null) ? 'toggle' : value ? 'add' : 'remove'
143143
if (typeof classes === 'string') {
144144
classes = classes.trim().replace(/\s+/, ' ').split(' ')
145145
}
146-
this.each(el => classes.forEach(c => el.classList[method](c)))
146+
this.each(el => {
147+
var list = el.className.trim().replace(/\s+/, ' ').split(' ')
148+
classes.forEach(c => {
149+
var hasClass = ~list.indexOf(c)
150+
if (!hasClass && method !== 'remove') list.push(c)
151+
if (hasClass && method !== 'add') { list = list.filter(el => (el !== c)) }
152+
})
153+
el.className = list
154+
})
147155
return this
148156
}
149157

@@ -159,11 +167,9 @@ class NodeList {
159167
if (prop.constructor === Object) {
160168
this.each(el => {
161169
if (el) {
162-
Object.keys(prop).forEach(key => {
163-
if (key in el) {
164-
el[key] = prop[key]
165-
}
166-
})
170+
for (let key in prop) {
171+
if (key in el) { el[key] = prop[key] }
172+
}
167173
}
168174
})
169175
} else {
@@ -345,17 +351,18 @@ function setterGetter (prop) {
345351
NL[prop] = (...args) => {
346352
let arr = []
347353
let returnThis = true
348-
Object.keys(NL).forEach(el => {
349-
if (NL[el] && NL[el][prop] instanceof Function) {
350-
NL[el] = NL[el][prop].apply(NL[el], args)
351-
arr.push(NL[el])
352-
if (returnThis && NL[el] !== undefined) {
354+
for (let i in NL) {
355+
let el = NL[i]
356+
if (el && el[prop] instanceof Function) {
357+
el = el[prop].apply(el, args)
358+
arr.push(el)
359+
if (returnThis && el !== undefined) {
353360
returnThis = false
354361
}
355362
} else {
356363
arr.push(undefined)
357364
}
358-
})
365+
}
359366
return returnThis ? this : flatten(arr, this)
360367
}
361368
} else {
@@ -378,9 +385,7 @@ function setterGetter (prop) {
378385
}
379386
for (let prop in div) setterGetter(prop)
380387

381-
function NodeListJS () {
382-
return new NodeList(arguments)
383-
}
388+
function NodeListJS (...args) { return new NodeList(args) }
384389
window.NL = NodeListJS
385390

386391
export default NodeListJS

0 commit comments

Comments
 (0)