sadais-piui 1.2.7-beta15 → 1.2.7-beta151

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.
Files changed (75) hide show
  1. package/.prettierrc +8 -0
  2. package/components/pi-action-sheet/index.vue +260 -247
  3. package/components/pi-badge/index.vue +11 -1
  4. package/components/pi-bottom-bar/index.vue +1 -1
  5. package/components/pi-calendar/index.vue +207 -182
  6. package/components/pi-calendar-input/index.vue +61 -30
  7. package/components/pi-calendar-panel/components/calendar-days/index.vue +91 -52
  8. package/components/pi-calendar-panel/index.vue +28 -12
  9. package/components/pi-canvas/index.vue +8 -1
  10. package/components/pi-cascader/index.vue +601 -0
  11. package/components/pi-checkbox/index.vue +8 -4
  12. package/components/pi-checkbox-group/index.vue +12 -11
  13. package/components/pi-circle-progress/index.vue +53 -16
  14. package/components/pi-code-input/index.vue +11 -3
  15. package/components/pi-collapse/index.vue +16 -6
  16. package/components/pi-collapse-item/index.vue +35 -22
  17. package/components/pi-date-picker/index.vue +512 -391
  18. package/components/pi-date-picker-input/index.vue +61 -30
  19. package/components/pi-dropdown/components/dropdown-tab.vue +33 -23
  20. package/components/pi-dropdown/index.vue +34 -19
  21. package/components/pi-dropdown-item/index.vue +70 -58
  22. package/components/pi-form-item/index.vue +98 -20
  23. package/components/pi-grid/index.vue +1 -1
  24. package/components/pi-grid-item/index.vue +4 -4
  25. package/components/pi-img/index.vue +275 -267
  26. package/components/pi-img-cropper/index.vue +6 -3
  27. package/components/pi-input/index.vue +97 -36
  28. package/components/pi-list-item/index.vue +1 -1
  29. package/components/pi-marquee/index.vue +322 -310
  30. package/components/pi-marquee-pure-css/index.vue +267 -0
  31. package/components/pi-mask/index.vue +3 -1
  32. package/components/pi-modal/index.vue +311 -303
  33. package/components/pi-pagination/index.vue +13 -0
  34. package/components/pi-picker/index.vue +332 -317
  35. package/components/pi-popup/index.vue +4 -1
  36. package/components/pi-popup-select/index.vue +13 -4
  37. package/components/pi-radio/index.vue +12 -11
  38. package/components/pi-radio-group/index.vue +25 -5
  39. package/components/pi-regions-select/index.vue +6 -1
  40. package/components/pi-regions-select-input/index.vue +69 -31
  41. package/components/pi-search/index.vue +37 -2
  42. package/components/pi-section/index.vue +1 -1
  43. package/components/pi-select/index.vue +237 -22
  44. package/components/pi-select-input/index.vue +106 -41
  45. package/components/pi-stepper/index.vue +135 -121
  46. package/components/pi-steps/index.vue +115 -36
  47. package/components/pi-swiper/index.vue +22 -7
  48. package/components/pi-switch/index.vue +5 -1
  49. package/components/pi-table/index.vue +351 -0
  50. package/components/pi-tabs/index.vue +46 -10
  51. package/components/pi-upload-img/index.vue +895 -44
  52. package/components/pi-webview/index.vue +95 -82
  53. package/config/actionSheet.js +0 -1
  54. package/config/calendarInput.js +2 -1
  55. package/config/calendarPanel.js +2 -1
  56. package/config/cascader.js +22 -0
  57. package/config/circleProgress.js +12 -4
  58. package/config/codeInput.js +2 -1
  59. package/config/datePicker.js +29 -24
  60. package/config/datePickerInput.js +2 -1
  61. package/config/dropdown.js +3 -1
  62. package/config/input.js +5 -3
  63. package/config/marqueePureCss.js +18 -0
  64. package/config/regionsSelectInput.js +2 -1
  65. package/config/select.js +13 -1
  66. package/config/selectInput.js +2 -1
  67. package/config/steps.js +1 -1
  68. package/config/table.js +9 -0
  69. package/config/uploadImg.js +33 -11
  70. package/mixin/emitter.js +8 -1
  71. package/mixin/value-sync.js +5 -0
  72. package/package.json +5 -2
  73. package/scss/common.scss +11 -14
  74. package/scss/icon/icon.scss +2 -1
  75. package/scss/mixin.scss +5 -5
@@ -14,7 +14,6 @@
14
14
  'animation-duration': getDuration.css
15
15
  }
16
16
  ]"
17
- @touchmove.stop.prevent="() => {}"
18
17
  @tap.stop.prevent="handleCloseMask"
19
18
  >
20
19
  <view
@@ -279,10 +278,14 @@ export default {
279
278
  this.closed = false
280
279
  this.show = true
281
280
  this.showed = false
281
+ // 弹窗即将显示
282
+ this.$emit('show')
282
283
  this.handleEmitChange()
283
284
  uni.hideKeyboard()
284
285
  this.getMask.hideTabBar && uni.hideTabBar()
285
286
  setTimeout(() => {
287
+ // 弹窗已经显示
288
+ this.$emit('showed')
286
289
  this.showed = true
287
290
  }, this.getDuration.js)
288
291
  // #ifdef H5
@@ -14,9 +14,15 @@
14
14
  :append-to-body="getPopup.appendToBody"
15
15
  :z-index="getPopup.zIndex"
16
16
  :background="getPopup.background"
17
+ @show="$emit('show')"
18
+ @showed="$emit('showed')"
17
19
  @close="handlePopupClose"
18
20
  >
19
- <view class="pi-popup-select pi-flex-column" :style="[customStyle]" :class="[customClass]">
21
+ <view
22
+ class="pi-popup-select pi-flex-column"
23
+ :style="[customStyle]"
24
+ :class="[customClass]"
25
+ >
20
26
  <!-- 标题栏 -->
21
27
  <view
22
28
  v-if="showTitle"
@@ -33,9 +39,11 @@
33
39
  >
34
40
  <slot v-if="$slots.toolbar" name="toolbar" />
35
41
  <template v-else>
36
- <view class="item-btn" @tap.stop="handlePopupClose">取消</view>
42
+ <view class="item-btn" @tap.stop="handlePopupClose">
43
+ {{ getCancelBtn.text }}
44
+ </view>
37
45
  <view class="item-btn pi-primary" @tap.stop="handleConfirm">
38
- 确定
46
+ {{ getConfirmBtn.text }}
39
47
  </view>
40
48
  </template>
41
49
  </view>
@@ -243,6 +251,7 @@ export default {
243
251
  },
244
252
  getPopupCustomStyle() {
245
253
  return {
254
+ ...(this.getPopup.customStyle || {}),
246
255
  width: this.$pi.common.addUnit(this.width),
247
256
  height: this.$pi.common.addUnit(this.height)
248
257
  }
@@ -271,7 +280,7 @@ export default {
271
280
  * 确认选择
272
281
  */
273
282
  handleConfirm() {
274
- this.$emit('confirm', this.popupSelected)
283
+ this.$emit('confirm')
275
284
  this.onConfirmClose && this.handlePopupClose()
276
285
  }
277
286
  }
@@ -171,7 +171,7 @@ export default {
171
171
  : this.$pi.common.addUnit(this.border)
172
172
  },
173
173
  getDisable() {
174
- return this.inheritProps.disabled || this.disabled
174
+ return this.inheritProps.getDisabled || this.disabled
175
175
  },
176
176
  getActiveMode() {
177
177
  return this.inheritProps.activeMode || this.activeMode
@@ -190,7 +190,9 @@ export default {
190
190
  : this.$pi.common.addUnit(this.iconSize)
191
191
  },
192
192
  getCanCancel() {
193
- return this.inheritProps.canCancel !== null ? this.inheritProps.canCancel : this.canCancel
193
+ return this.inheritProps.canCancel !== null
194
+ ? this.inheritProps.canCancel
195
+ : this.canCancel
194
196
  },
195
197
  getOnlyIconSelect() {
196
198
  return this.inheritProps.onlyIconSelect !== null
@@ -222,9 +224,13 @@ export default {
222
224
  borderRadius: this.getBorderRadius,
223
225
  borderWidth: this.getBorder
224
226
  }
227
+
225
228
  if (this.getActiveColor && this.val) {
226
229
  style.borderColor = this.getActiveColor
227
- if (['text', 'button'].includes(this.getShape) && this.getActiveMode === 'fill') {
230
+ if (
231
+ ['text', 'button'].includes(this.getShape) &&
232
+ this.getActiveMode === 'fill'
233
+ ) {
228
234
  style.backgroundColor = this.getActiveColor
229
235
  } else {
230
236
  style.color = this.getActiveColor
@@ -290,21 +296,20 @@ $unactive-color: #cccccc;
290
296
  }
291
297
  .radio-label {
292
298
  flex: 1;
293
- margin-left: 16rpx;
299
+ padding: 0 24rpx 0 16rpx;
294
300
  line-height: 1.5;
295
301
  word-wrap: break-word;
296
302
  transition: $pi-animation-duration $pi-animation-timing-function;
297
303
  transition-property: border, color, background-color;
298
304
  &.text {
299
305
  padding: 12rpx 24rpx;
300
- margin-left: 0;
301
- color: $unactive-color;
302
306
  border-color: transparent;
303
307
  border-style: solid;
308
+ background-color: #f5f5f5;
304
309
  }
305
310
  &.button {
306
311
  padding: 24rpx;
307
- margin-left: 0;
312
+
308
313
  line-height: 1;
309
314
  color: $unactive-color;
310
315
  border-color: transparent;
@@ -322,7 +327,6 @@ $unactive-color: #cccccc;
322
327
  }
323
328
  }
324
329
  &.disabled {
325
- cursor: not-allowed;
326
330
  .radio-icon {
327
331
  opacity: $pi-disabled-opacity;
328
332
  }
@@ -331,9 +335,6 @@ $unactive-color: #cccccc;
331
335
  }
332
336
  }
333
337
  &.line {
334
- .radio-label.text {
335
- border-color: $unactive-color;
336
- }
337
338
  .radio-label.button {
338
339
  border-color: $unactive-color;
339
340
  }
@@ -36,7 +36,7 @@ export default {
36
36
  'borderRadius',
37
37
  'stretch',
38
38
  'border',
39
- 'disabled',
39
+ 'getDisabled',
40
40
  'size',
41
41
  'iconSize',
42
42
  'activeColor',
@@ -162,6 +162,12 @@ export default {
162
162
  default: radioGroup.onlyIconSelect
163
163
  }
164
164
  },
165
+ computed: {
166
+ getDisabled() {
167
+ const parent = this.$pi.parent(this, 'PiFormItem')
168
+ return this.disabled || (parent && parent.getDisabled)
169
+ }
170
+ },
165
171
  methods: {
166
172
  /**
167
173
  * @vuese
@@ -204,6 +210,24 @@ export default {
204
210
  }
205
211
  }
206
212
 
213
+ &.text {
214
+ /* #ifndef MP */
215
+ ::v-deep .pi-radio-wrap {
216
+ .radio-label.text {
217
+ margin-right: 24rpx;
218
+ }
219
+ }
220
+ /* #endif */
221
+ /* #ifdef MP */
222
+ ::v-deep pi-radio {
223
+ /* stylint-disable */
224
+ &:not(:last-child) {
225
+ margin-right: 24rpx;
226
+ }
227
+ }
228
+ /* #endif */
229
+ }
230
+
207
231
  // 按钮样式
208
232
  &.button {
209
233
  flex-direction: row;
@@ -271,10 +295,6 @@ export default {
271
295
  &.horizontal:not(.button) {
272
296
  flex-direction: row;
273
297
  align-items: center;
274
- ::v-deep .pi-radio-wrap:not(:last-child),
275
- ::v-deep pi-radio:not(:last-child) {
276
- margin-right: 24rpx;
277
- }
278
298
  }
279
299
  }
280
300
  </style>
@@ -16,6 +16,9 @@
16
16
  @close="handlePopupClose"
17
17
  @cancel="handleCancel"
18
18
  @confirm="handleConfirm"
19
+ @closed="$emit('closed', $event)"
20
+ @show="$emit('show', $event)"
21
+ @showed="$emit('showed', $event)"
19
22
  >
20
23
  <view class="pi-h-100P pi-flex-column" :style="[customStyle]" :class="[customClass]">
21
24
  <slot name="header" />
@@ -184,7 +187,9 @@ export default {
184
187
  regionsSelect.confirmBtn,
185
188
  this.popupSelect.confirmBtn
186
189
  )
187
- return this.$pi.lang.mergeDeep(regionsSelectConfirmBtn, this.confirmBtn)
190
+ const mergeConfirmBtn = this.$pi.lang.mergeDeep(regionsSelectConfirmBtn, this.confirmBtn)
191
+ mergeConfirmBtn.disabled = !this.isCompleted
192
+ return mergeConfirmBtn
188
193
  },
189
194
  getCancelBtn() {
190
195
  const regionsSelectCancelBtn = this.$pi.lang.mergeDeep(
@@ -1,48 +1,53 @@
1
1
  <!--
2
2
  * @Author: zhangzhenfei
3
3
  * @Date: 2022-05-18 11:08:49
4
- * @LastEditTime: 2022-05-23 09:24:53
4
+ * @LastEditTime: 2024-03-19 18:23:46
5
5
  * @LastEditors: zhangzhenfei
6
6
  * @Description: 日历输入
7
- * @FilePath: /hfmp-checkin-front/Users/feilin/workspace/piui/piui-awesome/src/piui/components/pi-regions-select-input/index.vue
7
+ * @FilePath: /piui-awesome/src/piui/components/pi-regions-select-input/index.vue
8
8
  -->
9
9
 
10
10
  <template>
11
11
  <view class="pi-regions-select-input">
12
12
  <!-- 输入框 -->
13
- <view v-if="$slots.default || $slots.$default" class="pi-w-100P" @click="show = true">
13
+ <view
14
+ v-if="$slots.default || $slots.$default"
15
+ class="pi-w-100P"
16
+ @click="handleShow()"
17
+ >
14
18
  <slot />
15
19
  </view>
16
20
  <pi-input
17
21
  v-else
18
22
  type="text"
19
23
  :value="getInputValue"
20
- :custom-class="input.customClass"
21
- :custom-style="input.customStyle"
22
- :placeholder="input.placeholder"
23
- :placeholder-style="input.placeholderStyle"
24
- :placeholder-class="input.placeholderClass"
25
- :disabled="input.disabled"
26
- :border="input.border"
27
- :maxlength="input.maxlength"
28
- :password="input.password"
29
- :cursor-spacing="input.cursorSpacing"
30
- :focus="input.focus"
31
- :confirm-type="input.confirmType"
32
- :confirm-hold="input.confirmHold"
33
- :cursor="input.cursor"
34
- :selection-start="input.selectionStart"
35
- :selection-end="input.selectionEnd"
36
- :adjust-position="input.adjustPosition"
37
- :hold-keyboard="input.holdKeyboard"
38
- :auto-blur="input.autoBlur"
39
- :show-confirmbar="input.showConfirmbar"
40
- :auto-height="input.autoHeight"
41
- :fixed="input.fixed"
42
- :disable-default-padding="input.disableDefaultPadding"
43
- :clearable="input.clearable"
44
- :clear-icon="input.clearIcon"
45
- @click="show = true"
24
+ :custom-class="getInput.customClass"
25
+ :custom-style="getInput.customStyle"
26
+ :placeholder="getInput.placeholder"
27
+ :placeholder-style="getInput.placeholderStyle"
28
+ :placeholder-class="getInput.placeholderClass"
29
+ :disabled="getInput.disabled"
30
+ :border="getInput.border"
31
+ :maxlength="getInput.maxlength"
32
+ :password="getInput.password"
33
+ :cursor-spacing="getInput.cursorSpacing"
34
+ :focus="getInput.focus"
35
+ :confirm-type="getInput.confirmType"
36
+ :confirm-hold="getInput.confirmHold"
37
+ :cursor="getInput.cursor"
38
+ :selection-start="getInput.selectionStart"
39
+ :selection-end="getInput.selectionEnd"
40
+ :adjust-position="getInput.adjustPosition"
41
+ :hold-keyboard="getInput.holdKeyboard"
42
+ :auto-blur="getInput.autoBlur"
43
+ :show-confirmbar="getInput.showConfirmbar"
44
+ :auto-height="getInput.autoHeight"
45
+ :fixed="getInput.fixed"
46
+ :disable-default-padding="getInput.disableDefaultPadding"
47
+ :clearable="getInput.clearable"
48
+ :clear-icon="getInput.clearIcon"
49
+ @click="handleShow()"
50
+ @clear="handleClearValue"
46
51
  />
47
52
 
48
53
  <!-- 地区弹出框 -->
@@ -63,6 +68,10 @@
63
68
  :confirm-btn="getRegionsSelect.confirmBtn"
64
69
  :cancel-btn="getRegionsSelect.cancelBtn"
65
70
  @confirm="handleRegionsSelectConfirm"
71
+ @close="$emit('close', $event)"
72
+ @closed="$emit('closed', $event)"
73
+ @show="$emit('show', $event)"
74
+ @showed="$emit('showed', $event)"
66
75
  />
67
76
  </view>
68
77
  </template>
@@ -132,6 +141,10 @@ export default {
132
141
  fn: regionsSelectInput.parseValueFn
133
142
  }
134
143
  }
144
+ },
145
+ disabled: {
146
+ type: Boolean,
147
+ default: regionsSelectInput.disabled
135
148
  }
136
149
  },
137
150
  data() {
@@ -140,8 +153,17 @@ export default {
140
153
  }
141
154
  },
142
155
  computed: {
156
+ getInput() {
157
+ return this.$pi.lang.mergeDeep(regionsSelectInput.input, this.input)
158
+ },
143
159
  getRegionsSelect() {
144
- return this.$pi.lang.mergeDeep(regionsSelectInput.regionsSelect, this.regionsSelect)
160
+ return {
161
+ ...this.$pi.lang.mergeDeep(
162
+ regionsSelectInput.regionsSelect,
163
+ this.regionsSelect
164
+ ),
165
+ regionsData: this.regionsSelect.regionsData
166
+ }
145
167
  },
146
168
  getInputValue() {
147
169
  const parseValueFn = this.parseValueFn[PI_DEFAULT_FN_FLAG]
@@ -156,11 +178,24 @@ export default {
156
178
  const code = this.getRegionsSelect.keyDefaultValue
157
179
  ? this.val
158
180
  : this.val[this.getRegionsSelect.keyField]
159
- const regions = this.$pi.regions.parseRegions(code, this.getRegionsSelect.regionsData)
181
+ const regions = this.$pi.regions.parseRegions(
182
+ code,
183
+ this.getRegionsSelect.regionsData
184
+ )
160
185
  return this.generateRegionsName(regions)
186
+ },
187
+ getDisabled() {
188
+ const parent = this.$pi.parent(this, 'PiFormItem')
189
+ return this.disabled || (parent && parent.getDisabled)
161
190
  }
162
191
  },
163
192
  methods: {
193
+ handleShow() {
194
+ if (this.getDisabled) {
195
+ return
196
+ }
197
+ this.show = true
198
+ },
164
199
  generateRegionsName(regions) {
165
200
  const addressFields = ['province', 'city', 'county', 'street']
166
201
  return addressFields
@@ -180,6 +215,9 @@ export default {
180
215
  handleRegionsSelectConfirm(value) {
181
216
  this.val = value
182
217
  this.handleEmitChange()
218
+ },
219
+ handleClearValue() {
220
+ this.handleRegionsSelectConfirm(null)
183
221
  }
184
222
  }
185
223
  }
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <view class="pi-align-center pi-w-100P" :style="[customStyle]" :class="[customClass]">
2
+ <view
3
+ class="pi-align-center pi-w-100P"
4
+ :style="[customStyle]"
5
+ :class="[customClass]"
6
+ >
3
7
  <view v-if="searchLabel" class="pi-pd-right-18" :style="[searchLabelStyle]">
4
8
  {{ searchLabel }}
5
9
  </view>
@@ -34,6 +38,7 @@
34
38
  :class="[{ 'pi-pd-left-18': searchIconPosition === 'right' }]"
35
39
  >
36
40
  <input
41
+ v-if="isControlFocus"
37
42
  class="pi-flex-sub pi-fz-28"
38
43
  confirm-type="search"
39
44
  :value="val"
@@ -49,8 +54,28 @@
49
54
  @input="handleInputChange"
50
55
  @focus="handleInputFocus"
51
56
  />
57
+ <input
58
+ v-else
59
+ class="pi-flex-sub pi-fz-28"
60
+ confirm-type="search"
61
+ :value="val"
62
+ :disabled="disabled"
63
+ :maxlength="parseInt(maxlength, 10)"
64
+ :placeholder="placeholder"
65
+ :placeholder-style="placeholderStyle"
66
+ type="text"
67
+ :style="[mergeInputStyle]"
68
+ @blur="handleInputBlur"
69
+ @confirm="handleInputSearch"
70
+ @input="handleInputChange"
71
+ @focus="handleInputFocus"
72
+ />
52
73
  <!-- clear action -->
53
- <view v-if="clearable && val" class="pi-pd-lr-18" @tap="handleClearInput">
74
+ <view
75
+ v-if="clearable && val"
76
+ class="pi-pd-lr-18"
77
+ @tap="handleClearInput"
78
+ >
54
79
  <view class="pi-icon-roundclosefill" :style="[clearIconStyle]" />
55
80
  </view>
56
81
  </view>
@@ -271,6 +296,16 @@ export default {
271
296
  }
272
297
  },
273
298
  computed: {
299
+ isControlFocus() {
300
+ // #ifdef APP-PLUS
301
+ const info = uni.getSystemInfoSync()
302
+ return info.platform !== 'android'
303
+ // #endif
304
+
305
+ // #ifndef APP-PLUS
306
+ return true
307
+ // #endif
308
+ },
274
309
  getHeight() {
275
310
  return this.$pi.common.addUnit(this.height)
276
311
  },
@@ -209,7 +209,7 @@ export default {
209
209
  }
210
210
  &.border {
211
211
  @include pi-border;
212
- &::after {
212
+ &::before {
213
213
  border: 0 solid $pi-section-border-color;
214
214
  border-bottom-width: $pi-section-border-width;
215
215
  }