Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a066590

Browse filesBrowse files
committed
Merge branch 'dev'
2 parents 93211e0 + 9c4da02 commit a066590
Copy full SHA for a066590

File tree

Expand file treeCollapse file tree

7 files changed

+55
-7
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+55
-7
lines changed

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@coreui/vue",
33
"description": "CoreUI Vue Bootstrap 4 layout components",
4-
"version": "3.1.2",
4+
"version": "3.1.3",
55
"license": "MIT",
66
"main": "dist/coreui-vue.common.js",
77
"types": "src/index.d.ts",

‎src/components/grid/CCol.vue

Copy file name to clipboardExpand all lines: src/components/grid/CCol.vue
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default {
1111
md: [ Boolean, String, Number, Object ],
1212
lg: [ Boolean, String, Number, Object ],
1313
xl: [ Boolean, String, Number, Object ],
14+
xxl: [ Boolean, String, Number, Object ],
1415
tag: {
1516
type: String,
1617
default: 'div'
@@ -24,7 +25,8 @@ export default {
2425
'sm': '-sm',
2526
'md': '-md',
2627
'lg': '-lg',
27-
'xl': '-xl'
28+
'xl': '-xl',
29+
'xxl': '-xxl',
2830
}
2931
Object.keys(suffixes).forEach((key) => {
3032
const prop = props[key]

‎src/components/grid/tests/CCol.spec.js

Copy file name to clipboardExpand all lines: src/components/grid/tests/CCol.spec.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const customWrapper = mount(Component, {
99
sm: 12,
1010
md: { size: 6, offset: 3, order: 1},
1111
lg: {},
12-
xl: true
12+
xl: true,
13+
xxl: { size: 4, offset: 2, order: 1}
1314
},
1415
slots: {
1516
default: 'CCol content'

‎src/components/grid/tests/__snapshots__/CCol.spec.js.snap

Copy file name to clipboardExpand all lines: src/components/grid/tests/__snapshots__/CCol.spec.js.snap
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exports[`CCol renders correctly 1`] = `
88

99
exports[`CCol renders correctly 2`] = `
1010
<div
11-
class="col-sm-12 col-md-6 offset-md-3 order-md-1 col-xl"
11+
class="col-sm-12 col-md-6 offset-md-3 order-md-1 col-xl col-xxl-4 offset-xxl-2 order-xxl-1"
1212
>
1313
<template>
1414
CCol content

‎src/components/index.d.ts

Copy file name to clipboardExpand all lines: src/components/index.d.ts
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ export declare class CCol extends Vue {
286286
md?: boolean | string | number | object
287287
lg?: boolean | string | number | object
288288
xl?: boolean | string | number | object
289+
xxl?: boolean | string | number | object
289290
tag?: string
290291
}
291292

‎src/components/modal/CModal.vue

Copy file name to clipboardExpand all lines: src/components/modal/CModal.vue
+24-1Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ export default {
8484
type: Boolean,
8585
default: true
8686
},
87-
addContentClasses: [String, Array, Object]
87+
addContentClasses: [String, Array, Object],
88+
onKey: Function,
8889
},
8990
data () {
9091
return {
@@ -147,9 +148,26 @@ export default {
147148
},
148149
hide (e, accept = false) {
149150
this.$emit('update:show', false, e, accept)
151+
if(this.visible){
152+
window.removeEventListener("keydown", this.hideEsc );
153+
}
154+
},
155+
hideEsc (event){
156+
if(typeof this.onKey != 'undefined'){
157+
if(this.onKey('', event.keyCode)!==false){
158+
this.hide(event)
159+
}
160+
}else{
161+
if(event.keyCode == '27'){
162+
this.hide(event)
163+
}
164+
}
150165
},
151166
toggle (newVal) {
152167
setTimeout(() => { this.visible = newVal }, 0)
168+
if(newVal){
169+
window.addEventListener('keydown', this.hideEsc );
170+
}
153171
if (this.fade) {
154172
this.isTransitioning = true
155173
clearTimeout(this.timeout)
@@ -158,6 +176,11 @@ export default {
158176
}, 150)
159177
}
160178
}
179+
},
180+
mounted: function(){
181+
if(this.show){
182+
window.addEventListener('keydown', this.hideEsc );
183+
}
161184
}
162185
}
163186
</script>

‎src/components/modal/tests/CModal.spec.js

Copy file name to clipboardExpand all lines: src/components/modal/tests/CModal.spec.js
+23-2Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@ import { mount } from '@vue/test-utils'
22
import Component from '../CModal'
33

44
const ComponentName = 'CModal'
5-
const defaultWrapper = mount(Component)
5+
const defaultWrapper = mount(Component, { attachToDocument: true })
6+
const defaultWrapper2 = mount(Component, {
7+
propsData: {
8+
show: true,
9+
onKey: function(type, key){
10+
return key===32
11+
}
12+
},
13+
attachToDocument: true
14+
})
615
const customWrapper = mount(Component, {
716
propsData: {
817
show: true,
@@ -14,7 +23,7 @@ const customWrapper = mount(Component, {
1423
fade: true,
1524
backdrop: true,
1625
closeOnBackdrop: false,
17-
addContentClasses: 'additional-content-class'
26+
addContentClasses: 'additional-content-class',
1827
},
1928
slots: {
2029
default: 'CModal body'
@@ -58,4 +67,16 @@ describe(ComponentName, () => {
5867
}, 200)
5968
jest.runAllTimers()
6069
})
70+
it('Close on default key -> ESC (modal donot show=true on mounted)', () => {
71+
defaultWrapper.setProps(
72+
{
73+
show: true,
74+
})
75+
defaultWrapper.trigger('keydown.esc')
76+
expect(defaultWrapper.emitted()['update:show']).toBeTruthy()
77+
})
78+
it('Close on key defined in onKey function (modal show=true on mounted)', () => {
79+
defaultWrapper2.trigger('keydown.space')
80+
expect(defaultWrapper2.emitted()['update:show']).toBeTruthy()
81+
})
6182
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.