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

feat(detachable): add activator scoped slot #5318

Merged
merged 16 commits into from Dec 18, 2018
Merged

Conversation

KaelWD
Copy link
Member

@KaelWD KaelWD commented Oct 12, 2018

Motivation and Context

fixes #2489
resolves #3030
fixes #3107
fixes #4428
fixes #5193

Markup:

<template>
  <v-app>
    <v-toolbar app>
      <v-spacer />
      <v-toolbar-items>
        <v-menu lazy attach>
          <v-btn flat slot="activator" slot-scope="props" v-on="props.on">menu</v-btn>
          <v-list>
            <v-list-tile @click>menu item 1</v-list-tile>
            <v-list-tile @click>menu item 2</v-list-tile>
            <v-list-tile @click>menu item 3</v-list-tile>
            <v-list-tile @click>menu item 4</v-list-tile>
            <v-list-tile @click>menu item 5</v-list-tile>
          </v-list>
        </v-menu>
        <v-tooltip bottom attach>
          <v-btn
            slot="activator"
            slot-scope="props"
            v-on="props.on"
            flat
          >
            tooltip
          </v-btn>
          <span>Tooltip</span>
        </v-tooltip>
      </v-toolbar-items>
    </v-toolbar>
    <v-content>
      <v-container>
        <v-menu lazy>
          <v-btn slot="activator" slot-scope="props" v-on="props.on">menu</v-btn>
          <v-list>
            <v-list-tile @click>menu item 1</v-list-tile>
            <v-list-tile @click>menu item 2</v-list-tile>
            <v-list-tile @click>menu item 3</v-list-tile>
            <v-list-tile @click>menu item 4</v-list-tile>
            <v-list-tile @click>menu item 5</v-list-tile>
          </v-list>
        </v-menu>

        <v-tooltip bottom>
          <v-btn
            slot="activator"
            slot-scope="props"
            v-on="props.on"
            color="primary"
            dark
          >
            tooltip
          </v-btn>
          <span>Tooltip</span>
        </v-tooltip>

        <v-dialog>
          <v-btn
            slot="activator"
            slot-scope="props"
            v-on="props.on"
            color="secondary"
            dark
          >
            dialog
          </v-btn>
          <v-card>
            <v-card-text>
              dialog
            </v-card-text>
          </v-card>
        </v-dialog>

        <v-layout row wrap>
          <v-flex xs12 sm12 md6>
            <v-card>
              <v-toolbar color="white" extended>
                <v-toolbar-side-icon></v-toolbar-side-icon>
                <v-tooltip top>
                  <v-btn
                    color="pink"
                    dark
                    small
                    absolute
                    bottom
                    right
                    fab
                    slot="activator"
                    slot-scope="props"
                    v-on="props.on"
                  >
                    <v-icon>add</v-icon>
                  </v-btn>
                  tooltip
                </v-tooltip>
              </v-toolbar>
              <v-card-text style="height: 228px;" class="blue lighten-5"></v-card-text>
              <v-card-text style="height: 100px; position: relative">
              </v-card-text>
            </v-card>
          </v-flex>
        </v-layout>

        <v-menu lazy>
          <v-tooltip slot="activator" slot-scope="menuProps" bottom>
            <v-btn slot="activator" slot-scope="props" v-on="Object.assign({}, props.on, menuProps.on)">menu + tooltip</v-btn>
            tooltip
          </v-tooltip>
          <v-list>
            <v-list-tile @click>menu item 1</v-list-tile>
            <v-list-tile @click>menu item 2</v-list-tile>
            <v-list-tile @click>menu item 3</v-list-tile>
            <v-list-tile @click>menu item 4</v-list-tile>
            <v-list-tile @click>menu item 5</v-list-tile>
          </v-list>
        </v-menu>
      </v-container>
    </v-content>
  </v-app>
</template>
<template>
  <v-app>
    <v-toolbar app>
      <v-spacer />
      <v-toolbar-items>
        <v-menu lazy attach offset-y>
          <v-btn flat slot="activator">menu</v-btn>
          <v-list>
            <v-list-tile @click>menu item 1</v-list-tile>
            <v-list-tile @click>menu item 2</v-list-tile>
            <v-list-tile @click>menu item 3</v-list-tile>
            <v-list-tile @click>menu item 4</v-list-tile>
            <v-list-tile @click>menu item 5</v-list-tile>
          </v-list>
        </v-menu>
        <v-menu lazy attach offset-y>
          <v-btn flat slot="activator" slot-scope="props" v-on="props.on">menu</v-btn>
          <v-list>
            <v-list-tile @click>menu item 1</v-list-tile>
            <v-list-tile @click>menu item 2</v-list-tile>
            <v-list-tile @click>menu item 3</v-list-tile>
            <v-list-tile @click>menu item 4</v-list-tile>
            <v-list-tile @click>menu item 5</v-list-tile>
          </v-list>
        </v-menu>
        <v-tooltip bottom attach>
          <v-btn
            slot="activator"
            slot-scope="props"
            v-on="props.on"
            flat
          >
            tooltip
          </v-btn>
          <span>Tooltip</span>
        </v-tooltip>
      </v-toolbar-items>
    </v-toolbar>
    <v-content>
      <v-container>
        <v-select :items="['a', 'b', 'c']" attach></v-select>
        <v-combobox :items="['a', 'b', 'c']" attach></v-combobox>
        <v-menu attach>
          <v-btn slot="activator" slot-scope="data" v-on="data.on">menu</v-btn>
          <v-list>
            <v-list-tile @click>menu item 1</v-list-tile>
            <v-list-tile @click>menu item 2</v-list-tile>
            <v-list-tile @click>menu item 3</v-list-tile>
            <v-list-tile @click>menu item 4</v-list-tile>
            <v-list-tile @click>menu item 5</v-list-tile>
          </v-list>
        </v-menu>
        <v-menu attach>
          <v-btn slot="activator">menu</v-btn>
          <v-list>
            <v-list-tile @click>menu item 1</v-list-tile>
            <v-list-tile @click>menu item 2</v-list-tile>
            <v-list-tile @click>menu item 3</v-list-tile>
            <v-list-tile @click>menu item 4</v-list-tile>
            <v-list-tile @click>menu item 5</v-list-tile>
          </v-list>
        </v-menu>
        <v-tooltip bottom attach>
          <v-btn
            slot="activator"
            slot-scope="props"
            v-on="props.on"
            flat
          >
            tooltip
          </v-btn>
          <span>Tooltip</span>
        </v-tooltip>
        <v-tooltip right attach>
          <v-btn
            slot="activator"
            slot-scope="props"
            v-on="props.on"
            flat
          >
            tooltip
          </v-btn>
          <span>Tooltip</span>
        </v-tooltip>
        <v-tooltip bottom>
          <v-btn
            slot="activator"
            slot-scope="props"
            v-on="props.on"
            flat
          >
            tooltip
          </v-btn>
          <span>Tooltip</span>
        </v-tooltip>
        <v-tooltip right>
          <v-btn
            slot="activator"
            slot-scope="props"
            v-on="props.on"
            flat
          >
            tooltip
          </v-btn>
          <span>Tooltip</span>
        </v-tooltip>
        <v-combobox :items="['a', 'b', 'c']"></v-combobox>
      </v-container>
    </v-content>
  </v-app>
</template>

TODO

  • menus
  • tooltips
  • dialogs
  • unit tests
  • detachable needs to change, [Bug Report] Tooltip does not work with fab #3107 requires that the activator doesn't have anything extra around it
  • Still can't nest two detachables, the wrong element gets moved
  • Attached menu/tooltip has incorrect positioning

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Improvement/refactoring (non-breaking change that doesn't add any feature but make things better)

@codecov
Copy link

codecov bot commented Oct 12, 2018

Codecov Report

Merging #5318 into dev will decrease coverage by 0.1%.
The diff coverage is 76%.

Impacted file tree graph

@@           Coverage Diff            @@
##             dev   #5318      +/-   ##
========================================
- Coverage   88.7%   88.6%   -0.11%     
========================================
  Files        281     281              
  Lines       6251    6300      +49     
  Branches    1566    1581      +15     
========================================
+ Hits        5545    5582      +37     
- Misses       590     600      +10     
- Partials     116     118       +2
Impacted Files Coverage Δ
...tify/src/components/VMenu/mixins/menu-activator.js 46.15% <50%> (ø) ⬆️
...ify/src/components/VMenu/mixins/menu-generators.js 78.12% <58.33%> (-6.5%) ⬇️
packages/vuetify/src/mixins/detachable.js 90.9% <75%> (-2.2%) ⬇️
packages/vuetify/src/components/VDialog/VDialog.js 72% <80%> (-0.73%) ⬇️
packages/vuetify/src/mixins/menuable.js 91.86% <80%> (-3.42%) ⬇️
...ckages/vuetify/src/components/VTooltip/VTooltip.js 84.74% <82.35%> (-2.22%) ⬇️
packages/vuetify/src/mixins/overlayable.js 49.43% <0%> (+2.24%) ⬆️
...fy/src/components/transitions/expand-transition.js 76% <0%> (+4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f783f21...be1003e. Read the comment docs.

@KaelWD KaelWD changed the title feat(VMenu): add activator scoped slot feat(detachable): add activator scoped slot Oct 12, 2018
SajibMahmud
SajibMahmud previously approved these changes Oct 16, 2018
@KaelWD KaelWD added this to the v1.4.0 milestone Oct 21, 2018
@KaelWD KaelWD added the S: has merge conflicts The pending Pull Request has merge conflicts label Oct 29, 2018
@KaelWD KaelWD force-pushed the feat/3030-activator-scoped-slot branch from 347c692 to e5a1640 Compare November 10, 2018 14:16
@KaelWD KaelWD removed the S: has merge conflicts The pending Pull Request has merge conflicts label Nov 10, 2018
@johnleider
Copy link
Member

Is all that's left is adding unit tests? If so I'll lend a hand.

@KaelWD
Copy link
Member Author

KaelWD commented Nov 23, 2018

And the position calculations need rewriting for attached menus.

@johnleider johnleider added T: feature A new feature and removed T: feature A new feature labels Dec 2, 2018
@johnleider johnleider removed this from the v1.4.0 milestone Dec 16, 2018
@KaelWD KaelWD force-pushed the feat/3030-activator-scoped-slot branch from 874a4c5 to 11ab339 Compare December 17, 2018 12:33
@KaelWD KaelWD added this to the v1.4.0 milestone Dec 17, 2018
@KaelWD KaelWD merged commit a025093 into dev Dec 18, 2018
@KaelWD KaelWD deleted the feat/3030-activator-scoped-slot branch December 18, 2018 14:11
KaelWD added a commit that referenced this pull request Dec 18, 2018
@lock
Copy link

lock bot commented Apr 14, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

@lock lock bot locked as resolved and limited conversation to collaborators Apr 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants