forked from quasarframework/quasar
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist-utils.js
More file actions
49 lines (45 loc) · 1.11 KB
/
list-utils.js
File metadata and controls
49 lines (45 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
export function textStyle (n) {
return n === void 0 || n < 2
? {}
: {overflow: 'hidden', display: '-webkit-box', '-webkit-box-orient': 'vertical', '-webkit-line-clamp': n}
}
const list = ['icon', 'label', 'sublabel', 'image', 'avatar', 'letter', 'stamp']
export function getType (prop) {
const len = list.length
for (let i = 0; i < len; i++) {
if (prop[list[i]]) {
return list[i]
}
}
return ''
}
export function itemClasses (prop) {
return {
'q-item': true,
'q-item-division': true,
'relative-position': true,
'q-item-dark': prop.dark,
'q-item-dense': prop.dense,
'q-item-sparse': prop.sparse,
'q-item-separator': prop.separator,
'q-item-inset-separator': prop.insetSeparator,
'q-item-multiline': prop.multiline,
'q-item-highlight': prop.highlight,
'q-item-link': prop.to || prop.link
}
}
export const ItemMixin = {
props: {
dark: Boolean,
dense: Boolean,
sparse: Boolean,
separator: Boolean,
insetSeparator: Boolean,
multiline: Boolean,
highlight: Boolean,
tag: {
type: String,
default: 'div'
}
}
}