sadais-piui 1.2.7-beta55 → 1.2.7-beta56

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.
@@ -289,14 +289,13 @@ $unactive-color: #cccccc;
289
289
  }
290
290
  .check-label {
291
291
  flex: 1;
292
- margin-left: 16rpx;
292
+ padding: 0 24rpx 0 16rpx;
293
293
  line-height: 1.5;
294
294
  word-wrap: break-word;
295
295
  transition: $pi-animation-duration $pi-animation-timing-function;
296
296
  transition-property: border, color, background-color;
297
297
  &.text {
298
298
  padding: 12rpx 24rpx;
299
- margin-left: 0;
300
299
  color: $unactive-color;
301
300
  border-color: transparent;
302
301
  border-style: solid;
@@ -182,7 +182,8 @@ export default {
182
182
  emitChange() {
183
183
  const vals = []
184
184
  this._children.forEach(child => {
185
- if (child.val && child.name) vals.push(child.name)
185
+ console.log(child.val, child.name)
186
+ if (child.val && !this.$pi.lang.isEmpty(child.name)) vals.push(child.name)
186
187
  })
187
188
  this.val = vals
188
189
  this.handleEmitChange()
@@ -209,13 +210,6 @@ export default {
209
210
  &.horizontal {
210
211
  flex-direction: row;
211
212
  align-items: center;
212
- ::v-deep .pi-check-wrap:not(:last-child) {
213
- margin-right: 28rpx;
214
- }
215
- // 兼容小程序
216
- ::v-deep pi-checkbox:not(:last-child) {
217
- margin-right: 28rpx;
218
- }
219
213
  }
220
214
  }
221
215
  </style>
@@ -290,21 +290,21 @@ $unactive-color: #cccccc;
290
290
  }
291
291
  .radio-label {
292
292
  flex: 1;
293
- margin-left: 16rpx;
293
+ padding: 0 24rpx 0 16rpx;
294
294
  line-height: 1.5;
295
295
  word-wrap: break-word;
296
296
  transition: $pi-animation-duration $pi-animation-timing-function;
297
297
  transition-property: border, color, background-color;
298
298
  &.text {
299
299
  padding: 12rpx 24rpx;
300
- margin-left: 0;
300
+
301
301
  color: $unactive-color;
302
302
  border-color: transparent;
303
303
  border-style: solid;
304
304
  }
305
305
  &.button {
306
306
  padding: 24rpx;
307
- margin-left: 0;
307
+
308
308
  line-height: 1;
309
309
  color: $unactive-color;
310
310
  border-color: transparent;
@@ -271,10 +271,6 @@ export default {
271
271
  &.horizontal:not(.button) {
272
272
  flex-direction: row;
273
273
  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
274
  }
279
275
  }
280
276
  </style>
@@ -22,6 +22,23 @@
22
22
  >
23
23
  <view class="pi-select pi-h-100P pi-flex-column" :style="[customStyle]" :class="[customClass]">
24
24
  <slot name="header" />
25
+ <view
26
+ v-if="showSelectAll"
27
+ class="select-item pi-align-center pi-justify-end pi-pd-lr-32"
28
+ :style="[itemStyle, getItemStyle]"
29
+ @tap.stop="handleSelectAll"
30
+ >
31
+ <view>全选</view>
32
+ <view>
33
+ <pi-checkbox
34
+ :value="isSelectAll"
35
+ readonly
36
+ shape="round"
37
+ custom-class="pi-mg-left-32"
38
+ active-mode="fill-circle"
39
+ />
40
+ </view>
41
+ </view>
25
42
  <scroll-view
26
43
  scroll-y
27
44
  class="pi-scroll"
@@ -167,6 +184,12 @@ export default {
167
184
  // false
168
185
  default: select.isMulti
169
186
  },
187
+ // 是否显示全选(多选isMulti开启的情况下)
188
+ showSelectAll: {
189
+ type: Boolean,
190
+ // false
191
+ default: select.showSelectAll
192
+ },
170
193
  // 单选模式下,是否可取消选中
171
194
  singleCancel: {
172
195
  type: Boolean,
@@ -304,6 +327,9 @@ export default {
304
327
  const firstSelected = this.selected[0] || this.selected
305
328
  const firstSelectedId = firstSelected[this.keyField]
306
329
  return firstSelectedId ? `id-${firstSelected[this.keyField]}` : ''
330
+ },
331
+ isSelectAll() {
332
+ return this.getItems.every(item => item.isSelected)
307
333
  }
308
334
  },
309
335
  watch: {
@@ -456,6 +482,11 @@ export default {
456
482
  }
457
483
  this.$emit('confirm', selected, this.selected)
458
484
  this.getPopupSelect.onConfirmClose && this.handlePopupClose()
485
+ },
486
+ handleSelectAll() {
487
+ if (this.isMulti) {
488
+ this.selected = this.isSelectAll ? [] : [...this.items]
489
+ }
459
490
  }
460
491
  }
461
492
  }
package/config/select.js CHANGED
@@ -12,6 +12,7 @@ export default {
12
12
  keyDefaultValue: false, // 是否只绑定keyField的默认值,默认false
13
13
  defaultValue: null, // 默认值,单选是传Object,多选时传Array,默认null
14
14
  isMulti: false, // 是否多选,(默认:false)
15
+ showSelectAll: false, // 是否显示全选(多选isMulti开启的情况下)
15
16
  singleCancel: true, // 单选模式下,是否可取消选中
16
17
  singleConfirm: false, // 单选模式下,是否直接选中,不需要点击确认按钮(需要设置singleCancel:false)
17
18
  itemHeight: 110, // 行高(默认:'110rpx')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7beta55",
3
+ "version": "1.2.7beta56",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {