sadais-piui 1.2.4-beta4 → 1.2.4-beta7

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.
@@ -284,6 +284,9 @@ export default {
284
284
  // type 为 range 开始和结束的提示
285
285
  if (isBegin) day.tip = this.startText
286
286
  if (isEnd) day.tip = this.endText
287
+ if (isBegin && isEnd) {
288
+ day.tip = this.startText + '-' + this.endText
289
+ }
287
290
  }
288
291
  // 当天样式
289
292
  if (this.showBackToday && this.isSameDay(this.now, day)) {
@@ -316,8 +319,9 @@ export default {
316
319
  return false
317
320
  },
318
321
  init() {
319
- console.log(TAG, '组件初始化')
322
+ console.log(TAG, '组件初始化', this.value)
320
323
  if (!this.valid()) return
324
+ let initValue = this.value
321
325
  const nowDate = this.$pi.date.parseDate(this.type === 'date' ? this.value : this.value[0])
322
326
  if (this.type === 'range') {
323
327
  const endDate = this.$pi.date.parseDate(this.value[1])
@@ -325,12 +329,13 @@ export default {
325
329
  this.year = nowDate.year
326
330
  this.month = nowDate.month
327
331
  }
328
- this.handleChange([nowDate, endDate])
332
+ initValue = [nowDate, endDate]
329
333
  } else {
330
334
  this.year = nowDate.year
331
335
  this.month = nowDate.month
332
- this.handleChange(nowDate)
336
+ initValue = nowDate
333
337
  }
338
+ this.value && this.handleChange(initValue)
334
339
  },
335
340
  isSameDay(day1, day2) {
336
341
  return (
@@ -360,9 +365,6 @@ export default {
360
365
  // 如果选了两项,则重新开始选择范围
361
366
  this.handleChange([date])
362
367
  } else {
363
- // 如果第二项选择的和第一项一样,不做处理
364
- const isSameDay = this.isSameDay(this.calendarValue[0], date)
365
- if (isSameDay) return
366
368
  // 和第一项判断大小,小的放前面
367
369
  if (date.timestamp > this.calendarValue[0].timestamp) {
368
370
  this.handleChange([this.calendarValue[0], date])
@@ -25,6 +25,8 @@
25
25
  :class="[customClass]"
26
26
  :indicator-style="indicatorStyle"
27
27
  :value="pickerValue"
28
+ @pickstart="handlePickstart"
29
+ @pickend="handlePickend"
28
30
  @change="handleDateChange"
29
31
  >
30
32
  <picker-view-column>
@@ -195,7 +197,8 @@ export default {
195
197
  data() {
196
198
  const date = this.$pi.date.parseDate(this.defaultValue)
197
199
  return {
198
- date
200
+ date,
201
+ scrolling: false // picker是否在滚动中,小程序在scrolling中点确定,选择的项目不正确
199
202
  }
200
203
  },
201
204
  computed: {
@@ -207,7 +210,11 @@ export default {
207
210
  datePicker.confirmBtn,
208
211
  this.popupSelect.confirmBtn
209
212
  )
210
- return this.$pi.lang.mergeDeep(datePickerConfirmBtn, this.confirmBtn)
213
+ const mergeConfirmBtn = this.$pi.lang.mergeDeep(datePickerConfirmBtn, this.confirmBtn)
214
+ if (!mergeConfirmBtn.disabled) {
215
+ mergeConfirmBtn.disabled = this.scrolling
216
+ }
217
+ return mergeConfirmBtn
211
218
  },
212
219
  getCancelBtn() {
213
220
  const datePickerCancelBtn = this.$pi.lang.mergeDeep(
@@ -312,6 +319,13 @@ export default {
312
319
  init() {
313
320
  this.date = this.$pi.date.parseDate(this.defaultValue)
314
321
  },
322
+ handlePickstart() {
323
+ this.scrolling = true
324
+ },
325
+ // 标识滑动结束
326
+ handlePickend() {
327
+ this.scrolling = false
328
+ },
315
329
  handlePopupClose() {
316
330
  this.val = false
317
331
  // 关闭
@@ -175,7 +175,7 @@ export default {
175
175
  return formItem.labelAlign
176
176
  },
177
177
  validator: function(value) {
178
- return ['left', 'center', 'right'].includes(value)
178
+ return [null, 'left', 'center', 'right'].includes(value)
179
179
  }
180
180
  },
181
181
  // 表单输入区域 label 对齐方式
@@ -187,7 +187,7 @@ export default {
187
187
  return formItem.inputAlign
188
188
  },
189
189
  validator: function(value) {
190
- return ['left', 'center', 'right'].includes(value)
190
+ return [null, 'left', 'center', 'right'].includes(value)
191
191
  }
192
192
  },
193
193
  // 是否以换行样式显示表单
@@ -22,7 +22,7 @@
22
22
  </view>
23
23
 
24
24
  <!-- 标题和描述 -->
25
- <view v-if="title || desc">
25
+ <view v-if="title || desc" class="title-wrap">
26
26
  <view v-if="title" :style="[titleStyle]" class="list-item-title">{{ title }}</view>
27
27
  <view v-if="desc" :style="[descStyle]" class="list-item-desc">{{ desc }}</view>
28
28
  </view>
@@ -307,6 +307,10 @@ export default {
307
307
  .pi-list-item {
308
308
  height: $pi-form-item-height;
309
309
  line-height: 1;
310
+ .title-wrap {
311
+ max-width: 100%;
312
+ overflow: hidden;
313
+ }
310
314
  .list-item-title {
311
315
  font-size: $pi-list-title-fontsize;
312
316
  color: $pi-list-title-color;
@@ -1,10 +1,10 @@
1
1
  <!--
2
2
  * @Author: zhangzhenfei
3
3
  * @Date: 2021-08-13 11:31:57
4
- * @LastEditTime: 2022-04-07 11:51:44
4
+ * @LastEditTime: 2022-04-12 09:11:41
5
5
  * @LastEditors: zhangzhenfei
6
6
  * @Description: 图片上传组件
7
- * @FilePath: /piui-awesome/src/piui/components/pi-upload-img/index.vue
7
+ * @FilePath: \hfmp-checkin-frontc:\Users\feilin\workspace\sadais\piui-awesome\src\piui\components\pi-upload-img\index.vue
8
8
  -->
9
9
 
10
10
  <template>
@@ -345,6 +345,7 @@ export default {
345
345
  } else {
346
346
  val = this.isValString ? '' : this.val.filter((_, i) => i !== index)
347
347
  }
348
+ this.$emit('remove', index)
348
349
  this.val = val
349
350
  this.handleEmitChange()
350
351
  },
@@ -414,7 +415,7 @@ export default {
414
415
  }
415
416
 
416
417
  // ---------- 解析上传结果 ----------
417
-
418
+ this.$emit('uploaded', uploadResult)
418
419
  const item = await parseResultFn(uploadResult)
419
420
  if (item) {
420
421
  this.isValString ? (this.val = item) : this.val.push(item)
@@ -422,20 +423,24 @@ export default {
422
423
  }
423
424
  }
424
425
  } catch (e) {
426
+ console.log(TAG, '上传文件失败', e)
425
427
  this.$emit('fail', e)
426
428
  }
427
429
  },
428
430
  handleCrop(res) {
429
431
  console.log(TAG, '处理剪裁')
432
+ this.$emit('crop', res.img)
430
433
  this.cropedPic = res.img
431
434
  },
432
435
  handleCancelCrop() {
433
436
  console.log(TAG, '取消剪裁')
437
+ this.$emit('cancelCrop')
434
438
  this.showCrop = false
435
439
  this.cropPic = ''
436
440
  },
437
441
  handleCompelteCrop() {
438
442
  console.log(TAG, '完成剪裁')
443
+ this.$emit('croped', [this.cropedPic])
439
444
  this.showCrop = false
440
445
  this.handleUpload([this.cropedPic])
441
446
  },
@@ -471,6 +476,7 @@ export default {
471
476
  }
472
477
  this.handleUpload(tempFilePaths)
473
478
  } catch (error) {
479
+ console.log(TAG, '上传文件失败', e)
474
480
  this.$emit('fail', error)
475
481
  }
476
482
  }
package/config/form.js CHANGED
@@ -6,19 +6,19 @@ export default {
6
6
  title: '', // 表单面板标题
7
7
  desc: '', // 表单描述
8
8
  titleStyle: {}, // 表单自定义样式,对象形式(默认值:{})
9
- height: null, // 高度
10
- padding: null, // padding
9
+ height: 100, // 表单项高度
10
+ padding: '32rpx', // padding
11
11
  labelWidth: 120, // 表单项 label 宽度,默认单位为rpx
12
- labelAlign: null, // 表单项 label 对齐方式,可选值为 left center right
13
- labelStyle: null, // 表单项 label样式
14
- inputAlign: null, // 表单输入区域 label 对齐方式,可选值为 left center right
15
- wrap: null, // 是否以换行样式显示表单
16
- labelWrapBorder: null, // wrap样式label是否显示边框
17
- colon: null, // 是否在 label 后面添加冒号
18
- disabled: null, // 是否禁用
19
- border: null, // 是否显示边框
12
+ labelAlign: 'left', // 表单项 label 对齐方式,可选值为 left center right
13
+ labelStyle: {}, // 表单项 label样式
14
+ inputAlign: 'right', // 表单输入区域 label 对齐方式,可选值为 left center right
15
+ wrap: false, // 是否以换行样式显示表单
16
+ labelWrapBorder: false, // wrap样式label是否显示边框
17
+ colon: false, // 是否在 label 后面添加冒号
18
+ disabled: false, // 是否禁用
19
+ border: false, // 是否显示边框
20
20
  errorType: 'message',
21
- showRightIcon: null, // 是否显示右边icon,默认是箭头(可以自定义设置成其他图标)
21
+ showRightIcon: false, // 是否显示右边icon,默认是箭头(可以自定义设置成其他图标)
22
22
  rightIcon: {
23
23
  ...icon,
24
24
  name: 'right',
@@ -5,18 +5,18 @@ export default {
5
5
  customStyle: {}, // 自定义样式,对象形式(默认值:{})
6
6
  required: false, // 是否必填
7
7
  requiredStyle: {}, // 必填标志自定义样式,对象形式(默认值:{})
8
- height: 100, // 表单项高度
9
- padding: '32rpx', // padding
8
+ height: null, // 高度
9
+ padding: null, // padding
10
10
  labelWidth: null, // 表单项 label 宽度,默认单位为rpx
11
- labelAlign: 'left', // 表单项 label 对齐方式,可选值为 left center right
12
- labelStyle: {}, // 表单项 label样式
13
- inputAlign: 'right', // 表单输入区域 label 对齐方式,可选值为 left center right
14
- wrap: false, // 是否以换行样式显示表单
15
- labelWrapBorder: false, // wrap样式label是否显示边框
16
- colon: false, // 是否在 label 后面添加冒号
17
- disabled: false, // 是否禁用
18
- border: false, // 是否显示边框
19
- showRightIcon: false, // 是否显示右边icon,默认是箭头(可以自定义设置成其他图标)
11
+ labelAlign: null, // 表单项 label 对齐方式,可选值为 left center right
12
+ labelStyle: null, // 表单项 label样式
13
+ inputAlign: null, // 表单输入区域 label 对齐方式,可选值为 left center right
14
+ wrap: null, // 是否以换行样式显示表单
15
+ labelWrapBorder: null, // wrap样式label是否显示边框
16
+ colon: null, // 是否在 label 后面添加冒号
17
+ disabled: null, // 是否禁用
18
+ border: null, // 是否显示边框
19
+ showRightIcon: null, // 是否显示右边icon,默认是箭头(可以自定义设置成其他图标)
20
20
  rightIcon: {
21
21
  ...icon,
22
22
  name: 'right',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.4-beta4",
3
+ "version": "1.2.4-beta7",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tools/index.js CHANGED
@@ -1,8 +1,16 @@
1
1
  import tool from '@sadais/piui-tool'
2
2
 
3
3
  tool.expand = {
4
+ /**
5
+ * 获取属性值
6
+ * @param {Object} inheritProp 继承属性
7
+ * @param {Object} prop 属性
8
+ * @returns 目标属性值
9
+ */
4
10
  getPropValue(inheritProp, prop) {
5
- if (inheritProp === null) return prop
11
+ // 如果属性不存在,则返回继承属性值
12
+ if (prop === null && inheritProp !== null) return inheritProp
13
+ // 如果属性值和继承属性不一致,以属性值为准
6
14
  else if (inheritProp !== prop) return prop
7
15
  return inheritProp
8
16
  }