mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-05-05 14:04:44 +00:00
Merge remote-tracking branch 'origin/develop' into components/mdTable
* origin/develop: Create select with multiple Make md-select with md-menu Fix for issue #41 (md-button ignoring type prop) Finish md-menu spec Add keyboard shortcuts to menu Add close event on tab Close content on esc Drop transitionend dependency Keep menu content inside viewport Recalculate position on resize Add menu code in card example Add menu in a button text Add menu to card example Refactor huge method Make menu open in a correct position Add initial styles and detach and attach menu on click Force size of demo example Add page title Add menu tag Add empty md-menu files
This commit is contained in:
commit
c7b48749ed
34 changed files with 1662 additions and 881 deletions
|
|
@ -114,7 +114,7 @@ npm run build:lib
|
|||
|
||||
## Credits and Thanks
|
||||
* This library aims to delivery components using almost the same API of <a href="https://material.angularjs.org/latest/" target="_blank">Angular Material</a>
|
||||
* Thanks a lot to <a href="https://github.com/elviskang" target="_blank">elviskang</a> who provided me the **vue-material** name on npm.
|
||||
* Thanks a lot to <a href="https://github.com/elviskang" target="_blank">elviskang</a> for donating the npm package name!
|
||||
* Thanks to <a href="https://github.com/yyx990803" target="_blank">Evan You</a> for allowing me to use Vue.js Logo.
|
||||
|
||||
## Internal Dependencies
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@
|
|||
<router-link exact to="/components/list">List</router-link>
|
||||
</md-list-item>
|
||||
|
||||
<md-list-item class="md-inset">
|
||||
<router-link exact to="/components/menu">Menu</router-link>
|
||||
</md-list-item>
|
||||
|
||||
<md-list-item class="md-inset">
|
||||
<router-link exact to="/components/radio">Radio</router-link>
|
||||
</md-list-item>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<md-whiteframe class="demo-example" :class="classes" :style="{ height: height + 'px' }">
|
||||
<md-card class="demo-example" :class="classes" :style="{ height: height + 'px' }">
|
||||
<md-toolbar v-md-theme="titleTheme" class="demo-example-toolbar">
|
||||
<h2 class="md-title">{{ label }}</h2>
|
||||
</md-toolbar>
|
||||
|
|
@ -7,15 +7,17 @@
|
|||
<section v-md-theme="bodyTheme" class="demo-example-body">
|
||||
<slot></slot>
|
||||
</section>
|
||||
</md-whiteframe>
|
||||
</md-card>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.demo-example {
|
||||
max-width: 100%;
|
||||
min-width: 320px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
background-color: #fafafa;
|
||||
|
||||
&.size-1 {
|
||||
|
|
@ -44,6 +46,7 @@
|
|||
|
||||
.demo-example-body {
|
||||
padding: 16px;
|
||||
flex: 1;
|
||||
background-color: #FFF;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,9 @@
|
|||
toggleSidenav() {
|
||||
this.$root.toggleSidenav();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
document.title = this.label + ' - Vue Material';
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@
|
|||
toggleSidenav() {
|
||||
this.$root.toggleSidenav();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
document.title = 'Vue Material - ' + this.label;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<h2 class="md-headline">Credits and Thanks</h2>
|
||||
<ul>
|
||||
<li>This library aims to delivery components using almost the same API of <a href="https://material.angularjs.org/latest/" target="_blank">Angular Material</a></li>
|
||||
<li>Thanks a lot to <a href="https://github.com/elviskang" target="_blank">elviskang</a> who provided me the **vue-material** name on npm.</li>
|
||||
<li>Thanks a lot to <a href="https://github.com/elviskang" target="_blank">elviskang</a> for donating the npm package name!</li>
|
||||
<li>Thanks to <a href="https://github.com/yyx990803" target="_blank">Evan You</a> for allowing me to use Vue.js Logo.</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
|
|
|||
|
|
@ -29,9 +29,23 @@
|
|||
<div class="md-subhead">Subtitle here</div>
|
||||
</md-card-header-text>
|
||||
|
||||
<md-button class="md-icon-button">
|
||||
<md-icon>more_vert</md-icon>
|
||||
</md-button>
|
||||
<md-menu md-size="4" md-direction="bottom left">
|
||||
<md-button class="md-icon-button" md-menu-trigger>
|
||||
<md-icon>more_vert</md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>
|
||||
<span>Call</span>
|
||||
<md-icon>phone</md-icon>
|
||||
</md-menu-item>
|
||||
|
||||
<md-menu-item>
|
||||
<span>Send a message</span>
|
||||
<md-icon>message</md-icon>
|
||||
</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
</md-card-header>
|
||||
|
||||
<md-card-media>
|
||||
|
|
@ -371,9 +385,17 @@
|
|||
<div class="md-subhead">Subtitle here</div>
|
||||
</md-card-header-text>
|
||||
|
||||
<md-button class="md-icon-button">
|
||||
<md-icon>more_vert</md-icon>
|
||||
</md-button>
|
||||
<md-menu md-size="2" md-direction="bottom left">
|
||||
<md-button class="md-icon-button" md-menu-trigger>
|
||||
<md-icon>more_vert</md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
</md-card-header>
|
||||
|
||||
<md-card-media>
|
||||
|
|
|
|||
179
docs/src/pages/components/Menu.vue
Normal file
179
docs/src/pages/components/Menu.vue
Normal file
|
|
@ -0,0 +1,179 @@
|
|||
<template>
|
||||
<demo-page label="Components - Menu">
|
||||
<div slot="examples">
|
||||
<demo-example label="Directions">
|
||||
<md-menu>
|
||||
<md-button md-menu-trigger>Bottom Right</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-direction="bottom left">
|
||||
<md-button md-menu-trigger>Bottom Left</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item disabled>My Item 3</md-menu-item>
|
||||
<md-menu-item>My Item 4</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-direction="top left">
|
||||
<md-button md-menu-trigger>Top Left</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-direction="top right">
|
||||
<md-button md-menu-trigger>Top Right</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
</demo-example>
|
||||
|
||||
<demo-example label="Sizes">
|
||||
<md-menu>
|
||||
<md-button md-menu-trigger>Default</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-size="1">
|
||||
<md-button md-menu-trigger>Size 1</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-size="2">
|
||||
<md-button md-menu-trigger>Size 2</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-size="4">
|
||||
<md-button md-menu-trigger>Size 4</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-size="5">
|
||||
<md-button md-menu-trigger>Size 5</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-size="7">
|
||||
<md-button md-menu-trigger>Size 7</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
</demo-example>
|
||||
|
||||
<demo-example label="List Icons">
|
||||
<md-menu>
|
||||
<md-button class="md-icon-button" md-menu-trigger>
|
||||
<md-icon>more_vert</md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>My Item 1</md-menu-item>
|
||||
<md-menu-item>My Item 2</md-menu-item>
|
||||
<md-menu-item>My Item 3</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-size="4">
|
||||
<md-button class="md-icon-button" md-menu-trigger>
|
||||
<md-icon>phone</md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>
|
||||
<md-icon>phone</md-icon>
|
||||
<span>My Item 1</span>
|
||||
</md-menu-item>
|
||||
|
||||
<md-menu-item>
|
||||
<md-icon>phone</md-icon>
|
||||
<span>My Item 2</span>
|
||||
</md-menu-item>
|
||||
|
||||
<md-menu-item>
|
||||
<md-icon>phone</md-icon>
|
||||
<span>My Item 3</span>
|
||||
</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<md-menu md-direction="bottom left" md-size="4">
|
||||
<md-button class="md-icon-button" md-menu-trigger>
|
||||
<md-icon>near_me</md-icon>
|
||||
</md-button>
|
||||
|
||||
<md-menu-content>
|
||||
<md-menu-item>
|
||||
<span>Find on map</span>
|
||||
<md-icon>near_me</md-icon>
|
||||
</md-menu-item>
|
||||
|
||||
<md-menu-item>
|
||||
<span>Call</span>
|
||||
<md-icon>phone</md-icon>
|
||||
</md-menu-item>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
</demo-example>
|
||||
</div>
|
||||
|
||||
<div slot="code">
|
||||
|
||||
</div>
|
||||
|
||||
<div slot="api">
|
||||
|
||||
</div>
|
||||
</demo-page>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.md-menu {
|
||||
margin-right: 36px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -6,47 +6,49 @@
|
|||
<md-input-container>
|
||||
<label for="movie">Movie</label>
|
||||
<md-select name="movie" id="movie" v-model="movie">
|
||||
<md-option value="Fight Club">Fight Club</md-option>
|
||||
<md-option value="Godfather II">Godfather II</md-option>
|
||||
<md-option value="Godfather III">Godfather III</md-option>
|
||||
<md-option value="Godfather">Godfather</md-option>
|
||||
<md-option value="Godfellas">Godfellas</md-option>
|
||||
<md-option value="Pulp Fiction">Pulp Fiction</md-option>
|
||||
<md-option value="Scarface">Scarface</md-option>
|
||||
<md-option value="fight_club">Fight Club</md-option>
|
||||
<md-option value="godfather">Godfather</md-option>
|
||||
<md-option value="godfather_ii">Godfather II</md-option>
|
||||
<md-option value="godfather_iii">Godfather III</md-option>
|
||||
<md-option value="godfellas">Godfellas</md-option>
|
||||
<md-option value="pulp_fiction">Pulp Fiction</md-option>
|
||||
<md-option value="scarface">Scarface</md-option>
|
||||
</md-select>
|
||||
</md-input-container>
|
||||
|
||||
<md-input-container>
|
||||
<label for="country">Country</label>
|
||||
<md-select name="country" id="country" v-model="country">
|
||||
<md-option value="Australia">Australia</md-option>
|
||||
<md-option value="Brazil">Brazil</md-option>
|
||||
<md-option value="Japan">Japan</md-option>
|
||||
<md-option value="United States">United States</md-option>
|
||||
<md-option value="australia">Australia</md-option>
|
||||
<md-option value="brazil">Brazil</md-option>
|
||||
<md-option value="japan">Japan</md-option>
|
||||
<md-option value="united_states">United States</md-option>
|
||||
</md-select>
|
||||
</md-input-container>
|
||||
|
||||
<md-input-container>
|
||||
<label for="font">Font</label>
|
||||
<md-select name="font" id="font" v-model="font">
|
||||
<md-option value="Arial">Arial</md-option>
|
||||
<md-option value="Calibri">Calibri</md-option>
|
||||
<md-option value="Cambria">Cambria</md-option>
|
||||
<md-option value="Comic Sans">Comic Sans</md-option>
|
||||
<md-option value="Consolas">Consolas</md-option>
|
||||
<md-option value="Courier">Courier</md-option>
|
||||
<md-option value="Droid Sans">Droid Sans</md-option>
|
||||
<md-option value="Georgia">Georgia</md-option>
|
||||
<md-option value="Helvetica">Helvetica</md-option>
|
||||
<md-option value="Impact">Impact</md-option>
|
||||
<md-option value="Roboto">Roboto</md-option>
|
||||
<md-option value="Segoe UI">Segoe UI</md-option>
|
||||
<md-option value="Times New Roman">Times New Roman</md-option>
|
||||
<md-option value="Ubuntu">Ubuntu</md-option>
|
||||
<md-option value="Verdana">Verdana</md-option>
|
||||
<md-option value="arial">Arial</md-option>
|
||||
<md-option value="calibri">Calibri</md-option>
|
||||
<md-option value="cambria">Cambria</md-option>
|
||||
<md-option value="comic_sans">Comic Sans</md-option>
|
||||
<md-option value="consolas">Consolas</md-option>
|
||||
<md-option value="courier">Courier</md-option>
|
||||
<md-option value="droid_sans">Droid Sans</md-option>
|
||||
<md-option value="georgia">Georgia</md-option>
|
||||
<md-option value="helvetica">Helvetica</md-option>
|
||||
<md-option value="impact">Impact</md-option>
|
||||
<md-option value="roboto">Roboto</md-option>
|
||||
<md-option value="segoe_ui">Segoe UI</md-option>
|
||||
<md-option value="times_new_roman">Times New Roman</md-option>
|
||||
<md-option value="ubuntu">Ubuntu</md-option>
|
||||
<md-option value="verdana">Verdana</md-option>
|
||||
</md-select>
|
||||
</md-input-container>
|
||||
</div>
|
||||
|
||||
<md-button class="md-raised md-primary" @click="setPulpFiction">Set Pulp Fiction</md-button>
|
||||
</demo-example>
|
||||
|
||||
<demo-example label="Groups" height="350">
|
||||
|
|
@ -55,22 +57,51 @@
|
|||
<label for="food">Food</label>
|
||||
<md-select name="food" id="food" v-model="food">
|
||||
<md-subheader>Fruits</md-subheader>
|
||||
<md-option value="Apples">Apples</md-option>
|
||||
<md-option value="Bananas">Bananas</md-option>
|
||||
<md-option value="Peaches">Peaches</md-option>
|
||||
<md-option value="Oranges">Oranges</md-option>
|
||||
<md-option value="apples">Apples</md-option>
|
||||
<md-option value="bananas">Bananas</md-option>
|
||||
<md-option value="peaches">Peaches</md-option>
|
||||
<md-option value="oranges">Oranges</md-option>
|
||||
|
||||
<md-subheader>Vegetables</md-subheader>
|
||||
<md-option value="Carrots">Carrots</md-option>
|
||||
<md-option value="Cucumbers">Cucumbers</md-option>
|
||||
<md-option value="carrots">Carrots</md-option>
|
||||
<md-option value="cucumbers">Cucumbers</md-option>
|
||||
|
||||
<md-subheader>Baked Goods</md-subheader>
|
||||
<md-option value="Apple Pie">Apple Pie</md-option>
|
||||
<md-option value="Chocolate Cake">Chocolate Cake</md-option>
|
||||
<md-option value="apple_pie">Apple Pie</md-option>
|
||||
<md-option value="chocolate_cake">Chocolate Cake</md-option>
|
||||
</md-select>
|
||||
</md-input-container>
|
||||
</div>
|
||||
</demo-example>
|
||||
|
||||
<demo-example label="Multiple" height="350">
|
||||
<div class="field-group">
|
||||
<md-input-container>
|
||||
<label for="users">Users</label>
|
||||
<md-select name="users" id="users" multiple v-model="users">
|
||||
<md-subheader>Managers</md-subheader>
|
||||
<md-option value="jim_halpert">Jim Halpert</md-option>
|
||||
<md-option value="dwight_schrute">Dwight Schrute</md-option>
|
||||
<md-option value="michael_scott">Michael Scott</md-option>
|
||||
|
||||
<md-subheader>Employees</md-subheader>
|
||||
<md-option value="pam_beesly">Pam Beesly</md-option>
|
||||
<md-option value="angela_martin">Angela Martin</md-option>
|
||||
<md-option value="kelly_kapoor">Kelly Kapoor</md-option>
|
||||
<md-option value="ryan_howard">Ryan Howard</md-option>
|
||||
<md-option value="kevin_malone">Kevin Malone</md-option>
|
||||
<md-option value="creed_bratton">Creed Bratton</md-option>
|
||||
<md-option value="oscar_nunez">Oscar Nunez</md-option>
|
||||
<md-option value="toby_flenderson">Toby Flenderson</md-option>
|
||||
<md-option value="stanley_hudson">Stanley Hudson</md-option>
|
||||
<md-option value="meredith_palmer">Meredith Palmer</md-option>
|
||||
<md-option value="phyllis_lapin_vance">Phyllis Lapin-Vance</md-option>
|
||||
</md-select>
|
||||
</md-input-container>
|
||||
</div>
|
||||
|
||||
{{ users }}
|
||||
</demo-example>
|
||||
</div>
|
||||
|
||||
<div slot="code">
|
||||
|
|
@ -168,13 +199,17 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
movie: 'Godfather',
|
||||
country: null,
|
||||
font: null,
|
||||
food: null
|
||||
};
|
||||
data: () => ({
|
||||
movie: 'godfather',
|
||||
country: '',
|
||||
font: '',
|
||||
food: '',
|
||||
users: []
|
||||
}),
|
||||
methods: {
|
||||
setPulpFiction() {
|
||||
this.movie = 'pulp_fiction';
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import Checkbox from './pages/components/Checkbox';
|
|||
import Icon from './pages/components/Icon';
|
||||
import Input from './pages/components/Input';
|
||||
import List from './pages/components/List';
|
||||
import Menu from './pages/components/Menu';
|
||||
import Radio from './pages/components/Radio';
|
||||
import Ripple from './pages/components/Ripple';
|
||||
import Select from './pages/components/Select';
|
||||
|
|
@ -109,6 +110,11 @@ const components = [
|
|||
name: 'components:list',
|
||||
component: List
|
||||
},
|
||||
{
|
||||
path: '/components/menu',
|
||||
name: 'components:menu',
|
||||
component: Menu
|
||||
},
|
||||
{
|
||||
path: '/components/radio',
|
||||
name: 'components:radio',
|
||||
|
|
|
|||
28
package.json
28
package.json
|
|
@ -43,46 +43,46 @@
|
|||
"dependencies": {
|
||||
"autosize": "^3.0.17",
|
||||
"element.scrollintoviewifneeded-polyfill": "^1.0.1",
|
||||
"scopedQuerySelectorShim": "github:lazd/scopedQuerySelectorShim",
|
||||
"vue": "^2.0.2"
|
||||
"scopedQuerySelectorShim": "lazd/scopedQuerySelectorShim",
|
||||
"vue": "^2.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.5.0",
|
||||
"autoprefixer": "^6.5.1",
|
||||
"babel-cli": "^6.18.0",
|
||||
"babel-core": "^6.17.0",
|
||||
"babel-core": "^6.18.0",
|
||||
"babel-eslint": "^7.0.0",
|
||||
"babel-loader": "^6.2.5",
|
||||
"babel-plugin-transform-runtime": "^6.15.0",
|
||||
"babel-preset-es2015": "^6.16.0",
|
||||
"babel-preset-es2015": "^6.18.0",
|
||||
"babel-preset-stage-0": "^6.16.0",
|
||||
"chalk": "^1.1.3",
|
||||
"chokidar": "^1.6.1",
|
||||
"connect-history-api-fallback": "^1.3.0",
|
||||
"copy-webpack-plugin": "^3.0.1",
|
||||
"copy-webpack-plugin": "^4.0.0",
|
||||
"css-loader": "^0.25.0",
|
||||
"eslint": "^3.7.1",
|
||||
"eslint": "^3.8.1",
|
||||
"eslint-friendly-formatter": "^2.0.6",
|
||||
"eslint-loader": "^1.5.0",
|
||||
"eslint-plugin-html": "^1.5.3",
|
||||
"eslint-loader": "^1.6.0",
|
||||
"eslint-plugin-html": "^1.5.5",
|
||||
"eventsource-polyfill": "^0.9.6",
|
||||
"express": "^4.14.0",
|
||||
"extract-text-webpack-plugin": "^1.0.1",
|
||||
"file-loader": "^0.9.0",
|
||||
"highlight.js": "^9.7.0",
|
||||
"html-webpack-plugin": "^2.22.0",
|
||||
"html-webpack-plugin": "^2.24.0",
|
||||
"node-sass": "^3.10.1",
|
||||
"ora": "^0.3.0",
|
||||
"raw-loader": "^0.5.1",
|
||||
"sass-loader": "^4.0.2",
|
||||
"vue-hot-reload-api": "^2.0.6",
|
||||
"vue-html-loader": "^1.2.3",
|
||||
"vue-loader": "^9.5.1",
|
||||
"vue-loader": "^9.7.0",
|
||||
"vue-router": "^2.0.1",
|
||||
"vue-style-loader": "^1.0.0",
|
||||
"vue-template-compiler": "^2.0.1",
|
||||
"vue-template-compiler": "^2.0.5",
|
||||
"webpack": "^1.13.2",
|
||||
"webpack-dev-middleware": "^1.8.4",
|
||||
"webpack-hot-middleware": "^2.12.2",
|
||||
"webpack-merge": "^0.14.1"
|
||||
"webpack-hot-middleware": "^2.13.0",
|
||||
"webpack-merge": "^0.15.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ $button-icon-size: 40px;
|
|||
font-style: inherit;
|
||||
font-variant: inherit;
|
||||
font-weight: 500;
|
||||
letter-spacing: inherit;
|
||||
line-height: $button-height;
|
||||
text-align: center;
|
||||
text-transform: uppercase;
|
||||
|
|
|
|||
|
|
@ -14,20 +14,20 @@
|
|||
let options = {
|
||||
staticClass: 'md-button',
|
||||
attrs: {
|
||||
type: hasLink || 'button',
|
||||
type: this.type || 'button',
|
||||
disabled: isDisabled
|
||||
},
|
||||
directives: [{
|
||||
name: 'md-ink-ripple',
|
||||
value: isDisabled,
|
||||
expression: 'disabled'
|
||||
}],
|
||||
on: {
|
||||
click: () => {
|
||||
this.$emit('click');
|
||||
}
|
||||
}
|
||||
};
|
||||
let ripple = createElement('md-ink-ripple', {
|
||||
attrs: {
|
||||
mdDisabled: isDisabled
|
||||
}
|
||||
});
|
||||
|
||||
if (hasLink) {
|
||||
tag = 'a';
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
delete options.attrs.type;
|
||||
}
|
||||
|
||||
return createElement(tag, options, this.$slots.default);
|
||||
return createElement(tag, options, [...this.$slots.default, ripple]);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -28,15 +28,20 @@
|
|||
computed: {
|
||||
classes() {
|
||||
return {
|
||||
'md-checked': Boolean(this.value),
|
||||
'md-checked': Boolean(this.checked),
|
||||
'md-disabled': this.disabled
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value() {
|
||||
this.checked = this.value;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggleCheck() {
|
||||
if (!this.disabled) {
|
||||
this.checked = !this.value;
|
||||
this.checked = !this.checked;
|
||||
this.$emit('change', this.checked);
|
||||
this.$emit('input', this.checked);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,19 +19,9 @@
|
|||
mdDisabled: Boolean,
|
||||
mdHasPassword: Boolean
|
||||
},
|
||||
computed: {
|
||||
classes() {
|
||||
return {
|
||||
'md-input-inline': this.mdInline,
|
||||
'md-has-password': this.mdHasPassword,
|
||||
'md-has-select': this.mdHasSelect,
|
||||
'md-has-value': Boolean(this.value)
|
||||
};
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
value: null,
|
||||
value: '',
|
||||
input: false,
|
||||
inputType: false,
|
||||
showPassword: false,
|
||||
|
|
@ -41,12 +31,27 @@
|
|||
inputLength: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
hasValue() {
|
||||
if (this.value.constructor === Array) {
|
||||
return this.value.length > 0;
|
||||
}
|
||||
|
||||
return Boolean(this.value);
|
||||
},
|
||||
classes() {
|
||||
return {
|
||||
'md-input-inline': this.mdInline,
|
||||
'md-has-password': this.mdHasPassword,
|
||||
'md-has-select': this.mdHasSelect,
|
||||
'md-has-value': this.hasValue
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
togglePasswordType() {
|
||||
if (this.input.tagName.toLowerCase() === 'input') {
|
||||
let type = this.input.type;
|
||||
|
||||
if (type === 'password') {
|
||||
if (this.inputType === 'password') {
|
||||
this.input.type = 'text';
|
||||
this.showPassword = true;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@
|
|||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex: 1;
|
||||
|
||||
> .md-ink-ripple {
|
||||
|
|
@ -263,10 +264,6 @@
|
|||
> .md-list-item-container > .md-list-item-holder {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
> span {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.md-expansion-indicator,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
export default {
|
||||
props: {
|
||||
href: String,
|
||||
target: String
|
||||
target: String,
|
||||
disabled: Boolean
|
||||
},
|
||||
render(createElement) {
|
||||
let containerClass = 'md-button md-list-item-container';
|
||||
|
|
@ -118,7 +119,8 @@
|
|||
staticClass: containerClass,
|
||||
attrs: {
|
||||
target: this.target,
|
||||
href: this.href
|
||||
href: this.href,
|
||||
disabled: this.disabled
|
||||
}
|
||||
}, [createItemHolder(slot)]);
|
||||
|
||||
|
|
|
|||
12
src/components/mdMenu/index.js
Normal file
12
src/components/mdMenu/index.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import mdMenu from './mdMenu.vue';
|
||||
import mdMenuItem from './mdMenuItem.vue';
|
||||
import mdMenuContent from './mdMenuContent.vue';
|
||||
import mdMenuTheme from './mdMenu.theme';
|
||||
|
||||
export default function install(Vue) {
|
||||
Vue.component('md-menu', Vue.extend(mdMenu));
|
||||
Vue.component('md-menu-item', Vue.extend(mdMenuItem));
|
||||
Vue.component('md-menu-content', Vue.extend(mdMenuContent));
|
||||
|
||||
Vue.material.styles.push(mdMenuTheme);
|
||||
}
|
||||
94
src/components/mdMenu/mdMenu.scss
Normal file
94
src/components/mdMenu/mdMenu.scss
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
@import '../../core/stylesheets/variables.scss';
|
||||
|
||||
$menu-base-width: 56px;
|
||||
|
||||
.md-menu {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.md-menu-content {
|
||||
width: $menu-base-width * 3;
|
||||
min-width: $menu-base-width * 1.5;
|
||||
max-width: $menu-base-width * 7;
|
||||
min-height: 64px;
|
||||
max-height: calc(100vh - 32px);
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
position: fixed;
|
||||
z-index: 120;
|
||||
background-color: #fff;
|
||||
border-radius: 2px;
|
||||
filter: drop-shadow(0 1px 1px rgba(#000, $shadow-key-umbra-opacity)) drop-shadow(0 2px 2px rgba(#000, $shadow-key-penumbra-opacity)) drop-shadow(0 1px 1px rgba(#000, $shadow-ambient-shadow-opacity));
|
||||
opacity: 0;
|
||||
transition: width $swift-ease-out-duration $swift-ease-out-timing-function,
|
||||
opacity .25s $swift-ease-in-timing-function,
|
||||
clip-path .17s .08s $swift-ease-in-timing-function;
|
||||
color: rgba(#212121, .87);
|
||||
|
||||
&.md-direction-bottom-right {
|
||||
margin-top: -11px;
|
||||
margin-left: -8px;
|
||||
clip-path: inset(-8px 10% 16% -8px);
|
||||
}
|
||||
|
||||
&.md-direction-bottom-left {
|
||||
margin-top: -11px;
|
||||
margin-left: 8px;
|
||||
clip-path: inset(-8px -8px 16% 10%);
|
||||
}
|
||||
|
||||
&.md-direction-top-right {
|
||||
margin-top: 11px;
|
||||
margin-left: -8px;
|
||||
clip-path: inset(-8px 16% -8px 10%);
|
||||
}
|
||||
|
||||
&.md-direction-top-left {
|
||||
margin-top: 11px;
|
||||
margin-left: 8px;
|
||||
clip-path: inset(16% -8px -8px 10%);
|
||||
}
|
||||
|
||||
&.md-size-1 {
|
||||
width: $menu-base-width * 1.5;
|
||||
}
|
||||
|
||||
@for $i from 2 through 7 {
|
||||
&.md-size-#{$i} {
|
||||
width: $menu-base-width * $i;
|
||||
}
|
||||
}
|
||||
|
||||
&.md-active {
|
||||
pointer-events: auto;
|
||||
opacity: 1;
|
||||
clip-path: inset(-8px -8px -8px -8px);
|
||||
transition: width $swift-ease-out-duration $swift-ease-out-timing-function,
|
||||
opacity .4s $swift-ease-out-timing-function,
|
||||
clip-path .27s .08s $swift-ease-out-timing-function;
|
||||
}
|
||||
}
|
||||
|
||||
.md-menu-item {
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
line-height: 1.2em;
|
||||
|
||||
&:hover,
|
||||
&:focus,
|
||||
&.md-highlighted {
|
||||
.md-button:not([disabled]) {
|
||||
background-color: rgba(#000, .12);
|
||||
}
|
||||
}
|
||||
|
||||
&[disabled] {
|
||||
cursor: default;
|
||||
color: rgba(#000, .38);
|
||||
}
|
||||
|
||||
.md-list-item-holder {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
6
src/components/mdMenu/mdMenu.theme
Normal file
6
src/components/mdMenu/mdMenu.theme
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
.THEME_NAME {
|
||||
.md-menu,
|
||||
&.md-menu {
|
||||
|
||||
}
|
||||
}
|
||||
239
src/components/mdMenu/mdMenu.vue
Normal file
239
src/components/mdMenu/mdMenu.vue
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
<template>
|
||||
<div class="md-menu">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" src="./mdMenu.scss"></style>
|
||||
|
||||
<script>
|
||||
import transitionEndEventName from '../../core/utils/transitionEndEventName';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
mdSize: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
},
|
||||
mdDirection: {
|
||||
type: String,
|
||||
default: 'bottom right'
|
||||
},
|
||||
mdCloseOnSelect: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
browserMargin: 8,
|
||||
active: false
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
mdSize(current, previous) {
|
||||
if (current >= 1 && current <= 7) {
|
||||
this.removeLastSizeMenuContentClass(previous);
|
||||
this.addNewSizeMenuContentClass(current);
|
||||
}
|
||||
},
|
||||
mdDirection(current, previous) {
|
||||
this.removeLastDirectionMenuContentClass(previous);
|
||||
this.addNewDirectionMenuContentClass(current);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
validateMenu() {
|
||||
if (!this.menuContent) {
|
||||
this.$destroy();
|
||||
|
||||
throw new Error('You must have a md-menu-content inside your menu.');
|
||||
}
|
||||
|
||||
if (!this.menuTrigger) {
|
||||
this.$destroy();
|
||||
|
||||
throw new Error('You must have an element with a md-menu-trigger attribute inside your menu.');
|
||||
}
|
||||
},
|
||||
removeLastSizeMenuContentClass(size) {
|
||||
this.menuContent.classList.remove('md-size-' + size);
|
||||
},
|
||||
removeLastDirectionMenuContentClass(direction) {
|
||||
this.menuContent.classList.remove('md-direction-' + direction.replace(' ', '-'));
|
||||
},
|
||||
addNewSizeMenuContentClass(size) {
|
||||
this.menuContent.classList.add('md-size-' + size);
|
||||
},
|
||||
addNewDirectionMenuContentClass(direction) {
|
||||
this.menuContent.classList.add('md-direction-' + direction.replace(' ', '-'));
|
||||
},
|
||||
closeOnOffClick(event) {
|
||||
if (!this.$el.contains(event.target) && !this.menuContent.contains(event.target)) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
isAboveOfViewport(pos) {
|
||||
return pos.top <= this.browserMargin - parseInt(getComputedStyle(this.menuContent).marginTop, 10);
|
||||
},
|
||||
isBelowOfViewport(pos) {
|
||||
return pos.top + this.menuContent.offsetHeight + this.browserMargin >= window.innerHeight - parseInt(getComputedStyle(this.menuContent).marginTop, 10);
|
||||
},
|
||||
isOnTheLeftOfViewport(pos) {
|
||||
return pos.left <= this.browserMargin - parseInt(getComputedStyle(this.menuContent).marginLeft, 10);
|
||||
},
|
||||
isOnTheRightOfViewport(pos) {
|
||||
return pos.left + this.menuContent.offsetWidth + this.browserMargin >= window.innerWidth - parseInt(getComputedStyle(this.menuContent).marginLeft, 10);
|
||||
},
|
||||
getInViewPosition(position) {
|
||||
let computedStyle = getComputedStyle(this.menuContent);
|
||||
|
||||
if (this.isAboveOfViewport(position)) {
|
||||
position.top = this.browserMargin - parseInt(computedStyle.marginTop, 10);
|
||||
}
|
||||
|
||||
if (this.isOnTheLeftOfViewport(position)) {
|
||||
position.left = this.browserMargin - parseInt(computedStyle.marginLeft, 10);
|
||||
}
|
||||
|
||||
if (this.isOnTheRightOfViewport(position)) {
|
||||
position.left = window.innerWidth - this.browserMargin - this.menuContent.offsetWidth - parseInt(computedStyle.marginLeft, 10);
|
||||
}
|
||||
|
||||
if (this.isBelowOfViewport(position)) {
|
||||
position.top = window.innerHeight - this.browserMargin - this.menuContent.offsetHeight - parseInt(computedStyle.marginTop, 10);
|
||||
}
|
||||
|
||||
return position;
|
||||
},
|
||||
getBottomRightPos() {
|
||||
let menuTriggerRect = this.menuTrigger.getBoundingClientRect();
|
||||
let position = {
|
||||
top: menuTriggerRect.top,
|
||||
left: menuTriggerRect.left
|
||||
};
|
||||
|
||||
this.getInViewPosition(position);
|
||||
|
||||
return position;
|
||||
},
|
||||
getBottomLeftPos() {
|
||||
let menuTriggerRect = this.menuTrigger.getBoundingClientRect();
|
||||
let position = {
|
||||
top: menuTriggerRect.top,
|
||||
left: menuTriggerRect.left - this.menuContent.offsetWidth + menuTriggerRect.width
|
||||
};
|
||||
|
||||
this.getInViewPosition(position);
|
||||
|
||||
return position;
|
||||
},
|
||||
getTopRightPos() {
|
||||
let menuTriggerRect = this.menuTrigger.getBoundingClientRect();
|
||||
let position = {
|
||||
top: menuTriggerRect.top + menuTriggerRect.height - this.menuContent.offsetHeight,
|
||||
left: menuTriggerRect.left
|
||||
};
|
||||
|
||||
this.getInViewPosition(position);
|
||||
|
||||
return position;
|
||||
},
|
||||
getTopLeftPos() {
|
||||
let menuTriggerRect = this.menuTrigger.getBoundingClientRect();
|
||||
let position = {
|
||||
top: menuTriggerRect.top + menuTriggerRect.height - this.menuContent.offsetHeight,
|
||||
left: menuTriggerRect.left - this.menuContent.offsetWidth + menuTriggerRect.width
|
||||
};
|
||||
|
||||
this.getInViewPosition(position);
|
||||
|
||||
return position;
|
||||
},
|
||||
calculateMenuContentPos() {
|
||||
let position;
|
||||
|
||||
switch (this.mdDirection) {
|
||||
case 'bottom left':
|
||||
position = this.getBottomLeftPos();
|
||||
|
||||
break;
|
||||
|
||||
case 'top right':
|
||||
position = this.getTopRightPos();
|
||||
|
||||
break;
|
||||
|
||||
case 'top left':
|
||||
position = this.getTopLeftPos();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
position = this.getBottomRightPos();
|
||||
}
|
||||
|
||||
this.menuContent.style.top = position.top + 'px';
|
||||
this.menuContent.style.left = position.left + 'px';
|
||||
},
|
||||
recalculateOnResize() {
|
||||
window.requestAnimationFrame(this.calculateMenuContentPos);
|
||||
},
|
||||
open() {
|
||||
if (this.$root.$el.contains(this.menuContent)) {
|
||||
this.$root.$el.removeChild(this.menuContent);
|
||||
}
|
||||
|
||||
this.$root.$el.appendChild(this.menuContent);
|
||||
document.addEventListener('click', this.closeOnOffClick);
|
||||
window.addEventListener('resize', this.recalculateOnResize);
|
||||
|
||||
this.calculateMenuContentPos();
|
||||
|
||||
getComputedStyle(this.menuContent).top;
|
||||
this.menuContent.classList.add('md-active');
|
||||
this.menuContent.focus();
|
||||
this.active = true;
|
||||
},
|
||||
close() {
|
||||
let menuContent = this.menuContent;
|
||||
let close = (event) => {
|
||||
if (menuContent && event.target === menuContent) {
|
||||
let activeRipple = this.menuContent.querySelector('.md-ripple.md-active');
|
||||
|
||||
menuContent.removeEventListener(transitionEndEventName, close);
|
||||
this.menuTrigger.focus();
|
||||
this.active = false;
|
||||
|
||||
if (activeRipple) {
|
||||
activeRipple.classList.remove('md-active');
|
||||
}
|
||||
|
||||
this.$root.$el.removeChild(menuContent);
|
||||
document.removeEventListener('click', this.closeOnOffClick);
|
||||
window.removeEventListener('resize', this.recalculateOnResize);
|
||||
}
|
||||
};
|
||||
|
||||
this.menuContent.addEventListener(transitionEndEventName, close);
|
||||
this.menuContent.classList.remove('md-active');
|
||||
},
|
||||
toggle() {
|
||||
if (this.active) {
|
||||
this.close();
|
||||
} else {
|
||||
this.open();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.menuTrigger = this.$el.querySelector('[md-menu-trigger]');
|
||||
this.menuContent = this.$el.querySelector('.md-menu-content');
|
||||
this.validateMenu();
|
||||
this.addNewSizeMenuContentClass(this.mdSize);
|
||||
this.addNewDirectionMenuContentClass(this.mdDirection);
|
||||
this.menuContent.parentNode.removeChild(this.menuContent);
|
||||
this.menuTrigger.addEventListener('click', this.toggle);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
64
src/components/mdMenu/mdMenuContent.vue
Normal file
64
src/components/mdMenu/mdMenuContent.vue
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<template>
|
||||
<div
|
||||
class="md-menu-content"
|
||||
@keydown.esc.prevent="close"
|
||||
@keydown.tab.prevent="close"
|
||||
@keydown.up.prevent="highlightItem('up')"
|
||||
@keydown.down.prevent="highlightItem('down')"
|
||||
@keydown.enter.prevent="fireClick"
|
||||
@keydown.space.prevent="fireClick"
|
||||
tabindex="-1">
|
||||
<md-list>
|
||||
<slot></slot>
|
||||
</md-list>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
oldHighlight: false,
|
||||
highlighted: false,
|
||||
itemsAmount: 0
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
this.highlighted = false;
|
||||
this.$parent.close();
|
||||
},
|
||||
highlightItem(direction) {
|
||||
this.oldHighlight = this.highlighted;
|
||||
|
||||
if (direction === 'up') {
|
||||
if (this.highlighted === 1) {
|
||||
this.highlighted = this.itemsAmount;
|
||||
} else {
|
||||
this.highlighted--;
|
||||
}
|
||||
}
|
||||
|
||||
if (direction === 'down') {
|
||||
if (this.highlighted === this.itemsAmount) {
|
||||
this.highlighted = 1;
|
||||
} else {
|
||||
this.highlighted++;
|
||||
}
|
||||
}
|
||||
},
|
||||
fireClick() {
|
||||
if (this.highlighted > 0) {
|
||||
this.$children[0].$children[this.highlighted - 1].$el.click();
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.$parent.$el.classList.contains('md-menu')) {
|
||||
this.$destroy();
|
||||
|
||||
throw new Error('You must wrap the md-menu-content in a md-menu');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
78
src/components/mdMenu/mdMenuItem.vue
Normal file
78
src/components/mdMenu/mdMenuItem.vue
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
<template>
|
||||
<md-list-item
|
||||
class="md-menu-item"
|
||||
:class="classes"
|
||||
@click="close"
|
||||
:disabled="disabled">
|
||||
<slot></slot>
|
||||
</md-list-item>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import getClosestVueParent from '../../core/utils/getClosestVueParent';
|
||||
import 'element.scrollintoviewifneeded-polyfill';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
disabled: Boolean
|
||||
},
|
||||
data: () => ({
|
||||
parentContent: {},
|
||||
index: 0
|
||||
}),
|
||||
computed: {
|
||||
classes() {
|
||||
return {
|
||||
'md-highlighted': this.highlighted
|
||||
};
|
||||
},
|
||||
highlighted() {
|
||||
if (this.index === this.parentContent.highlighted) {
|
||||
if (this.disabled) {
|
||||
if (this.parentContent.oldHighlight > this.parentContent.highlighted) {
|
||||
this.parentContent.highlighted--;
|
||||
} else {
|
||||
this.parentContent.highlighted++;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.index === 1) {
|
||||
this.parentContent.$el.scrollTop = 0;
|
||||
} else if (this.index === this.parentContent.itemsAmount) {
|
||||
this.parentContent.$el.scrollTop = this.parentContent.$el.scrollHeight;
|
||||
} else {
|
||||
this.$el.scrollIntoViewIfNeeded(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
close() {
|
||||
if (!this.disabled) {
|
||||
if (this.parentMenu.mdCloseOnSelect) {
|
||||
this.parentContent.close();
|
||||
}
|
||||
|
||||
this.$emit('click');
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.parentContent = getClosestVueParent(this.$parent, 'md-menu-content');
|
||||
this.parentMenu = getClosestVueParent(this.$parent, 'md-menu');
|
||||
|
||||
if (!this.parentContent) {
|
||||
this.$destroy();
|
||||
|
||||
throw new Error('You must wrap the md-menu-item in a md-menu-content');
|
||||
}
|
||||
|
||||
this.parentContent.itemsAmount++;
|
||||
this.index = this.parentContent.itemsAmount;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
@ -1,73 +1,73 @@
|
|||
<template>
|
||||
<div
|
||||
<md-menu-item
|
||||
class="md-option"
|
||||
:class="classes"
|
||||
@click="selectOption"
|
||||
@mouseenter="setHighlight"
|
||||
@keydown.enter="selectOption"
|
||||
v-md-ink-ripple
|
||||
tabindex="-1">
|
||||
<span>
|
||||
<md-checkbox v-model="check" v-if="parentSelect.multiple">
|
||||
<span ref="item">
|
||||
<slot></slot>
|
||||
</span>
|
||||
</md-checkbox>
|
||||
|
||||
<span ref="item" v-else>
|
||||
<slot></slot>
|
||||
</span>
|
||||
</div>
|
||||
</md-menu-item>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import 'element.scrollintoviewifneeded-polyfill';
|
||||
import getClosestVueParent from '../../core/utils/getClosestVueParent';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: [String, Boolean, Number]
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
index: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
classes() {
|
||||
return {
|
||||
'md-highlighted': this.hasHighlight()
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
classes() {
|
||||
if (this.hasHighlight()) {
|
||||
this.$el.focus();
|
||||
this.$el.scrollIntoViewIfNeeded(false);
|
||||
data: () => ({
|
||||
parentSelect: {},
|
||||
check: false,
|
||||
index: 0
|
||||
}),
|
||||
methods: {
|
||||
selectOption() {
|
||||
if (!this.parentSelect.multiple) {
|
||||
this.parentSelect.selectOption(this.value, this.$refs.item.textContent);
|
||||
} else {
|
||||
this.check = !this.check;
|
||||
}
|
||||
},
|
||||
selectIfValueMatches() {
|
||||
if (this.value === this.parentSelect.value) {
|
||||
this.selectOption();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
setHighlight() {
|
||||
this.$parent.highlightOption(this.index);
|
||||
},
|
||||
hasHighlight() {
|
||||
return this.index === this.$parent.highlighted;
|
||||
},
|
||||
selectOption() {
|
||||
if (this.hasHighlight()) {
|
||||
if (this.$parent.$el.classList.contains('md-select')) {
|
||||
this.$parent.selectOption(this.value);
|
||||
} else {
|
||||
this.$parent.$parent.selectOption(this.value);
|
||||
}
|
||||
watch: {
|
||||
check(check) {
|
||||
if (check) {
|
||||
this.parentSelect.selectMultiple(this.index, this.value, this.$refs.item.textContent);
|
||||
} else {
|
||||
this.parentSelect.selectMultiple(this.index);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
let parentClasses = this.$parent.$el.classList;
|
||||
this.parentSelect = getClosestVueParent(this.$parent, 'md-select');
|
||||
this.parentContent = getClosestVueParent(this.$parent, 'md-menu-content');
|
||||
|
||||
if (!parentClasses.contains('md-select')) {
|
||||
this.$destroy();
|
||||
|
||||
throw new Error('You should wrap the md-option in a md-select');
|
||||
if (!this.parentSelect) {
|
||||
throw new Error('You must wrap the md-option in a md-select');
|
||||
}
|
||||
|
||||
this.$parent.optionsAmount++;
|
||||
this.index = this.$parent.optionsAmount;
|
||||
this.parentSelect.optionsAmount++;
|
||||
this.index = this.parentSelect.optionsAmount;
|
||||
|
||||
this.parentSelect.options[this.index] = {};
|
||||
|
||||
this.$watch(() => {
|
||||
return this.parentSelect.value;
|
||||
}, this.selectIfValueMatches);
|
||||
|
||||
this.selectIfValueMatches();
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,13 @@
|
|||
left: -999em;
|
||||
}
|
||||
|
||||
.md-menu {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.md-select-value {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
|
@ -65,7 +72,6 @@
|
|||
min-width: 156px;
|
||||
max-width: 100%;
|
||||
min-height: 48px;
|
||||
max-height: 256px;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
justify-content: stretch;
|
||||
|
|
@ -113,30 +119,42 @@
|
|||
}
|
||||
}
|
||||
|
||||
.md-option {
|
||||
height: 48px;
|
||||
min-height: 48px;
|
||||
padding: 0 4px 0 16px;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
justify-content: center;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
transform: translate3D(0, 0, 0);
|
||||
transition: $swift-ease-out;
|
||||
font-size: 16px;
|
||||
line-height: 1.2em;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
.md-select-content {
|
||||
width: auto;
|
||||
max-height: 256px;
|
||||
|
||||
&.md-highlighted {
|
||||
background-color: rgba(#000, .12);
|
||||
&.md-direction-bottom-right {
|
||||
margin-top: -15px;
|
||||
margin-left: -16px;
|
||||
}
|
||||
|
||||
span {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
&.md-direction-bottom-left {
|
||||
margin-top: -15px;
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
&.md-direction-top-right {
|
||||
margin-top: 15px;
|
||||
margin-left: -16px;
|
||||
}
|
||||
|
||||
&.md-direction-top-left {
|
||||
margin-top: 15px;
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
.md-menu-item .md-list-item-holder {
|
||||
overflow: visible;
|
||||
justify-content: flex-start;
|
||||
}
|
||||
|
||||
&.md-multiple {
|
||||
.md-checkbox {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.md-checkbox-label {
|
||||
padding-left: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,26 +1,12 @@
|
|||
<template>
|
||||
<div
|
||||
class="md-select"
|
||||
:class="classes"
|
||||
:tabindex="disabled ? null : '0'">
|
||||
<span
|
||||
class="md-select-value"
|
||||
@click="open"
|
||||
@keydown.enter.prevent="open"
|
||||
ref="value">{{ value || placeholder }}</span>
|
||||
<div class="md-select" :class="classes">
|
||||
<md-menu :md-close-on-select="!multiple">
|
||||
<span class="md-select-value" md-menu-trigger ref="value">{{ selectedValue || multiplevalue }}</span>
|
||||
|
||||
<div
|
||||
class="md-select-menu"
|
||||
tabindex="-1"
|
||||
ref="menu"
|
||||
@keydown.esc.prevent="close"
|
||||
@keydown.tab.prevent="close"
|
||||
@keydown.up.prevent="highlightOption(highlighted - 1)"
|
||||
@keydown.down.prevent="highlightOption(highlighted + 1)">
|
||||
<div class="md-select-menu-container">
|
||||
<md-menu-content class="md-select-content" :class="contentClasses">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
</md-menu-content>
|
||||
</md-menu>
|
||||
|
||||
<select :name="name" :id="id" :required="required" tabindex="-1">
|
||||
<option :value="value">{{ value }}</option>
|
||||
|
|
@ -31,81 +17,83 @@
|
|||
<style lang="scss" src="./mdSelect.scss"></style>
|
||||
|
||||
<script>
|
||||
import getClosestVueParent from '../../core/utils/getClosestVueParent';
|
||||
|
||||
export default {
|
||||
props: {
|
||||
name: String,
|
||||
required: Boolean,
|
||||
placeholder: [String, Number],
|
||||
value: [String, Number, Boolean],
|
||||
multiple: Boolean,
|
||||
value: [String, Number, Array],
|
||||
id: String,
|
||||
disabled: Boolean
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
active: false,
|
||||
highlighted: false,
|
||||
selectedValue: null,
|
||||
multiplevalue: null,
|
||||
options: {},
|
||||
optionsAmount: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
classes() {
|
||||
return {
|
||||
'md-disabled': this.disabled,
|
||||
'md-active': this.active
|
||||
'md-disabled': this.disabled
|
||||
};
|
||||
},
|
||||
contentClasses() {
|
||||
return {
|
||||
'md-multiple': this.multiple
|
||||
};
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
open() {
|
||||
this.active = true;
|
||||
document.addEventListener('click', this.closeOnOffClick);
|
||||
this.$refs.menu.focus();
|
||||
},
|
||||
close() {
|
||||
if (this.active) {
|
||||
this.$refs.menu.blur();
|
||||
this.active = false;
|
||||
document.removeEventListener('click', this.closeOnOffClick);
|
||||
this.$refs.value.focus();
|
||||
}
|
||||
},
|
||||
closeOnOffClick(event) {
|
||||
if (!this.$el.contains(event.target)) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
highlightOption(factor) {
|
||||
if (factor >= 1 && factor <= this.optionsAmount) {
|
||||
this.highlighted = factor;
|
||||
} else {
|
||||
this.highlighted = 1;
|
||||
}
|
||||
},
|
||||
selectOption(value) {
|
||||
this.close();
|
||||
changeValue(value, parentValue) {
|
||||
this.$emit('change', value);
|
||||
this.$emit('input', value);
|
||||
|
||||
if (this.isInsideContainer) {
|
||||
this.$parent.setValue(value);
|
||||
if (this.parentContainer) {
|
||||
this.$parent.setValue(parentValue || value);
|
||||
}
|
||||
},
|
||||
selectMultiple(index, value, text) {
|
||||
let output = [];
|
||||
let values = [];
|
||||
|
||||
this.options[index] = {
|
||||
value,
|
||||
text
|
||||
};
|
||||
|
||||
for (var key in this.options) {
|
||||
if (this.options.hasOwnProperty(key) && this.options[key].text) {
|
||||
output.push(this.options[key].text);
|
||||
values.push(this.options[key].value);
|
||||
}
|
||||
}
|
||||
|
||||
this.multiplevalue = output.join(', ');
|
||||
this.changeValue(values, this.multiplevalue);
|
||||
},
|
||||
selectOption(value, text) {
|
||||
this.selectedValue = text;
|
||||
this.changeValue(value);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.isInsideContainer = this.$parent.$el.classList.contains('md-input-container');
|
||||
this.parentContainer = this.parentContent = getClosestVueParent(this.$parent, 'md-input-container');
|
||||
|
||||
if (this.isInsideContainer) {
|
||||
this.$parent.setValue(this.value);
|
||||
this.$parent.hasSelect = true;
|
||||
if (this.parentContainer) {
|
||||
this.parentContainer.setValue(this.value);
|
||||
this.parentContainer.hasSelect = true;
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.isInsideContainer) {
|
||||
this.$parent.setValue(null);
|
||||
this.$parent.hasSelect = false;
|
||||
if (this.parentContainer) {
|
||||
this.parentContainer.setValue('');
|
||||
this.parentContainer.hasSelect = false;
|
||||
}
|
||||
|
||||
document.removeEventListener('click', this.closeOnOffClick);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@
|
|||
|
||||
.md-title {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 400;
|
||||
|
||||
&:first-child {
|
||||
|
|
|
|||
|
|
@ -5,45 +5,38 @@ export default function install(Vue) {
|
|||
let rippleParentClass = 'md-ink-ripple';
|
||||
let rippleClass = 'md-ripple';
|
||||
let rippleActiveClass = 'md-active';
|
||||
|
||||
let registeredMouseFunction;
|
||||
let referenceElement;
|
||||
|
||||
let unregisterMouseEvent = (element) => {
|
||||
let ripple = element.querySelector(':scope > .' + rippleParentClass);
|
||||
|
||||
if (ripple) {
|
||||
ripple.parentNode.removeChild(ripple);
|
||||
element.removeEventListener('mousedown', registeredMouseFunction);
|
||||
}
|
||||
let unregisterMouseEvent = () => {
|
||||
referenceElement.removeEventListener('mousedown', registeredMouseFunction);
|
||||
};
|
||||
|
||||
let registerMouseEvent = (element, holder) => {
|
||||
Vue.nextTick(() => {
|
||||
if (holder) {
|
||||
let ripple = holder.querySelector(':scope > .' + rippleParentClass + '> .' + rippleClass);
|
||||
if (holder) {
|
||||
let ripple = holder.querySelector(':scope > .' + rippleParentClass + '> .' + rippleClass);
|
||||
|
||||
if (ripple) {
|
||||
registeredMouseFunction = (event) => {
|
||||
let rect = holder.getBoundingClientRect();
|
||||
if (ripple) {
|
||||
registeredMouseFunction = (event) => {
|
||||
let rect = holder.getBoundingClientRect();
|
||||
|
||||
event.stopPropagation();
|
||||
event.stopPropagation();
|
||||
|
||||
ripple.classList.remove(rippleActiveClass);
|
||||
ripple.classList.remove(rippleActiveClass);
|
||||
|
||||
let top = event.pageY - rect.top - ripple.offsetHeight / 2 - document.body.scrollTop;
|
||||
let left = event.pageX - rect.left - ripple.offsetWidth / 2 - document.body.scrollLeft;
|
||||
let top = event.pageY - rect.top - ripple.offsetHeight / 2 - document.body.scrollTop;
|
||||
let left = event.pageX - rect.left - ripple.offsetWidth / 2 - document.body.scrollLeft;
|
||||
|
||||
ripple.style.top = top + 'px';
|
||||
ripple.style.left = left + 'px';
|
||||
ripple.style.top = top + 'px';
|
||||
ripple.style.left = left + 'px';
|
||||
|
||||
ripple.classList.add(rippleActiveClass);
|
||||
};
|
||||
ripple.classList.add(rippleActiveClass);
|
||||
};
|
||||
|
||||
element.removeEventListener('mousedown', registeredMouseFunction);
|
||||
element.addEventListener('mousedown', registeredMouseFunction);
|
||||
}
|
||||
element.removeEventListener('mousedown', registeredMouseFunction);
|
||||
element.addEventListener('mousedown', registeredMouseFunction);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let createElement = (ripple, className, size) => {
|
||||
|
|
@ -91,29 +84,26 @@ export default function install(Vue) {
|
|||
return found;
|
||||
};
|
||||
|
||||
let createRipple = (element) => {
|
||||
Vue.nextTick(() => {
|
||||
let holder = getClosestParent(element);
|
||||
let createRipple = (element, currentRipple) => {
|
||||
let holder = getClosestParent(element);
|
||||
|
||||
if (holder) {
|
||||
let ripple = holder.querySelector(':scope > .' + rippleParentClass + '> .' + rippleClass);
|
||||
if (holder) {
|
||||
let ripple = holder.querySelector(':scope > .' + rippleParentClass + '> .' + rippleClass);
|
||||
|
||||
if (!ripple) {
|
||||
let elementSize = Math.round(Math.max(holder.offsetWidth, holder.offsetHeight)) + 'px';
|
||||
let rippleParent = createElement(ripple, rippleParentClass);
|
||||
let rippleElement = createElement(ripple, rippleClass, elementSize);
|
||||
if (!ripple) {
|
||||
let elementSize = Math.round(Math.max(holder.offsetWidth, holder.offsetHeight)) + 'px';
|
||||
let rippleParent = currentRipple || createElement(ripple, rippleParentClass);
|
||||
let rippleElement = createElement(ripple, rippleClass, elementSize);
|
||||
|
||||
rippleParent.appendChild(rippleElement);
|
||||
holder.appendChild(rippleParent);
|
||||
}
|
||||
|
||||
if (holder !== element) {
|
||||
registerMouseEvent(element, holder);
|
||||
} else if (!ripple) {
|
||||
registerMouseEvent(element, holder);
|
||||
}
|
||||
rippleParent.appendChild(rippleElement);
|
||||
holder.appendChild(rippleParent);
|
||||
}
|
||||
});
|
||||
|
||||
if (holder !== element || !ripple) {
|
||||
referenceElement = element;
|
||||
registerMouseEvent(element, holder);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Vue.directive('mdInkRipple', function(el, bindings) {
|
||||
|
|
@ -125,4 +115,32 @@ export default function install(Vue) {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
Vue.component('md-ink-ripple', {
|
||||
props: {
|
||||
mdDisabled: Boolean
|
||||
},
|
||||
render(createElement) {
|
||||
return createElement('div', {
|
||||
staticClass: 'md-ink-ripple'
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
mdDisabled() {
|
||||
if (this.mdDisabled) {
|
||||
unregisterMouseEvent(this.$el.parentNode);
|
||||
} else {
|
||||
createRipple(this.$el.parentNode, this.$el);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.mdDisabled) {
|
||||
createRipple(this.$el.parentNode, this.$el);
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
unregisterMouseEvent(this.$el.parentNode);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,99 +41,99 @@ $shadow-key-umbra-opacity: .2 !default;
|
|||
$shadow-key-penumbra-opacity: .14 !default;
|
||||
$shadow-ambient-shadow-opacity: .12 !default;
|
||||
|
||||
$material-shadow-1dp: 0 1px 3px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 1px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 2px 1px -1px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-1dp: 0 1px 3px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 1px 1px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 2px 1px -1px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-2dp: 0 1px 5px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 2px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 3px 1px -2px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-2dp: 0 1px 5px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 2px 2px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 3px 1px -2px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-3dp: 0 1px 8px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 3px 4px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 3px 3px -2px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-3dp: 0 1px 8px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 3px 4px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 3px 3px -2px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-4dp: 0 2px 4px -1px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 4px 5px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 1px 10px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-4dp: 0 2px 4px -1px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 4px 5px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 1px 10px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-5dp: 0 3px 5px -1px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 5px 8px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 1px 14px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-5dp: 0 3px 5px -1px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 5px 8px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 1px 14px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-6dp: 0 3px 5px -1px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 6px 10px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 1px 18px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-6dp: 0 3px 5px -1px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 6px 10px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 1px 18px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-7dp: 0 4px 5px -2px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 7px 10px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 2px 16px 1px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-7dp: 0 4px 5px -2px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 7px 10px 1px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 2px 16px 1px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-8dp: 0 5px 5px -3px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 8px 10px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 3px 14px 2px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-8dp: 0 5px 5px -3px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 8px 10px 1px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 3px 14px 2px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-9dp: 0 5px 6px -3px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 9px 12px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 3px 16px 2px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-9dp: 0 5px 6px -3px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 9px 12px 1px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 3px 16px 2px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-10dp: 0 6px 6px -3px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 10px 14px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 4px 18px 3px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-10dp: 0 6px 6px -3px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 10px 14px 1px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 4px 18px 3px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-11dp: 0 6px 7px -4px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 11px 15px 1px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 4px 20px 3px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-11dp: 0 6px 7px -4px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 11px 15px 1px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 4px 20px 3px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-12dp: 0 7px 8px -4px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 12px 17px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 5px 22px 4px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-12dp: 0 7px 8px -4px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 12px 17px 2px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 5px 22px 4px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-13dp: 0 7px 8px -4px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 13px 19px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 5px 24px 4px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-13dp: 0 7px 8px -4px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 13px 19px 2px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 5px 24px 4px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-14dp: 0 7px 9px -4px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 14px 21px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 5px 26px 4px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-14dp: 0 7px 9px -4px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 14px 21px 2px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 5px 26px 4px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-15dp: 0 8px 9px -5px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 15px 22px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 6px 28px 5px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-15dp: 0 8px 9px -5px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 15px 22px 2px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 6px 28px 5px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-16dp: 0 8px 10px -5px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 16px 24px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 6px 30px 5px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-16dp: 0 8px 10px -5px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 16px 24px 2px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 6px 30px 5px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-17dp: 0 8px 11px -5px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 17px 26px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 6px 32px 5px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-17dp: 0 8px 11px -5px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 17px 26px 2px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 6px 32px 5px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-18dp: 0 9px 11px -5px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 18px 28px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 7px 34px 6px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-18dp: 0 9px 11px -5px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 18px 28px 2px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 7px 34px 6px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-19dp: 0 9px 12px -6px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 19px 29px 2px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 7px 36px 6px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-19dp: 0 9px 12px -6px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 19px 29px 2px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 7px 36px 6px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-20dp: 0 10px 13px -6px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 20px 31px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 8px 38px 7px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-20dp: 0 10px 13px -6px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 20px 31px 3px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 8px 38px 7px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-21dp: 0 10px 13px -6px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 21px 33px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 8px 40px 7px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-21dp: 0 10px 13px -6px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 21px 33px 3px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 8px 40px 7px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-22dp: 0 10px 14px -6px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 22px 35px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 8px 42px 7px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-22dp: 0 10px 14px -6px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 22px 35px 3px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 8px 42px 7px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-23dp: 0 11px 14px -7px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 23px 36px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 9px 44px 8px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-23dp: 0 11px 14px -7px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 23px 36px 3px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 9px 44px 8px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
$material-shadow-24dp: 0 11px 15px -7px rgba(0, 0, 0, $shadow-key-umbra-opacity),
|
||||
0 24px 38px 3px rgba(0, 0, 0, $shadow-key-penumbra-opacity),
|
||||
0 9px 46px 8px rgba(0, 0, 0, $shadow-ambient-shadow-opacity) !default;
|
||||
$material-shadow-24dp: 0 11px 15px -7px rgba(#000, $shadow-key-umbra-opacity),
|
||||
0 24px 38px 3px rgba(#000, $shadow-key-penumbra-opacity),
|
||||
0 9px 46px 8px rgba(#000, $shadow-ambient-shadow-opacity) !default;
|
||||
|
||||
|
|
|
|||
17
src/core/utils/animationEndEventName.js
Normal file
17
src/core/utils/animationEndEventName.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
function transitionEndEventName() {
|
||||
const el = document.createElement('span');
|
||||
const transitions = {
|
||||
transition: 'animationend',
|
||||
OTransition: 'oAnimationEnd',
|
||||
MozTransition: 'animationend',
|
||||
WebkitTransition: 'webkitAnimationEnd'
|
||||
};
|
||||
|
||||
for (let transition in transitions) {
|
||||
if (el.style[transition] !== undefined) {
|
||||
return transitions[transition];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default transitionEndEventName();
|
||||
17
src/core/utils/getClosestVueParent.js
Normal file
17
src/core/utils/getClosestVueParent.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
let getClosestVueParent = ($parent, cssClass) => {
|
||||
if (!$parent.$el) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($parent.$el.classList.contains(cssClass)) {
|
||||
return $parent;
|
||||
}
|
||||
|
||||
if ($parent._uid === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getClosestVueParent($parent.$parent, cssClass);
|
||||
};
|
||||
|
||||
export default getClosestVueParent;
|
||||
17
src/core/utils/transitionEndEventName.js
Normal file
17
src/core/utils/transitionEndEventName.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
function transitionEndEventName() {
|
||||
const el = document.createElement('span');
|
||||
const transitions = {
|
||||
transition: 'transitionend',
|
||||
OTransition: 'oTransitionEnd',
|
||||
MozTransition: 'transitionend',
|
||||
WebkitTransition: 'webkitTransitionEnd'
|
||||
};
|
||||
|
||||
for (let transition in transitions) {
|
||||
if (el.style[transition] !== undefined) {
|
||||
return transitions[transition];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default transitionEndEventName();
|
||||
|
|
@ -9,6 +9,7 @@ import mdDivider from './components/mdDivider';
|
|||
import mdIcon from './components/mdIcon';
|
||||
import mdInputContainer from './components/mdInputContainer';
|
||||
import mdList from './components/mdList';
|
||||
import mdMenu from './components/mdMenu';
|
||||
import mdRadio from './components/mdRadio';
|
||||
import mdSelect from './components/mdSelect';
|
||||
import mdSidenav from './components/mdSidenav';
|
||||
|
|
@ -32,6 +33,7 @@ let options = {
|
|||
mdIcon,
|
||||
mdInputContainer,
|
||||
mdList,
|
||||
mdMenu,
|
||||
mdRadio,
|
||||
mdSelect,
|
||||
mdSidenav,
|
||||
|
|
|
|||
Loading…
Reference in a new issue