2121 -->
2222<template >
2323 <div >
24- <NcMultiselect :value =" currentValue"
24+ <NcSelect :value =" currentValue"
2525 :placeholder =" t('workflowengine', 'Select a file type')"
2626 label =" label"
27- track-by =" pattern"
2827 :options =" options"
29- :multiple =" false"
30- :tagging =" false"
28+ :clearable =" false"
3129 @input =" setValue" >
32- <template slot="singleLabel" slot-scope="props">
33- <span v-if =" props.option.icon" class =" option__icon" :class =" props.option.icon" />
34- <img v-else
35- class =" option__icon-img"
36- :src =" props.option.iconUrl"
37- alt =" " >
38- <span class =" option__title option__title_single" >{{ props.option.label }}</span >
30+ <template #option =" option " >
31+ <span v-if =" option.icon" class =" option__icon" :class =" option.icon" />
32+ <span v-else class =" option__icon-img" >
33+ <img :src =" option.iconUrl" alt =" " >
34+ </span >
35+ <span class =" option__title" >
36+ <NcEllipsisedOption :name =" String(option.label)" />
37+ </span >
3938 </template >
40- <template slot="option" slot-scope="props">
41- <span v-if =" props.option.icon" class =" option__icon" :class =" props.option.icon" />
42- <img v-else
43- class =" option__icon-img"
44- :src =" props.option.iconUrl"
45- alt =" " >
46- <span class =" option__title" >{{ props.option.label }}</span >
39+ <template #selected-option =" selectedOption " >
40+ <span v-if =" selectedOption.icon" class =" option__icon" :class =" selectedOption.icon" />
41+ <span v-else class =" option__icon-img" >
42+ <img :src =" selectedOption.iconUrl" alt =" " >
43+ </span >
44+ <span class =" option__title" >
45+ <NcEllipsisedOption :name =" String(selectedOption.label)" />
46+ </span >
4747 </template >
48- </NcMultiselect >
48+ </NcSelect >
4949 <input v-if =" !isPredefined"
5050 type =" text"
51- :value =" currentValue.pattern "
51+ :value =" currentValue.id "
5252 :placeholder =" t('workflowengine', 'e.g. httpd/unix-directory')"
5353 @input =" updateCustom" >
5454 </div >
5555</template >
5656
5757<script >
58- import NcMultiselect from ' @nextcloud/vue/dist/Components/NcMultiselect.js'
58+ import NcEllipsisedOption from ' @nextcloud/vue/dist/Components/NcEllipsisedOption.js'
59+ import NcSelect from ' @nextcloud/vue/dist/Components/NcSelect.js'
5960import valueMixin from ' ./../../mixins/valueMixin.js'
6061import { imagePath } from ' @nextcloud/router'
6162
6263export default {
6364 name: ' FileMimeType' ,
6465 components: {
65- NcMultiselect,
66+ NcEllipsisedOption,
67+ NcSelect,
6668 },
6769 mixins: [
6870 valueMixin,
@@ -73,22 +75,22 @@ export default {
7375 {
7476 icon: ' icon-folder' ,
7577 label: t (' workflowengine' , ' Folder' ),
76- pattern : ' httpd/unix-directory' ,
78+ id : ' httpd/unix-directory' ,
7779 },
7880 {
7981 icon: ' icon-picture' ,
8082 label: t (' workflowengine' , ' Images' ),
81- pattern : ' /image\\ /.*/' ,
83+ id : ' /image\\ /.*/' ,
8284 },
8385 {
8486 iconUrl: imagePath (' core' , ' filetypes/x-office-document' ),
8587 label: t (' workflowengine' , ' Office documents' ),
86- pattern : ' /(vnd\\ .(ms-|openxmlformats-|oasis\\ .opendocument).*)$/' ,
88+ id : ' /(vnd\\ .(ms-|openxmlformats-|oasis\\ .opendocument).*)$/' ,
8789 },
8890 {
8991 iconUrl: imagePath (' core' , ' filetypes/application-pdf' ),
9092 label: t (' workflowengine' , ' PDF documents' ),
91- pattern : ' application/pdf' ,
93+ id : ' application/pdf' ,
9294 },
9395 ],
9496 }
@@ -98,7 +100,7 @@ export default {
98100 return [... this .predefinedTypes , this .customValue ]
99101 },
100102 isPredefined () {
101- const matchingPredefined = this .predefinedTypes .find ((type ) => this .newValue === type .pattern )
103+ const matchingPredefined = this .predefinedTypes .find ((type ) => this .newValue === type .id )
102104 if (matchingPredefined) {
103105 return true
104106 }
@@ -108,18 +110,18 @@ export default {
108110 return {
109111 icon: ' icon-settings-dark' ,
110112 label: t (' workflowengine' , ' Custom MIME type' ),
111- pattern : ' ' ,
113+ id : ' ' ,
112114 }
113115 },
114116 currentValue () {
115- const matchingPredefined = this .predefinedTypes .find ((type ) => this .newValue === type .pattern )
117+ const matchingPredefined = this .predefinedTypes .find ((type ) => this .newValue === type .id )
116118 if (matchingPredefined) {
117119 return matchingPredefined
118120 }
119121 return {
120122 icon: ' icon-settings-dark' ,
121123 label: t (' workflowengine' , ' Custom mimetype' ),
122- pattern : this .newValue ,
124+ id : this .newValue ,
123125 }
124126 },
125127 },
@@ -131,7 +133,7 @@ export default {
131133 },
132134 setValue (value ) {
133135 if (value !== null ) {
134- this .newValue = value .pattern
136+ this .newValue = value .id
135137 this .$emit (' input' , this .newValue )
136138 }
137139 },
@@ -143,24 +145,30 @@ export default {
143145}
144146 </script >
145147<style scoped lang="scss">
146- .multiselect , input [type = ' text' ] {
148+ .v-select ,
149+ input [type = ' text' ] {
147150 width : 100% ;
148151}
149- .multiselect ::v-deep .multiselect__content-wrapper li > span ,
150- .multiselect ::v-deep .multiselect__single {
151- display : flex ;
152- white-space : nowrap ;
153- overflow : hidden ;
154- text-overflow : ellipsis ;
152+
153+ input [type = text ] {
154+ min-height : 48px ;
155155}
156156
157- .option__icon {
157+ .option__icon ,
158+ .option__icon-img {
158159 display : inline-block ;
159160 min-width : 30px ;
160- background-position : left ;
161+ background-position : center ;
162+ vertical-align : middle ;
161163}
162164
163165.option__icon-img {
164- margin-right : 14px ;
166+ text-align : center ;
167+ }
168+
169+ .option__title {
170+ display : inline-flex ;
171+ width : calc (100% - 36px );
172+ vertical-align : middle ;
165173}
166174 </style >
0 commit comments