mali-applet-ui 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ml-date-picker/ml-date-picker.vue +36 -0
- package/components/ml-date-range-picker/ml-date-range-picker.vue +43 -0
- package/components/ml-datetime-picker/ml-datetime-picker.vue +36 -0
- package/components/ml-datetime-range-picker/ml-datetime-range-picker.vue +39 -0
- package/components/ml-form/ml-form.vue +58 -0
- package/components/ml-form-item/ml-form-item.vue +15 -0
- package/components/ml-input/ml-input.vue +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<uni-datetime-picker v-model="selectVal" type="date" :start="start" :end="end" @change="changeEvent" :border="border"/>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'ml-date-picker',
|
|
8
|
+
props: {
|
|
9
|
+
value: String,
|
|
10
|
+
border: Boolean,
|
|
11
|
+
start: [String, Number],
|
|
12
|
+
end: [String, Number],
|
|
13
|
+
},
|
|
14
|
+
data () {
|
|
15
|
+
return {
|
|
16
|
+
selectVal: ''
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
watch: {
|
|
20
|
+
value (value) {
|
|
21
|
+
this.selectVal = value
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
created () {
|
|
25
|
+
if (this.value) {
|
|
26
|
+
this.selectVal = this.value
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
changeEvent () {
|
|
31
|
+
this.$emit('input', this.selectVal)
|
|
32
|
+
this.$emit('change', { value: this.selectVal })
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<uni-datetime-picker v-model="selectDates" type="daterange" :start="start" :end="end" @change="changeEvent" :border="border" :clear-icon="clear"/>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'ml-date-range-picker',
|
|
8
|
+
props: {
|
|
9
|
+
border: Boolean,
|
|
10
|
+
startDate: String,
|
|
11
|
+
endDate: String,
|
|
12
|
+
start: [String, Number],
|
|
13
|
+
end: [String, Number],
|
|
14
|
+
clear: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: true
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
data () {
|
|
20
|
+
return {
|
|
21
|
+
selectDates: []
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
watch: {
|
|
25
|
+
startDate () {
|
|
26
|
+
this.selectDates = this.startDate && this.endDate ? [this.startDate, this.endDate] : []
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
created () {
|
|
30
|
+
if (this.startDate) {
|
|
31
|
+
this.selectDates = this.startDate && this.endDate ? [this.startDate, this.endDate] : []
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
methods: {
|
|
35
|
+
changeEvent (value) {
|
|
36
|
+
const [startDate, endDate] = value
|
|
37
|
+
this.$emit('update:startDate', startDate || '')
|
|
38
|
+
this.$emit('update:endDate', endDate || '')
|
|
39
|
+
this.$emit('change', { startDate, endDate })
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<uni-datetime-picker v-model="selectVal" type="datetime" :start="start" :end="end" @change="changeEvent" :border="border"/>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'ml-date-picker',
|
|
8
|
+
props: {
|
|
9
|
+
value: String,
|
|
10
|
+
border: Boolean,
|
|
11
|
+
start: [String, Number],
|
|
12
|
+
end: [String, Number],
|
|
13
|
+
},
|
|
14
|
+
data () {
|
|
15
|
+
return {
|
|
16
|
+
selectVal: ''
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
watch: {
|
|
20
|
+
value (value) {
|
|
21
|
+
this.selectVal = value
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
created () {
|
|
25
|
+
if (this.value) {
|
|
26
|
+
this.selectVal = this.value
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
methods: {
|
|
30
|
+
changeEvent () {
|
|
31
|
+
this.$emit('input', this.selectVal)
|
|
32
|
+
this.$emit('change', { value: this.selectVal })
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<uni-datetime-picker v-model="selectDates" type="datetimerange" :start="start" :end="end" @change="changeEvent" :border="border"/>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'ml-datetime-range-picker',
|
|
8
|
+
props: {
|
|
9
|
+
border: Boolean,
|
|
10
|
+
startDate: String,
|
|
11
|
+
endDate: String,
|
|
12
|
+
start: [String, Number],
|
|
13
|
+
end: [String, Number]
|
|
14
|
+
},
|
|
15
|
+
data () {
|
|
16
|
+
return {
|
|
17
|
+
selectDates: []
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
watch: {
|
|
21
|
+
startDate () {
|
|
22
|
+
this.selectDates = this.startDate && this.endDate ? [this.startDate, this.endDate] : []
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
created () {
|
|
26
|
+
if (this.startDate) {
|
|
27
|
+
this.selectDates = this.startDate && this.endDate ? [this.startDate, this.endDate] : []
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
changeEvent () {
|
|
32
|
+
const [startDate, endDate] = this.selectDates
|
|
33
|
+
this.$emit('update:startDate', startDate)
|
|
34
|
+
this.$emit('update:endDate', endDate)
|
|
35
|
+
this.$emit('change', { startDate, endDate })
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view class="ml-form">
|
|
3
|
+
<uni-forms ref="uniForm" :modelValue="data" :rules="formRules">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</uni-forms>
|
|
6
|
+
</view>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
import XEUtils from 'xe-utils'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
name: 'ml-form',
|
|
14
|
+
props: {
|
|
15
|
+
data: Object,
|
|
16
|
+
items: Array,
|
|
17
|
+
rules: Object
|
|
18
|
+
},
|
|
19
|
+
data () {
|
|
20
|
+
return {
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
formRules () {
|
|
26
|
+
const rest = {}
|
|
27
|
+
XEUtils.each(this.rules, (rules, field) => {
|
|
28
|
+
rest[field] = {
|
|
29
|
+
rules: rules.map(item => {
|
|
30
|
+
return { ...item, errorMessage: item.message }
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
return rest
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
matchComponent (item, name) {
|
|
39
|
+
return item.itemRender && item.itemRender.name === name
|
|
40
|
+
},
|
|
41
|
+
validate () {
|
|
42
|
+
debugger
|
|
43
|
+
return this.$refs.uniForm.validate().then(() => {
|
|
44
|
+
return null
|
|
45
|
+
}).catch(() => {
|
|
46
|
+
return {}
|
|
47
|
+
})
|
|
48
|
+
},
|
|
49
|
+
validateField (fields) {
|
|
50
|
+
return this.$refs.uniForm.validateField(fields).then(() => {
|
|
51
|
+
return null
|
|
52
|
+
}).catch(() => {
|
|
53
|
+
return {}
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
</script>
|