@aochuang/common 1.0.135 → 1.0.137

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.
@@ -2,7 +2,7 @@
2
2
  <el-dialog
3
3
  ref="dialog"
4
4
  class="ui-dialog"
5
- :class="['ui-dialog--' + size, {'is-closeable': closeable, 'is-hide-header': hideHeader}]"
5
+ :class="['ui-dialog--' + size, {'is-closeable': closeable, 'is-hide-header': hideHeader, 'is-mobile': isMobile}]"
6
6
  :top="dialogTop"
7
7
  :append-to-body="true"
8
8
  :visible.sync="dialogVisible"
@@ -25,6 +25,7 @@
25
25
  import ElDialog from 'element-ui/lib/dialog'
26
26
  import 'element-ui/lib/theme-chalk/dialog.css'
27
27
  import { getDialogOpenCallback, getDialogCloseCallback } from './utils'
28
+ import { isMobile } from '../../utils/browse.js'
28
29
 
29
30
  export default {
30
31
  name: 'UiDialog',
@@ -77,7 +78,8 @@ export default {
77
78
  },
78
79
  data () {
79
80
  return {
80
- showContent: this.visible
81
+ showContent: this.visible,
82
+ isMobile: isMobile()
81
83
  }
82
84
  },
83
85
  computed: {
@@ -184,4 +186,55 @@ export default {
184
186
  display: inline-block;
185
187
  }
186
188
  }
189
+ .ui-dialog.is-mobile{
190
+ display: flex;
191
+ align-items: flex-end;
192
+ .el-dialog{
193
+ width: 100% !important;
194
+ max-height: 90vh;
195
+ margin: 0 !important;
196
+ display: flex;
197
+ flex-direction: column;
198
+ border-radius: 8px 8px 0 0;
199
+ }
200
+ .el-dialog__header{
201
+ flex-shrink: 0;
202
+ border-radius: 8px 8px 0 0;
203
+ }
204
+ .el-dialog__body{
205
+ flex: 1;
206
+ min-height: 0;
207
+ overflow-y: auto;
208
+ overflow-x: hidden;
209
+ overscroll-behavior: contain;
210
+ }
211
+ }
212
+ .ui-dialog.is-mobile.dialog-fade-enter-active{
213
+ animation: none;
214
+ .el-dialog{
215
+ animation: ui-dialog-mobile-slide-in .3s ease-out;
216
+ }
217
+ }
218
+ .ui-dialog.is-mobile.dialog-fade-leave-active{
219
+ animation: none;
220
+ .el-dialog{
221
+ animation: ui-dialog-mobile-slide-out .3s ease-in;
222
+ }
223
+ }
224
+ @keyframes ui-dialog-mobile-slide-in {
225
+ from {
226
+ transform: translateY(100%);
227
+ }
228
+ to {
229
+ transform: translateY(0);
230
+ }
231
+ }
232
+ @keyframes ui-dialog-mobile-slide-out {
233
+ from {
234
+ transform: translateY(0);
235
+ }
236
+ to {
237
+ transform: translateY(100%);
238
+ }
239
+ }
187
240
  </style>
@@ -15,13 +15,15 @@
15
15
  @error="handleImageError"
16
16
  :style="imageStyle"
17
17
  />
18
- <ui-icon
19
- v-if="status === 'error'"
20
- name="image-error-line"
21
- class="ui-image__error"
22
- :size="iconSize"
23
- color="#aaa"
24
- ></ui-icon>
18
+ <div v-if="status === 'error'" class="ui-image__error" :class="{'has-slot': $slots.error}">
19
+ <slot name="error">
20
+ <ui-icon
21
+ name="image-error-line"
22
+ :size="iconSize"
23
+ color="#aaa"
24
+ ></ui-icon>
25
+ </slot>
26
+ </div>
25
27
  <div class="ui-image__preview" v-if="previewable && status === 'success'" @click="handlePreviewClick">
26
28
  <ui-icon name="sousuo" :size="30" color="#fff"></ui-icon>
27
29
  </div>
@@ -215,7 +217,7 @@ export default {
215
217
  if (!this.source) {
216
218
  return
217
219
  }
218
- const clickFn = getImageClickFn()
220
+ const clickFn = getImageClickFn()
219
221
  if (clickFn) {
220
222
  clickFn({
221
223
  alt: this.alt,
@@ -318,7 +320,7 @@ export default {
318
320
  img {
319
321
  display: none!important;
320
322
  }
321
- .ui-image__error{
323
+ .ui-image__error:not(.has-slot){
322
324
  position: absolute;
323
325
  left: 50%;
324
326
  top: 50%;
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="ui-popup-select">
3
- <div class="ui-popup-select__handle">
3
+ <div class="ui-popup-select__handle" @click.capture="handleHandleClick">
4
4
  <ui-select
5
5
  ref="select"
6
6
  v-model="innerValue"
@@ -27,7 +27,7 @@
27
27
  :size="popupSize"
28
28
  v-model="showPopupDialog"
29
29
  >
30
- <slot name="popup"></slot>
30
+ <slot name="popup" :close="closePopup"></slot>
31
31
  </ui-dialog>
32
32
  </div>
33
33
  </div>
@@ -37,7 +37,7 @@ export default {
37
37
  name: 'UiPopupSelect',
38
38
  props: {
39
39
  value: {
40
- type: String
40
+ type: [String, Number]
41
41
  },
42
42
  filterable: {
43
43
  type: Boolean,
@@ -78,6 +78,10 @@ export default {
78
78
  },
79
79
  tempItems: {
80
80
  type: Array
81
+ },
82
+ popupOnClick: {
83
+ type: Boolean,
84
+ default: false
81
85
  }
82
86
  },
83
87
  data () {
@@ -96,6 +100,17 @@ export default {
96
100
  }
97
101
  },
98
102
  methods: {
103
+ handleHandleClick (event) {
104
+ if (!this.popupOnClick) {
105
+ return
106
+ }
107
+ event.preventDefault()
108
+ event.stopPropagation()
109
+ this.showPopupDialog = true
110
+ },
111
+ closePopup () {
112
+ this.showPopupDialog = false
113
+ },
99
114
  handleChange (evt) {
100
115
  this.$emit('change', evt)
101
116
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aochuang/common",
3
- "version": "1.0.135",
3
+ "version": "1.0.137",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -0,0 +1,8 @@
1
+ export function isMobile () {
2
+ if (typeof navigator === 'undefined') {
3
+ return false
4
+ }
5
+ const userAgent = navigator.userAgent
6
+ return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent) ||
7
+ (/Macintosh/i.test(userAgent) && navigator.maxTouchPoints > 1)
8
+ }