mali-applet-ui 1.0.49 → 1.0.50

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.
@@ -35,10 +35,10 @@
35
35
  </view>
36
36
  </view>
37
37
 
38
- <FixedBottom v-if="showApproveBtn">
38
+ <ml-fixed-footer v-if="showApproveBtn">
39
39
  <ml-button @click="openApproval(false)">驳回</ml-button>
40
40
  <ml-button status="primary" @click="openApproval(true)" >通过</ml-button>
41
- </FixedBottom>
41
+ </ml-fixed-footer>
42
42
 
43
43
  <ml-drawer v-model="showPopup" height="210rpx" :title="`审批状态:${isPass ? '通过' : '驳回'}`" showFooter>
44
44
  <ml-textarea v-model="approveContent" border fontColor="#000" showVoice></ml-textarea>
@@ -0,0 +1,105 @@
1
+ <template>
2
+ <view class="ml-fixed-footer" :class="{'is-background': background}" :style="styles">
3
+ <view class="ml-fixed-footer-warpper">
4
+ <slot></slot>
5
+ </view>
6
+ </view>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'MlFixedFooter',
12
+ props: {
13
+ bottom: String,
14
+ background: {
15
+ type: Boolean,
16
+ default: true
17
+ },
18
+ backgroundColor: String
19
+ },
20
+ provide () {
21
+ return {
22
+ $pageFixedBottom: this
23
+ }
24
+ },
25
+ inject: {
26
+ layout: {
27
+ from: '$pageLayout',
28
+ default: null
29
+ },
30
+ tabs: {
31
+ from: 'mlTabs',
32
+ default: null
33
+ }
34
+ },
35
+ computed: {
36
+ styles () {
37
+ const bomSys = this.bottom ? `bottom:${this.bottom};` : ''
38
+ const bgSys = this.backgroundColor ? `background:${this.backgroundColor};` : ''
39
+ return `${bomSys}${bgSys}`
40
+ },
41
+ activeTab () {
42
+ if (this.tabs) {
43
+ return this.tabs.value
44
+ }
45
+ return null
46
+ }
47
+ },
48
+ watch: {
49
+ activeTab () {
50
+ this.updateStyle()
51
+ }
52
+ },
53
+ mounted () {
54
+ this.updateStyle()
55
+ },
56
+ methods: {
57
+ updateStyle () {
58
+ this.$nextTick(() => {
59
+ this.calculateStyle(20)
60
+ this.calculateStyle(50)
61
+ this.calculateStyle(150)
62
+ this.calculateStyle(300)
63
+ this.calculateStyle(800)
64
+ this.calculateStyle(1500)
65
+ })
66
+ },
67
+ calculateStyle (timeout) {
68
+ setTimeout(() => {
69
+ const query = uni.createSelectorQuery().in(this)
70
+ query.select('.ml-fixed-footer-warpper').boundingClientRect((data) => {
71
+ if (data && data.height && this.layout && this.layout.setPaddingBottom) {
72
+ this.layout.setPaddingBottom(`${data.height}px`)
73
+ }
74
+ }).exec()
75
+ }, timeout || 20)
76
+ }
77
+ }
78
+ }
79
+ </script>
80
+
81
+ <style lang="scss">
82
+ .ml-fixed-footer {
83
+ position: fixed;
84
+ left: 0;
85
+ width: $ml-page-full-width;
86
+ bottom: 0;
87
+ z-index: 20;
88
+ box-shadow: 0px -2px 4px 0px rgba(0,0,0,0.1);
89
+ // #ifdef H5
90
+ left: 50%;
91
+ transform: translateX(-50%);
92
+ // #endif
93
+ &.is-background {
94
+ background-color: #ffffff;
95
+ }
96
+ .ml-fixed-footer-warpper {
97
+ display: flex;
98
+ flex-direction: row;
99
+ padding: 20rpx $ml-page-interval-margin 60rpx $ml-page-interval-margin;
100
+ // #ifdef H5
101
+ padding-left: calc($ml-page-toolbar-left-width + $ml-page-interval-margin);
102
+ // #endif
103
+ }
104
+ }
105
+ </style>
@@ -0,0 +1,99 @@
1
+ <template>
2
+ <view class="ml-fixed-header" :class="{'is-background': background}" :style="styles">
3
+ <view class="ml-fixed-header-warpper">
4
+ <slot></slot>
5
+ </view>
6
+ </view>
7
+ </template>
8
+
9
+ <script>
10
+ export default {
11
+ name: 'MlFixedHeader',
12
+ props: {
13
+ background: {
14
+ type: Boolean,
15
+ default: true
16
+ },
17
+ backgroundColor: String
18
+ },
19
+ provide () {
20
+ return {
21
+ $pageFixedTop: this
22
+ }
23
+ },
24
+ inject: {
25
+ layout: {
26
+ from: '$pageLayout',
27
+ default: null
28
+ },
29
+ tabs: {
30
+ from: 'mlTabs',
31
+ default: null
32
+ }
33
+ },
34
+ computed: {
35
+ styles () {
36
+ const bgSys = this.backgroundColor ? `background:${this.backgroundColor};` : ''
37
+ return `${bgSys}`
38
+ },
39
+ activeTab () {
40
+ if (this.tabs) {
41
+ return this.tabs.value
42
+ }
43
+ return null
44
+ }
45
+ },
46
+ watch: {
47
+ activeTab () {
48
+ this.updateStyle()
49
+ }
50
+ },
51
+ mounted () {
52
+ this.updateStyle()
53
+ },
54
+ methods: {
55
+ updateStyle () {
56
+ this.$nextTick(() => {
57
+ this.calculateStyle(20)
58
+ this.calculateStyle(50)
59
+ this.calculateStyle(150)
60
+ this.calculateStyle(300)
61
+ this.calculateStyle(800)
62
+ this.calculateStyle(1500)
63
+ })
64
+ },
65
+ calculateStyle (timeout) {
66
+ setTimeout(() => {
67
+ const query = uni.createSelectorQuery().in(this)
68
+ query.select('.ml-fixed-header-warpper').boundingClientRect((data) => {
69
+ if (data && data.height && this.layout && this.layout.setPaddingTop) {
70
+ this.layout.setPaddingTop(`${data.height}px`)
71
+ }
72
+ }).exec()
73
+ }, timeout || 20)
74
+ }
75
+ }
76
+ }
77
+ </script>
78
+
79
+ <style lang="scss">
80
+ .ml-fixed-header {
81
+ position: fixed;
82
+ left: 0;
83
+ top: 0;
84
+ z-index: 20;
85
+ width: $ml-page-full-width;
86
+ box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
87
+ // #ifdef H5
88
+ left: 50%;
89
+ transform: translateX(-50%);
90
+ // #endif
91
+ &.is-background {
92
+ background-color: #ffffff;
93
+ }
94
+ .ml-fixed-header-warpper {
95
+ display: flex;
96
+ flex-direction: column;
97
+ }
98
+ }
99
+ </style>
@@ -0,0 +1,195 @@
1
+ <template>
2
+ <view class="list-top-filters" :class="{'show-popup': showDownPopup, 'filter-right': !!$slots.filters, 'filter-form': !!$slots.form, 'filter-top': !!$slots.top, 'filter-bottom': !!$slots.bottom}">
3
+ <view class="list-top-filters-warpper">
4
+ <view class="list-top-filters-top">
5
+ <slot name="top"></slot>
6
+ </view>
7
+ <view class="list-top-filters-statistics">
8
+ <slot name="statistics"></slot>
9
+ </view>
10
+ <view v-if="showSearch" class="list-top-filters-search">
11
+ <ml-search-bar v-model="searchName" :placeholder="placeholder" :editable="!showDownPopup" clearable @input="inputEvent" @confirm="searchEvent" @clear="clearEvent"></ml-search-bar>
12
+ <view class="list-top-filters-search-right">
13
+ <slot name="filters"></slot>
14
+ </view>
15
+ <view v-if="showPulldown" class="list-top-filters-pulldown-icon" @click="toggleDownPopup">
16
+ <ml-icon name="filter-filling" />
17
+ </view>
18
+ </view>
19
+ <view class="list-top-filters-form">
20
+ <slot name="form"></slot>
21
+ </view>
22
+ <view class="list-top-filters-bottom">
23
+ <slot name="bottom"></slot>
24
+ </view>
25
+ <view v-if="showDownPopup" class="list-top-filters-pulldown-warpper" @tap="tabMaskaEvent">
26
+ <view class="list-top-filters-pulldown-form" @tap.stop>
27
+ <view class="list-top-filters-pulldown-body">
28
+ <slot name="pulldown"></slot>
29
+ </view>
30
+ <view class="list-top-filters-pulldown-footer">
31
+ <ml-button size="medium" @click="resetDownEvent">重置</ml-button>
32
+ <ml-button size="medium" status="primary" @click="confirmDownEvent">确认</ml-button>
33
+ </view>
34
+ </view>
35
+ </view>
36
+ </view>
37
+ </view>
38
+ </template>
39
+
40
+ <script>
41
+ export default {
42
+ name: 'MlHeaderFilterForm',
43
+ props: {
44
+ value: String,
45
+ offsetTop: String,
46
+ showSearch: Boolean,
47
+ showPulldown: Boolean,
48
+ placeholder: String
49
+ },
50
+ inject: {
51
+ layout: {
52
+ from: '$pageLayout',
53
+ default: null
54
+ }
55
+ },
56
+ data () {
57
+ return {
58
+ searchName: '',
59
+ showDownPopup: false
60
+ }
61
+ },
62
+ mounted () {
63
+ this.searchName = this.value
64
+ },
65
+ methods: {
66
+ toggleDownPopup () {
67
+ this.showDownPopup = !this.showDownPopup
68
+ },
69
+ tabMaskaEvent () {
70
+ this.showDownPopup = false
71
+ },
72
+ resetDownEvent () {
73
+ this.showDownPopup = false
74
+ this.$emit('reset')
75
+ },
76
+ confirmDownEvent () {
77
+ this.showDownPopup = false
78
+ this.$emit('confirm')
79
+ },
80
+ inputEvent () {
81
+ this.$emit('input', this.searchName)
82
+ },
83
+ clearEvent () {
84
+ this.$emit('search')
85
+ },
86
+ searchEvent () {
87
+ this.$emit('search')
88
+ }
89
+ }
90
+ }
91
+ </script>
92
+
93
+ <style lang="scss">
94
+ .list-top-filters {
95
+ position: relative;
96
+ width: 100%;
97
+ font-size: $ml-describe-font-size;
98
+ background: #ffffff;
99
+ .list-top-filters-warpper {
100
+ display: flex;
101
+ flex-direction: column;
102
+ padding: $ml-page-interval-margin $ml-page-interval-margin 0 $ml-page-interval-margin;
103
+ }
104
+ .list-top-filters-top {
105
+ display: none;
106
+ }
107
+ &.filter-top {
108
+ .list-top-filters-top {
109
+ display: block;
110
+ }
111
+ }
112
+ .list-top-filters-search {
113
+ display: flex;
114
+ flex-direction: row;
115
+ padding: $ml-page-interval-margin 0;
116
+ background: #ffffff;
117
+ border-radius: $ml-border-radius;
118
+ margin-bottom: $ml-page-interval-margin;
119
+ .list-top-filters-pulldown-icon {
120
+ display: flex;
121
+ flex-direction: row;
122
+ align-items: center;
123
+ justify-content: center;
124
+ padding-left: $ml-page-interval-margin;
125
+ font-size: 60rpx;
126
+ color: $uni-color-primary;
127
+ // #ifdef H5
128
+ cursor: pointer;
129
+ // #endif
130
+ }
131
+ }
132
+ &.filter-right {
133
+ .list-top-filters-search {
134
+ padding-right: 0;
135
+ }
136
+ .list-top-filters-search-right {
137
+ display: block;
138
+ }
139
+ }
140
+ .list-top-filters-form {
141
+ display: none;
142
+ flex-direction: column;
143
+ background: #ffffff;
144
+ border-radius: $ml-border-radius;
145
+ margin-bottom: $ml-page-interval-margin;
146
+ }
147
+ &.filter-form {
148
+ .list-top-filters-form {
149
+ display: block;
150
+ }
151
+ }
152
+ .list-top-filters-bottom {
153
+ display: none;
154
+ }
155
+ &.filter-bottom {
156
+ .list-top-filters-bottom {
157
+ display: block;
158
+ }
159
+ }
160
+ }
161
+ .list-top-filters-search-right {
162
+ display: none;
163
+ flex-shrink: 0;
164
+ }
165
+ .list-top-filters-pulldown-form {
166
+ position: relative;
167
+ background: #ffffff;
168
+ .list-top-filters-pulldown-body {
169
+ padding: 20rpx;
170
+ max-height: 70vh;
171
+ // #ifndef H5
172
+ overflow: auto;
173
+ // #endif
174
+ }
175
+ .list-top-filters-pulldown-footer {
176
+ display: flex;
177
+ flex-direction: row;
178
+ padding: $ml-page-interval-margin;
179
+ background: #F0F2F5;
180
+ }
181
+ }
182
+ .list-top-filters-pulldown-warpper {
183
+ position: fixed;
184
+ top: 0;
185
+ left: 0;
186
+ width: $ml-page-full-width;
187
+ height: 100vh;
188
+ z-index: 777;
189
+ background-color: rgba(0, 0, 0, 0.4);
190
+ // #ifdef H5
191
+ left: 50%;
192
+ transform: translateX(-50%);
193
+ // #endif
194
+ }
195
+ </style>
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "码里云小程序组件库",
5
5
  "files": [
6
6
  "lib",
7
7
  "config",
8
8
  "utils",
9
9
  "modal",
10
+ "store",
10
11
  "storage",
11
12
  "iconfont.css",
12
13
  "index.js",
package/store/toast.js ADDED
@@ -0,0 +1,84 @@
1
+ let loadingTime = null
2
+ let messageTime = null
3
+
4
+ const toast = {
5
+ state: {
6
+ loadingToast: {
7
+ visible: false
8
+ },
9
+ messageToast: {
10
+ visible: false
11
+ }
12
+ },
13
+ getters: {
14
+ loadingToast: (state) => state.loadingToast,
15
+ messageToast: (state) => state.messageToast
16
+ },
17
+ mutations: {
18
+ setLoading (state, options) {
19
+ state.loadingToast = options
20
+ },
21
+ setToast (state, options) {
22
+ state.messageToast = options
23
+ }
24
+ },
25
+ actions: {
26
+ openLoading ({ commit }, options) {
27
+ return new Promise(resolve => {
28
+ if (loadingTime) {
29
+ resolve()
30
+ return
31
+ }
32
+ const opts = {
33
+ ...options,
34
+ visible: true
35
+ }
36
+ commit('setLoading', opts)
37
+ })
38
+ },
39
+ closeLoading ({ commit }) {
40
+ return new Promise(resolve => {
41
+ if (loadingTime) {
42
+ clearTimeout(loadingTime)
43
+ loadingTime = null
44
+ }
45
+ commit('setLoading', {
46
+ visible: false
47
+ })
48
+ setTimeout(() => resolve(), 50)
49
+ })
50
+ },
51
+ openToast ({ commit, dispatch }, options) {
52
+ return new Promise(resolve => {
53
+ if (messageTime) {
54
+ resolve()
55
+ return
56
+ }
57
+ const opts = {
58
+ ...options,
59
+ visible: true
60
+ }
61
+ commit('setToast', opts)
62
+ if (opts.duration !== -1) {
63
+ messageTime = setTimeout(() => {
64
+ dispatch('closeToast').then(() => resolve())
65
+ }, opts.duration || 2000)
66
+ }
67
+ })
68
+ },
69
+ closeToast ({ commit }) {
70
+ return new Promise(resolve => {
71
+ if (messageTime) {
72
+ clearTimeout(messageTime)
73
+ messageTime = null
74
+ }
75
+ commit('setToast', {
76
+ visible: false
77
+ })
78
+ setTimeout(() => resolve(), 50)
79
+ })
80
+ }
81
+ }
82
+ }
83
+
84
+ export default toast