diff --git a/docs/src/pages/components/List.vue b/docs/src/pages/components/List.vue index 6b0239f..5f2728c 100644 --- a/docs/src/pages/components/List.vue +++ b/docs/src/pages/components/List.vue @@ -957,15 +957,7 @@ } .custom-list { - .md-list-action { - position: absolute; - top: 8px; - right: 16px; - pointer-events: auto; - z-index: 2; - } - - .md-icon { + .md-icon:not(.md-primary) { color: rgba(#000, .26); } } diff --git a/src/components/mdButton/mdButton.scss b/src/components/mdButton/mdButton.scss index fca4a68..6676bf6 100644 --- a/src/components/mdButton/mdButton.scss +++ b/src/components/mdButton/mdButton.scss @@ -161,6 +161,7 @@ $button-icon-size: 40px; &[disabled] { color: rgba(#000, .26); cursor: default; + pointer-events: none; &.md-raised, &.md-fab { diff --git a/src/components/mdList/index.js b/src/components/mdList/index.js index 45b88b5..fff4fb6 100644 --- a/src/components/mdList/index.js +++ b/src/components/mdList/index.js @@ -1,12 +1,12 @@ import mdList from './mdList.vue'; -import mdListItem from './mdListItem.vue'; +import mdListItem from './mdListItem.js'; import mdListExpand from './mdListExpand.vue'; import mdListTheme from './mdList.theme'; export default function install(Vue) { - Vue.component('md-list', Vue.extend(mdList)); - Vue.component('md-list-item', Vue.extend(mdListItem)); - Vue.component('md-list-expand', Vue.extend(mdListExpand)); + Vue.component('md-list', mdList); + Vue.component('md-list-item', mdListItem); + Vue.component('md-list-expand', mdListExpand); Vue.material.styles.push(mdListTheme); } diff --git a/src/components/mdList/mdList.scss b/src/components/mdList/mdList.scss index 2dd7fc1..c9d406e 100644 --- a/src/components/mdList/mdList.scss +++ b/src/components/mdList/mdList.scss @@ -114,10 +114,6 @@ .md-avatar { margin: 0; } - - .md-list-item-container { - align-items: flex-start; - } } .md-subheader { @@ -134,6 +130,12 @@ .md-list-item { height: auto; position: relative; + z-index: 2; + + &.md-disabled { + cursor: default; + pointer-events: none; + } &.md-inset { .md-list-item-container { @@ -141,15 +143,44 @@ } } - .md-list-item-holder { + .md-button-ghost { + width: 100%; + margin: 0; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + z-index: 1; + border-radius: 0; + } + + .md-button:not(.md-button-ghost):not(.md-list-item-container) { + position: relative; + z-index: 2; + + .md-icon { + position: relative; + } + } + + .md-list-item-container { + min-height: 48px; + margin: 0; + padding: 0 16px; display: flex; flex-flow: row nowrap; align-items: center; justify-content: space-between; flex: 1; + position: relative; + font-size: 16px; + font-weight: 400; + text-align: left; + text-transform: none; - > .md-ink-ripple { - border-radius: 0; + &:hover { + text-decoration: none; } > .md-icon:first-child { @@ -161,27 +192,14 @@ } .md-list-action { - margin: 0 -2px 0 0; + margin: 0 -10px 0 0; &:nth-child(3) { - margin: 0 -2px 0 16px; + margin: 0 -10px 0 16px; } } } - .md-list-item-container { - width: 100%; - min-height: 48px; - margin: 0; - padding: 0 16px; - position: relative; - border-radius: 0; - font-size: 16px; - font-weight: 400; - text-align: left; - text-transform: none; - } - .md-divider { position: absolute; bottom: 0; @@ -216,6 +234,7 @@ min-height: 48px; flex-flow: column wrap; overflow: hidden; + transform: translate3D(0, 0, 0); &:before, &:after { @@ -265,11 +284,6 @@ } } - > .md-list-item-container > .md-list-item-holder { - position: relative; - z-index: 2; - } - .md-expansion-indicator, .md-list-item-container, .md-icon { @@ -299,9 +313,14 @@ flex: 1; overflow: hidden; line-height: 1.25em; - text-overflow: ellipsis; white-space: normal; + > * { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + > :nth-child(1) { font-size: 16px; } diff --git a/src/components/mdList/mdListExpand.vue b/src/components/mdList/mdListExpand.vue index 85f430d..c6988f0 100644 --- a/src/components/mdList/mdListExpand.vue +++ b/src/components/mdList/mdListExpand.vue @@ -1,64 +1,5 @@ - - diff --git a/src/components/mdList/mdListItem.js b/src/components/mdList/mdListItem.js new file mode 100644 index 0000000..64a7192 --- /dev/null +++ b/src/components/mdList/mdListItem.js @@ -0,0 +1,277 @@ +/* + +*/ + +import MdListItemButton from './mdListItemButton'; +import MdListItemLink from './mdListItemLink'; +import MdListItemRouter from './mdListItemRouter'; +import mdListItemExpand from './mdListItemExpand'; +import MdListItemDefault from './mdListItemDefault'; + +export default { + functional: true, + props: { + href: String, + disabled: Boolean + }, + render(createElement, { children, data, props }) { + const getItemComponent = () => { + const nativeOn = data.nativeOn; + const interactionEvents = [ + 'contextmenu', + 'dblclick', + 'dragend', + 'mousedown', + 'touchstart', + 'click' + ]; + let childrenCount = children.length; + + if (props.href) { + return MdListItemLink; + } + + if (nativeOn) { + let counter = interactionEvents.length; + + while (counter--) { + if (nativeOn[interactionEvents[counter]]) { + return MdListItemButton; + } + } + } + + while (childrenCount--) { + const options = children[childrenCount].componentOptions; + + if (options) { + if (options.tag === 'md-list-expand') { + const expandComponent = children[childrenCount]; + + data.scopedSlots = { + expand: () => expandComponent + }; + + children.splice(childrenCount, 1); + + return mdListItemExpand; + } else if (options.tag === 'router-link') { + children[childrenCount].data.staticClass = 'md-list-item-container md-button'; + + return MdListItemRouter; + } + } + } + + return MdListItemDefault; + }; + + return createElement(getItemComponent(), { props, ...data }, children); + } +}; diff --git a/src/components/mdList/mdListItem.vue b/src/components/mdList/mdListItem.vue deleted file mode 100644 index 3a1b681..0000000 --- a/src/components/mdList/mdListItem.vue +++ /dev/null @@ -1,132 +0,0 @@ - diff --git a/src/components/mdList/mdListItemButton.vue b/src/components/mdList/mdListItemButton.vue new file mode 100644 index 0000000..8aaf5b5 --- /dev/null +++ b/src/components/mdList/mdListItemButton.vue @@ -0,0 +1,25 @@ + + + diff --git a/src/components/mdList/mdListItemDefault.vue b/src/components/mdList/mdListItemDefault.vue new file mode 100644 index 0000000..458a0d9 --- /dev/null +++ b/src/components/mdList/mdListItemDefault.vue @@ -0,0 +1,13 @@ + + + diff --git a/src/components/mdList/mdListItemExpand.vue b/src/components/mdList/mdListItemExpand.vue new file mode 100644 index 0000000..8e8b808 --- /dev/null +++ b/src/components/mdList/mdListItemExpand.vue @@ -0,0 +1,103 @@ + + + diff --git a/src/components/mdList/mdListItemLink.vue b/src/components/mdList/mdListItemLink.vue new file mode 100644 index 0000000..235585c --- /dev/null +++ b/src/components/mdList/mdListItemLink.vue @@ -0,0 +1,27 @@ + + + diff --git a/src/components/mdList/mdListItemRouter.vue b/src/components/mdList/mdListItemRouter.vue new file mode 100644 index 0000000..87b3d2f --- /dev/null +++ b/src/components/mdList/mdListItemRouter.vue @@ -0,0 +1,22 @@ + + + diff --git a/src/core/stylesheets/base.scss b/src/core/stylesheets/base.scss index 811abb2..3ef8d44 100644 --- a/src/core/stylesheets/base.scss +++ b/src/core/stylesheets/base.scss @@ -27,8 +27,13 @@ body { @extend .md-body-1; } -[tabindex='-1']:focus { - outline: none; + + +/* Fluid Media + ========================================================================== */ + +ul:not(.md-list) > li + li { + margin-top: 8px; }