Added multiselect
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
Родитель
d6989a7027
Коммит
c379ca31f3
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "nextcloud-vue",
|
||||
"version": "0.1.4",
|
||||
"version": "0.1.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -14694,6 +14694,11 @@
|
|||
"vue-style-loader": "^4.1.0"
|
||||
}
|
||||
},
|
||||
"vue-multiselect": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/vue-multiselect/-/vue-multiselect-2.1.0.tgz",
|
||||
"integrity": "sha512-mEhApxZ6MUISGLuGDy0RF5UlAKUgG/Qq0DWYE/C+CA1h6ZszM3cHfpNFfFm2AMWLclY2SAWpY1HlQLjsw8WnvQ=="
|
||||
},
|
||||
"vue-resize": {
|
||||
"version": "0.4.4",
|
||||
"resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-0.4.4.tgz",
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
"v-tooltip": "^2.0.0-rc.33",
|
||||
"vue": "^2.5.16",
|
||||
"vue-click-outside": "^1.0.7",
|
||||
"vue-multiselect": "^2.1.0",
|
||||
"vue2-datepicker": "^2.4.1"
|
||||
},
|
||||
"engines": {
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
|
||||
*
|
||||
* @author John Molakvoæ <skjnldsv@protonmail.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
import Multiselect from 'vue-multiselect'
|
||||
import './index.scss'
|
||||
|
||||
export default Multiselect
|
||||
export { Multiselect }
|
|
@ -0,0 +1,201 @@
|
|||
.multiselect {
|
||||
margin: 1px 2px;
|
||||
padding: 0 !important;
|
||||
display: inline-block;
|
||||
width: 160px;
|
||||
position: relative;
|
||||
background-color: var(--color-main-background);
|
||||
&.multiselect--active {
|
||||
/* Opened: force display the input */
|
||||
input.multiselect__input {
|
||||
opacity: 1 !important;
|
||||
cursor: text !important;
|
||||
}
|
||||
}
|
||||
&.multiselect--disabled,
|
||||
&.multiselect--disabled .multiselect__single {
|
||||
background-color: var(--color-background-dark) !important;
|
||||
}
|
||||
.multiselect__tags {
|
||||
/* space between tags and limit tag */
|
||||
$space-between: 5px;
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--color-border-dark);
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
border-radius: 3px;
|
||||
height: 34px;
|
||||
/* tag wrapper */
|
||||
.multiselect__tags-wrap {
|
||||
align-items: center;
|
||||
display: inline-flex;
|
||||
overflow: hidden;
|
||||
max-width: 100%;
|
||||
position: relative;
|
||||
padding: 3px $space-between;
|
||||
flex-grow: 1;
|
||||
/* no tags or simple select? Show input directly
|
||||
input is used to display single value */
|
||||
&:empty ~ input.multiselect__input {
|
||||
opacity: 1 !important;
|
||||
/* hide default empty text, show input instead */
|
||||
+ span:not(.multiselect__single) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
/* selected tag */
|
||||
.multiselect__tag {
|
||||
flex: 1 0 0;
|
||||
line-height: 20px;
|
||||
padding: 1px 5px;
|
||||
background-image: none;
|
||||
color: var(--color-text-lighter);
|
||||
border: 1px solid var(--color-border-dark);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
border-radius: 3px;
|
||||
/* require to override the default width
|
||||
and force the tag to shring properly */
|
||||
min-width: 0;
|
||||
max-width: 50%;
|
||||
max-width: fit-content;
|
||||
max-width: -moz-fit-content;
|
||||
/* css hack, detect if more than two tags
|
||||
if so, flex-basis is set to half */
|
||||
&:only-child {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
&:not(:last-child) {
|
||||
margin-right: $space-between;
|
||||
}
|
||||
/* ellipsis the groups to be sure
|
||||
we display at least two of them */
|
||||
> span {
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Single select default value */
|
||||
.multiselect__single {
|
||||
padding: 8px 10px;
|
||||
flex: 0 0 100%;
|
||||
z-index: 1; /* above input */
|
||||
background-color: var(--color-main-background);
|
||||
cursor: pointer;
|
||||
line-height: 17px;
|
||||
}
|
||||
/* displayed text if tag limit reached */
|
||||
.multiselect__strong,
|
||||
.multiselect__limit {
|
||||
flex: 0 0 auto;
|
||||
line-height: 20px;
|
||||
color: var(--color-text-lighter);
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
opacity: .7;
|
||||
margin-right: $space-between;
|
||||
/* above the input */
|
||||
z-index: 5;
|
||||
}
|
||||
/* default multiselect input for search and placeholder */
|
||||
input.multiselect__input {
|
||||
width: 100% !important;
|
||||
position: absolute !important;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
/* let's leave it on top of tags but hide it */
|
||||
height: 100%;
|
||||
border: none;
|
||||
/* override hide to force show the placeholder */
|
||||
display: block !important;
|
||||
/* only when not active */
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
/* results wrapper */
|
||||
.multiselect__content-wrapper {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
margin-top: -1px;
|
||||
border: 1px solid var(--color-border-dark);
|
||||
background: var(--color-main-background);
|
||||
z-index: 50;
|
||||
max-height: 250px;
|
||||
overflow-y: auto;
|
||||
.multiselect__content {
|
||||
width: 100%;
|
||||
padding: 5px 0;
|
||||
}
|
||||
li {
|
||||
padding: 5px;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: transparent;
|
||||
&,
|
||||
span {
|
||||
cursor: pointer;
|
||||
}
|
||||
> span {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
height: 20px;
|
||||
margin: 0;
|
||||
min-height: 1em;
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
background-color: transparent !important;
|
||||
color: var(--color-text-lighter);
|
||||
width: 100%;
|
||||
/* selected checkmark icon */
|
||||
&::before {
|
||||
content: ' ';
|
||||
background-image: var(--icon-checkmark-000);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
min-width: 16px;
|
||||
min-height: 16px;
|
||||
display: block;
|
||||
opacity: .5;
|
||||
margin-right: 5px;
|
||||
visibility: hidden;
|
||||
}
|
||||
&.multiselect__option--disabled {
|
||||
background-color: var(--color-background-dark);
|
||||
opacity: .5;
|
||||
}
|
||||
/* add the prop tag-placeholder="create" to add the +
|
||||
* icon on top of an unknown-and-ready-to-be-created entry
|
||||
*/
|
||||
&[data-select='create'] {
|
||||
&::before {
|
||||
background-image: var(--icon-add-000);
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
&.multiselect__option--highlight {
|
||||
color: var(--color-main-text);
|
||||
}
|
||||
&:not(.multiselect__option--disabled):hover::before {
|
||||
opacity: .3;
|
||||
}
|
||||
&.multiselect__option--selected,
|
||||
&:not(.multiselect__option--disabled):hover {
|
||||
&::before {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -23,9 +23,11 @@
|
|||
import AppNavigation from './AppNavigation'
|
||||
import PopoverMenu from './PopoverMenu'
|
||||
import DatetimePicker from './DatetimePicker'
|
||||
import Multiselect from './Multiselect'
|
||||
|
||||
export {
|
||||
AppNavigation,
|
||||
PopoverMenu,
|
||||
DatetimePicker
|
||||
DatetimePicker,
|
||||
Multiselect
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче