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.
@@ -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>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <uni-forms-item :label="title" :name="field">
3
+ <slot></slot>
4
+ </uni-forms-item>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ name: 'ml-form-item',
10
+ props: {
11
+ title: String,
12
+ field: String
13
+ }
14
+ }
15
+ </script>
@@ -48,7 +48,9 @@ export default {
48
48
  <style lang="scss">
49
49
  .ml-input {
50
50
  font-size: $uni-font-size-base;
51
- padding: 0 10rpx;
51
+ .input-inp {
52
+ padding: 0 10rpx;
53
+ }
52
54
  &.is-right {
53
55
  .input-inp {
54
56
  text-align: right;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "components",