Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added: auto detect placement #761

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions __mocks__/popper.js.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import PopperJs from 'popper.js'

export default class Popper {
static placements = PopperJs.placements;

constructor () {
return {
destroy: () => {},
update: () => {},
scheduleUpdate: () => {}
}
}
}
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
],
'env': {
'test': {
'plugins': ['@babel/plugin-transform-modules-commonjs']
'plugins': ['@babel/plugin-transform-modules-commonjs', '@babel/plugin-proposal-class-properties']
}
}
}
20 changes: 18 additions & 2 deletions example/Demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,22 @@
</code>
</div>

<div class="example">
<h3>Placement</h3>
<datepicker :placement="placement"></datepicker>
<code>
&lt;datepicker :placement="{{ placement }}"&gt;&lt;/datepicker&gt;
</code>
<div class="settings">
<h5>Settings</h5>
<select v-model="placement">
<option value="auto">Auto</option>
<option value="top">Top</option>
<option value="bottom">Bottom</option>
</select>
</div>
</div>

<div class="example">
<h3>Day view only</h3>
<datepicker :minimumView="'day'" :maximumView="'day'"></datepicker>
Expand Down Expand Up @@ -245,7 +261,6 @@
&lt;datepicker :minimumView="'month'" :maximumView="'year'" :initialView="'year'"&gt;&lt;/datepicker&gt;
</code>
</div>

</div>
</template>

Expand Down Expand Up @@ -287,7 +302,8 @@ export default {
state: state,
vModelExample: null,
languages: lang,
language: 'en'
language: 'en',
placement: 'auto',
}
},
computed: {
Expand Down
2 changes: 1 addition & 1 deletion example/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Demo from './Demo.vue'
Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
window.app = new Vue({
el: '#app',
render: h => h(Demo)
})
153 changes: 153 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"lint",
"test"
],
"dependencies": {},
"dependencies": {
"popper.js": "^1.15.0"
},
"peerDependencies": {
"vue": "^2.6.10"
},
Expand All @@ -45,6 +47,7 @@
"@babel/core": "^7.4.5",
"@babel/node": "^7.4.5",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-transform-modules-commonjs": "^7.4.4",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.5",
Expand Down
Loading