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(VAutocomplete): make items copy-pasteable #7759

Merged
merged 2 commits into from
Sep 3, 2019
Merged

feat(VAutocomplete): make items copy-pasteable #7759

merged 2 commits into from
Sep 3, 2019

Conversation

dima74
Copy link
Contributor

@dima74 dima74 commented Jul 5, 2019

Description

  1. Add listener for copy events in v-autocomplete when it is focused. Process such event by replacing copy data with text of selected item (if such exists).

  2. Add listener for paste events on v-combobox input. If:

    • source of pasted text is item in another v-combobox/v-autocomplete
    • current combobox is multiple
    • search is empty
    • there are no items with same text

    then prevent default event behaviour (paste as text) and instead create new item with pasted text.

Motivation and Context

Fix #6226

How Has This Been Tested?

visually & unit

Markup:

<template>
  <v-container fill-height>
    <v-layout align-center justify-center>
      <v-flex xs4 text-xs-center>

        <v-autocomplete
          chips
          :items="['Aaa', 'Bbb', 'Ccc', 'Ddd']"
          :value="select1"
          label="1. Chips"
        />
        <v-autocomplete
          multiple
          :items="['Aaa', 'Bbb', 'Ccc', 'Ddd']"
          :value="select2"
          label="2. Multiple"
        />
        <v-autocomplete
          multiple
          chips
          :items="['Aaa', 'Bbb', 'Ccc', 'Ddd']"
          :value="select3"
          label="3. Multiple Chips"
        />
        <v-autocomplete
          solo
          multiple
          chips
          label="Empty autocomplete to paste into"
        />
        <v-combobox
          solo
          multiple
          chips
          :items="['Bbb', 'Ccc']"
          label="Empty combobox to paste into"
        />
        <v-text-field
          solo
          label="Empty text field to paste into"
        />

      </v-flex>
    </v-layout>
  </v-container>
</template>

<script>
  export default {
    data: () => ({
      select1: 'Aaa',
      select2: ['Bbb', 'Ccc'],
      select3: ['Bbb', 'Ccc'],
    }),
  };
</script>

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)

Checklist:

  • The PR title is no longer than 64 characters.
  • The PR is submitted to the correct branch (master for bug fixes and documentation updates, dev for new features and breaking changes).
  • My code follows the code style of this project.
  • I've added relevant changes to the documentation (applies to new features and breaking changes in core library)

Note

This is a continuation of #6289

@vercel vercel bot temporarily deployed to staging July 5, 2019 20:01 Inactive
@codecov
Copy link

codecov bot commented Jul 5, 2019

Codecov Report

Merging #7759 into dev will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             dev    #7759      +/-   ##
=========================================
+ Coverage   85.8%   85.84%   +0.04%     
=========================================
  Files        336      336              
  Lines       9099     9118      +19     
  Branches    2418     2422       +4     
=========================================
+ Hits        7807     7827      +20     
+ Misses      1204     1203       -1     
  Partials      88       88
Impacted Files Coverage Δ
...ages/vuetify/src/components/VCombobox/VCombobox.ts 89.65% <100%> (+1.04%) ⬆️
...tify/src/components/VAutocomplete/VAutocomplete.ts 99.3% <100%> (+0.05%) ⬆️
packages/vuetify/src/components/VSelect/VSelect.ts 94.13% <0%> (+0.36%) ⬆️

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 8ec6f05...8236b78. Read the comment docs.

@dsseng dsseng self-requested a review July 6, 2019 19:56
dsseng
dsseng previously approved these changes Jul 6, 2019
@dsseng dsseng added pending team review The issue is pending a full team review C: VAutocomplete VAutocomplete T: feature A new feature labels Jul 6, 2019
@dsseng dsseng added this to the v2.0.0 milestone Jul 6, 2019
@dsseng dsseng requested a review from johnleider July 6, 2019 20:02
@johnleider
Copy link
Member

I'd like to take a look at this before merging please, thank you.

@johnleider johnleider added the S: on hold The issue is on hold until further notice label Jul 18, 2019
@johnleider johnleider modified the milestones: v2.0.0, v2.x.x Jul 20, 2019
@jacekkarczmarczyk jacekkarczmarczyk added S: on hold The issue is on hold until further notice and removed S: on hold The issue is on hold until further notice labels Jul 28, 2019
@johnleider johnleider removed the S: on hold The issue is on hold until further notice label Aug 1, 2019
@johnleider johnleider changed the base branch from next to master August 1, 2019 17:43
@johnleider
Copy link
Member

johnleider commented Aug 1, 2019

I've removed the hold and changed the base branch to master dev. Can you please verify that everything you added is still in working order and let me know. We can then continue the review process.

@johnleider johnleider dismissed dsseng’s stale review August 1, 2019 17:44

removed hold/changed base branch

@johnleider johnleider changed the base branch from master to dev August 1, 2019 17:47
@dima74
Copy link
Contributor Author

dima74 commented Aug 1, 2019

@johnleider yes, I verify and it still works.

@dsseng dsseng requested review from johnleider and removed request for johnleider September 3, 2019 17:46
@johnleider johnleider merged commit c72f902 into vuetifyjs:dev Sep 3, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: VAutocomplete VAutocomplete pending team review The issue is pending a full team review T: feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants