/
Row.ts
executable file
·69 lines (62 loc) · 1.11 KB
/
Row.ts
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import Yox from 'yox'
import template from './template/Row.hbs'
import {
TRUE,
RAW_STRING,
RAW_NUMERIC
} from '../constant'
export default Yox.define({
propTypes: {
gutter: {
type: RAW_NUMERIC,
value: 0
},
type: {
type: RAW_STRING
},
justify: {
type: RAW_STRING
},
align: {
type: RAW_STRING
},
className: {
type: RAW_STRING
},
style: {
type: RAW_STRING
}
},
name: '${prefix}Row',
template,
watchers: {
gutter: {
watcher: function (value: number) {
this.fire(
'gutterChanged.row',
{
gutter: value
},
TRUE
)
},
immediate: TRUE
}
},
computed: {
inlineStyle(): string {
let gap = 0
let style = ''
if (this.get('style')
&& Yox.string.trim(this.get('style'))
&& !Yox.string.endsWith(style, ';')
) {
style += ';'
}
if (this.get('gutter')) {
gap = +this.get('gutter') / 2
}
return `${style}margin-left: -${gap}px; margin-right: -${gap}px;`
}
}
})