mali-applet-ui 0.0.39 → 0.0.40
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 +3 -3
- package/components/ml-datetime-picker/ml-datetime-picker.vue +3 -3
- package/components/ml-datetime-range-picker/ml-datetime-range-picker.vue +2 -2
- package/components/ml-form/ml-form.vue +15 -3
- package/components/ml-form-item/ml-form-item.vue +34 -10
- package/components/ml-input/ml-input.vue +2 -2
- package/components/ml-textarea/ml-textarea.vue +5 -4
- package/package.json +1 -1
|
@@ -31,9 +31,9 @@ export default {
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
methods: {
|
|
34
|
-
changeEvent () {
|
|
35
|
-
this.$emit('input',
|
|
36
|
-
this.$emit('change', { value
|
|
34
|
+
changeEvent (value) {
|
|
35
|
+
this.$emit('input', value)
|
|
36
|
+
this.$emit('change', { value })
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -31,9 +31,9 @@ export default {
|
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
methods: {
|
|
34
|
-
changeEvent () {
|
|
35
|
-
this.$emit('input',
|
|
36
|
-
this.$emit('change', { value
|
|
34
|
+
changeEvent (value) {
|
|
35
|
+
this.$emit('input', value)
|
|
36
|
+
this.$emit('change', { value })
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -32,8 +32,8 @@ export default {
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
methods: {
|
|
35
|
-
changeEvent () {
|
|
36
|
-
const [startDate, endDate] =
|
|
35
|
+
changeEvent (value) {
|
|
36
|
+
const [startDate, endDate] = value
|
|
37
37
|
this.$emit('update:startDate', startDate)
|
|
38
38
|
this.$emit('update:endDate', endDate)
|
|
39
39
|
this.$emit('change', { startDate, endDate })
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="ml-form" :class="[className || '']">
|
|
3
3
|
<uni-forms :key="fKey" ref="uniForm" :modelValue="data" :rules="formRules" :label-position="vertical ? 'top' : 'left'">
|
|
4
|
-
<slot
|
|
4
|
+
<slot>
|
|
5
|
+
<view v-for="(item, index) in items" :key="index">
|
|
6
|
+
<ml-form-group v-if="item.children && item.children.length">
|
|
7
|
+
<ml-form-item v-for="(cItem, cIndex) in item.children" :key="cIndex" :title="cItem.title" :field="cItem.field" :itemRender="cItem.itemRender" @modelvalue="updateModel"></ml-form-item>
|
|
8
|
+
</ml-form-group>
|
|
9
|
+
<ml-form-item v-else :title="item.title" :field="item.field" :itemRender="item.itemRender" @modelvalue="updateModel"></ml-form-item>
|
|
10
|
+
</view>
|
|
11
|
+
</slot>
|
|
5
12
|
</uni-forms>
|
|
6
13
|
</view>
|
|
7
14
|
</template>
|
|
@@ -15,9 +22,11 @@ export default {
|
|
|
15
22
|
virtualHost: true
|
|
16
23
|
},
|
|
17
24
|
props: {
|
|
25
|
+
value: Object,
|
|
18
26
|
data: Object,
|
|
19
27
|
items: Array,
|
|
20
28
|
rules: Object,
|
|
29
|
+
readonly: Boolean,
|
|
21
30
|
vertical: Boolean,
|
|
22
31
|
labelWidth: String,
|
|
23
32
|
className: String
|
|
@@ -51,8 +60,8 @@ export default {
|
|
|
51
60
|
})
|
|
52
61
|
},
|
|
53
62
|
methods: {
|
|
54
|
-
|
|
55
|
-
return item.itemRender
|
|
63
|
+
getProp (item, prop, defultValue) {
|
|
64
|
+
return (item.itemRender.props ? item.itemRender.props[prop] : null) || defultValue
|
|
56
65
|
},
|
|
57
66
|
validate () {
|
|
58
67
|
return this.$refs.uniForm.validate().then(() => {
|
|
@@ -67,6 +76,9 @@ export default {
|
|
|
67
76
|
}).catch(() => {
|
|
68
77
|
return {}
|
|
69
78
|
})
|
|
79
|
+
},
|
|
80
|
+
updateModel ({ field, value}) {
|
|
81
|
+
this.$emit('input', { ...this.value, [field]: value })
|
|
70
82
|
}
|
|
71
83
|
}
|
|
72
84
|
}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
<view class="ml-form-item">
|
|
3
|
+
<uni-forms-item
|
|
4
|
+
ref="uniFormItem"
|
|
5
|
+
:class="className"
|
|
6
|
+
:label="title"
|
|
7
|
+
:name="field"
|
|
8
|
+
:label-width="itemLabelWidth"
|
|
9
|
+
:label-position="itemVertical">
|
|
10
|
+
<slot>
|
|
11
|
+
<ml-input v-if="matchComponent('MlInput')" :value="itemValue" border @change="modelEvent"></ml-input>
|
|
12
|
+
<ml-date-picker v-else-if="matchComponent('MlDatePicker')" :value="itemValue" border @change="modelEvent"></ml-date-picker>
|
|
13
|
+
<ml-select-picker v-else-if="matchComponent('MlSelectPicker')" :value="itemValue" :options="renderOpts.options" border @change="modelEvent"></ml-select-picker>
|
|
14
|
+
<ml-textarea v-else-if="matchComponent('MlTextarea')" :value="itemValue" :rows="renderOpts.rows || 3" border @change="modelEvent"></ml-textarea>
|
|
15
|
+
<view v-else>{{ itemValue }}</view>
|
|
16
|
+
</slot>
|
|
17
|
+
</uni-forms-item>
|
|
18
|
+
</view>
|
|
11
19
|
</template>
|
|
12
20
|
|
|
13
21
|
<script>
|
|
@@ -24,6 +32,7 @@ export default {
|
|
|
24
32
|
default: null
|
|
25
33
|
},
|
|
26
34
|
labelWidth: String,
|
|
35
|
+
itemRender: Object,
|
|
27
36
|
className: String
|
|
28
37
|
},
|
|
29
38
|
inject: {
|
|
@@ -33,6 +42,15 @@ export default {
|
|
|
33
42
|
}
|
|
34
43
|
},
|
|
35
44
|
computed: {
|
|
45
|
+
itemValue () {
|
|
46
|
+
return this.formData[this.field]
|
|
47
|
+
},
|
|
48
|
+
formData () {
|
|
49
|
+
return (this.form ? this.form.value : {}) || {}
|
|
50
|
+
},
|
|
51
|
+
renderOpts () {
|
|
52
|
+
return this.itemRender || {}
|
|
53
|
+
},
|
|
36
54
|
itemVertical () {
|
|
37
55
|
let vertical = this.vertical
|
|
38
56
|
if (!vertical) {
|
|
@@ -64,7 +82,13 @@ export default {
|
|
|
64
82
|
this.$nextTick(() => {
|
|
65
83
|
this.$refs.uniFormItem.localLabelPos = this.itemVertical
|
|
66
84
|
})
|
|
85
|
+
},
|
|
86
|
+
matchComponent (name) {
|
|
87
|
+
return this.renderOpts.name === name
|
|
88
|
+
},
|
|
89
|
+
modelEvent (params) {
|
|
90
|
+
this.$emit('modelvalue', { field: this.field, ...params })
|
|
67
91
|
}
|
|
68
92
|
}
|
|
69
93
|
}
|
|
70
|
-
</script>
|
|
94
|
+
</script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view class="ml-input" :class="[className || '', {'is-right': align === 'right', 'is-border': border, 'is-prefix': prefixIcon || type === 'search', 'is-suffix': suffixIcon, 'is-disabled': disabled}]">
|
|
3
3
|
<view v-if="prefixIcon || type === 'search'" class="ml-input-prefix-icon">
|
|
4
|
-
<ml-icon v-if="prefixIcon" :
|
|
4
|
+
<ml-icon v-if="prefixIcon" :className="prefixIcon"></ml-icon>
|
|
5
5
|
<ml-icon v-else name="search"></ml-icon>
|
|
6
6
|
</view>
|
|
7
7
|
<input
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
@input="inputEvent"
|
|
14
14
|
@confirm="confirmEvent"/>
|
|
15
15
|
<view v-if="suffixIcon" class="ml-input-suffix-icon">
|
|
16
|
-
<ml-icon :
|
|
16
|
+
<ml-icon :className="suffixIcon"></ml-icon>
|
|
17
17
|
</view>
|
|
18
18
|
</view>
|
|
19
19
|
</template>
|
|
@@ -67,11 +67,12 @@ export default {
|
|
|
67
67
|
},
|
|
68
68
|
methods: {
|
|
69
69
|
inputEvent () {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
this.$emit('input', this.inpVal)
|
|
70
|
+
let value = this.inpVal
|
|
71
|
+
if (this.maxLength && value &&value.length > this.maxLength) {
|
|
72
|
+
value = value.slice(0, this.maxLength)
|
|
74
73
|
}
|
|
74
|
+
this.$emit('input', value)
|
|
75
|
+
this.$emit('change', { value })
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
}
|