sadais-piui 1.2.2-beta6 → 1.2.4-beta2

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ <a name="1.2.3"></a>
4
+ ## 1.2.3 (2022-03-26)
5
+
6
+ ### Added
7
+
8
+ - ✨ feat: pi-select增加single-confirm选项配置 [def559e]
9
+ - ✨ feat: 增加pi-action-sheet组件 [bf179cd]
10
+ - ✨ feat: 增加文字按钮类型 [767a4a6]
11
+ - ✨ feat: pi-radio pi-radio-group 增加canCancel属性 [7874058]
12
+ - ✨ feat: 优化pi-bottom-bar下按钮显示字数 [a671bd6]
13
+
14
+ ### Changed
15
+
16
+ - 🎨 chore: 增加 changelog 命令 [51238e6]
17
+
18
+ ### Fixed
19
+
20
+ - 🐛 fix: 修复input组件keyboardheightchange方法没有声明的问题 [6d26acf]
21
+ - 🐛 fix: 修复表单属性无法覆盖的问题 [b7308e5]
22
+ - 🐛 fix: 修复主题颜色被覆盖的问题 [12666d2]
23
+ - 🐛 fix: 修复pi-img缺失show-menu-by-longpress的问题 [be8a020]
24
+
25
+ ### Miscellaneous
26
+
27
+ - 📝 docs: 更新群二维码信息 [796040f]
28
+
29
+
3
30
  <a name="1.2.0"></a>
4
31
  ## 1.2.0 (2021-11-24)
5
32
 
@@ -0,0 +1,247 @@
1
+ <template>
2
+ <pi-popup-select
3
+ :value="val"
4
+ :custom-style="getPopupSelect.customStyle"
5
+ :custom-class="getPopupSelect.customClass"
6
+ :height="getPopupSelect.height"
7
+ :show-title="getPopupSelect.showTitle"
8
+ :title="getPopupSelect.title"
9
+ :title-padding="getPopupSelect.titlePadding"
10
+ :toolbar-position="getPopupSelect.toolbarPosition"
11
+ :on-confirm-close="getPopupSelect.onConfirmClose"
12
+ :on-cancel-close="getPopupSelect.onCancelClose"
13
+ :confirm-btn="getPopupSelect.confirmBtn"
14
+ :cancel-btn="getPopupSelect.cancelBtn"
15
+ :popup="getPopup"
16
+ @close="handlePopupClose"
17
+ @cancel="handleCancel"
18
+ @confirm="handleConfirm"
19
+ >
20
+ <slot name="header" />
21
+ <!-- 描述列 -->
22
+ <view
23
+ v-if="description"
24
+ class="pi-solid-bottom-2 pi-align-center pi-pd-32 pi-light-gray"
25
+ :style="[getItemAlignStyle]"
26
+ >
27
+ {{ description }}
28
+ </view>
29
+ <view
30
+ v-for="item in items"
31
+ :id="`id-${item[keyField]}`"
32
+ :key="item[keyField]"
33
+ :style="[itemStyle, getItemStyle, getItemAlignStyle, { color: item.color }]"
34
+ :class="{
35
+ 'pi-solid-bottom-1': showItemBottomBorder,
36
+ 'pi-disabled': item.disabled
37
+ }"
38
+ class="pi-align-center pi-fz-30 pi-pd-lr-32"
39
+ hover-class="pi-hover-class"
40
+ @tap.stop="handleSelectItem(item)"
41
+ >
42
+ <!-- 自定义列表项 -->
43
+ <slot name="item" :item="item" class="pi-w-100P">
44
+ <template v-if="!item.loading">
45
+ {{ item[displayField] }}
46
+ </template>
47
+ <pi-loading v-else show />
48
+ </slot>
49
+ </view>
50
+ <!-- 取消action -->
51
+ <template v-if="cancelText">
52
+ <pi-gap height="20" />
53
+ <view
54
+ class="pi-align-center pi-fz-30 pi-pd-32 pi-light-gray"
55
+ hover-class="pi-hover-class"
56
+ :style="[getItemAlignStyle]"
57
+ @tap="handleCancel"
58
+ >
59
+ {{ cancelText }}
60
+ </view>
61
+ </template>
62
+
63
+ <slot name="footer" />
64
+ </pi-popup-select>
65
+ </template>
66
+
67
+ <script>
68
+ import ValueSync from '../../mixin/value-sync'
69
+ import { getConfig } from '../../config'
70
+
71
+ const TAG = 'PiActionSheet'
72
+ const { actionSheet } = getConfig()
73
+
74
+ const alignFlexMap = {
75
+ left: 'flex-start',
76
+ center: 'center',
77
+ right: 'flex-end'
78
+ }
79
+
80
+ export default {
81
+ name: 'PiActionSheet',
82
+ // 混入v-model
83
+ mixins: [ValueSync],
84
+ props: {
85
+ // 初始值
86
+ value: {
87
+ required: false
88
+ },
89
+ // 自定义样式
90
+ customStyle: {
91
+ type: Object,
92
+ // {}
93
+ default() {
94
+ return actionSheet.customStyle
95
+ }
96
+ },
97
+ // 自定义样式类
98
+ customClass: {
99
+ type: String,
100
+ // ''
101
+ default() {
102
+ return actionSheet.customClass
103
+ }
104
+ },
105
+ // 选项列表
106
+ items: {
107
+ type: Array,
108
+ // []
109
+ default() {
110
+ return actionSheet.items
111
+ }
112
+ },
113
+ // 选项id字段
114
+ keyField: {
115
+ type: String,
116
+ // 'id'
117
+ default: actionSheet.keyField
118
+ },
119
+ // 选项显示字段
120
+ displayField: {
121
+ type: String,
122
+ // 'text'
123
+ default: actionSheet.displayField
124
+ },
125
+ // 自定义多列联动模式的children属性名
126
+ childField: {
127
+ type: String,
128
+ // 'children'
129
+ default: actionSheet.childField
130
+ },
131
+ // 行高 单位默认rpx
132
+ itemHeight: {
133
+ type: [String, Number],
134
+ // 110
135
+ default: actionSheet.itemHeight
136
+ },
137
+ // 是否显示item下边框
138
+ showItemBottomBorder: {
139
+ type: Boolean,
140
+ // true
141
+ default: actionSheet.showItemBottomBorder
142
+ },
143
+ // 行样式
144
+ itemStyle: {
145
+ type: Object,
146
+ // {}
147
+ default() {
148
+ return actionSheet.itemStyle
149
+ }
150
+ },
151
+ itemAlign: {
152
+ type: String,
153
+ // 'center'
154
+ default: actionSheet.itemAlign,
155
+ validator: function(value) {
156
+ return ['left', 'center', 'right'].includes(value)
157
+ }
158
+ },
159
+ // 弹窗选择参数设置
160
+ popupSelect: {
161
+ type: Object,
162
+ default() {
163
+ // 参照popup
164
+ return actionSheet.popupSelect
165
+ }
166
+ },
167
+ // 弹窗参数设置
168
+ popup: {
169
+ type: Object,
170
+ default() {
171
+ // 参照popup
172
+ return actionSheet.popup
173
+ }
174
+ },
175
+ // 选项上方的描述信息,不填则不显示
176
+ description: {
177
+ type: String,
178
+ // ''
179
+ default: actionSheet.description
180
+ },
181
+ // 取消按钮文字,不填则不显示
182
+ cancelText: {
183
+ type: String,
184
+ // ''
185
+ default: actionSheet.cancelText
186
+ }
187
+ },
188
+ data() {
189
+ return {}
190
+ },
191
+ computed: {
192
+ getPopupSelect() {
193
+ return this.$pi.lang.mergeDeep(actionSheet.popupSelect, this.popupSelect)
194
+ },
195
+ getPopup() {
196
+ const actionSheetPopup = this.$pi.lang.mergeDeep(actionSheet.popup, this.popupSelect.popup)
197
+ return this.$pi.lang.mergeDeep(actionSheetPopup, this.popup)
198
+ },
199
+ getItemAlignStyle() {
200
+ return {
201
+ justifyContent: alignFlexMap[this.itemAlign]
202
+ }
203
+ },
204
+ getItemStyle() {
205
+ const itemHeight = this.$pi.common.addUnit(this.itemHeight)
206
+ return {
207
+ height: itemHeight,
208
+ lineHeight: itemHeight
209
+ }
210
+ },
211
+ indicatorStyle() {
212
+ const itemHeight = uni.upx2px(this.itemHeight)
213
+ return `height: ${itemHeight}px;line-height: ${itemHeight}px;`
214
+ }
215
+ },
216
+ methods: {
217
+ handlePopupClose() {
218
+ this.val = false
219
+ // 弹窗关闭
220
+ this.$emit('close')
221
+ this.handleEmitChange()
222
+ },
223
+ /**
224
+ * @vuese
225
+ * 取消选择
226
+ */
227
+ handleCancel() {
228
+ this.$emit('cancel')
229
+ this.getPopupSelect.onConfirmClose && this.handlePopupClose()
230
+ },
231
+ /**
232
+ * @vuese
233
+ * 确认选择
234
+ */
235
+ handleSelectItem(item) {
236
+ if (item.disabled) return
237
+ this.$emit('select', item)
238
+ this.getPopupSelect.onConfirmClose && this.handlePopupClose()
239
+ }
240
+ }
241
+ }
242
+ </script>
243
+
244
+ <style lang="scss" scoped>
245
+ .pi-action-sheet {
246
+ }
247
+ </style>
@@ -223,7 +223,7 @@ export default {
223
223
  return this.minDate ? this.$pi.date.parseDate(this.minDate) : ''
224
224
  },
225
225
  getMaxDate() {
226
- return this.minDate ? this.$pi.date.parseDate(this.maxDate) : ''
226
+ return this.maxDate ? this.$pi.date.parseDate(this.maxDate) : ''
227
227
  },
228
228
  isMinYear() {
229
229
  return this.year === parseInt(this.minYear, 10)
@@ -59,6 +59,8 @@ const TAG = 'PiRegionsSelect'
59
59
  const { regionsSelect } = getConfig()
60
60
  const PLEASE_SELECT_TIP = '请选择'
61
61
 
62
+
63
+
62
64
  export default {
63
65
  name: 'PiRegionsSelect',
64
66
  // 混入v-model
@@ -237,14 +239,19 @@ export default {
237
239
  handler(value) {
238
240
  this.init()
239
241
  }
242
+ },
243
+ regionsData: {
244
+ handler(value) {
245
+ this.init()
246
+ }
240
247
  }
241
248
  },
242
249
  methods: {
243
250
  init() {
244
- if (this.defaultValue) {
245
- const regions = this.$pi.regions.parseRegions(this.defaultValue.code, this.regionsData)
246
- this.regions = regions
247
- }
251
+ console.log(TAG, '地区选择组件初始化')
252
+ const defaultCode = this.defaultValue ? this.defaultValue.code : ''
253
+ const regions = this.$pi.regions.parseRegions(defaultCode, this.regionsData)
254
+ this.regions = regions
248
255
  // 默认都是展示tab最后一个列表
249
256
  this.tabCurrentItem = this.getTabItems[this.getTabItems.length - 1]
250
257
  },
@@ -155,6 +155,12 @@ export default {
155
155
  // true
156
156
  default: select.singleCancel
157
157
  },
158
+ // 单选模式下,是否直接选中,不需要点击确认按钮
159
+ singleConfirm: {
160
+ type: Boolean,
161
+ // false
162
+ default: select.singleConfirm
163
+ },
158
164
  // 行高 值为数字,则单位默认rpx
159
165
  itemHeight: {
160
166
  type: [String, Number],
@@ -235,7 +241,11 @@ export default {
235
241
  return this.$pi.lang.mergeDeep(select.selectedCheckbox, this.selectedCheckbox)
236
242
  },
237
243
  getPopupSelect() {
238
- return this.$pi.lang.mergeDeep(select.popupSelect, this.popupSelect)
244
+ const popupSelect = this.$pi.lang.mergeDeep(select.popupSelect, this.popupSelect)
245
+ if (!this.singleCancel && this.singleConfirm) {
246
+ popupSelect.toolbarPosition = 'none'
247
+ }
248
+ return popupSelect
239
249
  },
240
250
  getConfirmBtn() {
241
251
  const selectConfirmBtn = this.$pi.lang.mergeDeep(
@@ -303,6 +313,7 @@ export default {
303
313
  // 单选
304
314
  if (!this.singleCancel) {
305
315
  this.selected = item
316
+ this.singleConfirm && this.handleConfirm()
306
317
  return
307
318
  }
308
319
  // 如果单选允许取消,需要判断是否点击了同一个选项
@@ -351,7 +362,7 @@ export default {
351
362
  */
352
363
  handleCancel() {
353
364
  this.$emit('cancel')
354
- this.onCancelClose && this.handlePopupClose()
365
+ this.getPopupSelect.onCancelClose && this.handlePopupClose()
355
366
  },
356
367
  /**
357
368
  * @vuese
@@ -0,0 +1,25 @@
1
+ import popupSelect from './popupSelect'
2
+
3
+ export default {
4
+ customClass: '', // 自定义样式类,字符串形式('')
5
+ customStyle: {}, // 自定义样式,对象形式(默认值:{})
6
+ type: 'single', // 选择器类型:single:单列,multi 多列,multi-auto 多列联动
7
+ items: [], // 选项列表,默认([])
8
+ keyField: 'id', // 选项id字段,默认为id
9
+ displayField: 'text', // 选项显示字段,默认为text
10
+ itemHeight: 110, // 行高(默认:'110rpx')
11
+ itemStyle: {}, // 行样式(默认:{})
12
+ itemAlign: 'center', // 行对齐方式,默认值:'center'
13
+ showItemBottomBorder: true, // 是否显示底部边线
14
+ popupSelect: {
15
+ ...popupSelect,
16
+ height: 'auto',
17
+ toolbarPosition: 'none'
18
+ }, // popupSelect配置
19
+ popup: {
20
+ ...popupSelect.popup,
21
+ borderRadius: '24rpx 24rpx 0 0'
22
+ }, // 弹窗的配置,默认选项请参照popup
23
+ description: '', // 选项上方的描述信息,不填则不显示
24
+ cancelText: '' // 取消按钮文字,不填则不显示
25
+ }
package/config/select.js CHANGED
@@ -11,6 +11,7 @@ export default {
11
11
  defaultValue: null, // 默认值,单选是传Object,多选时传Array,默认null
12
12
  isMulti: false, // 是否多选,(默认:false)
13
13
  singleCancel: true, // 单选模式下,是否可取消选中
14
+ singleConfirm: false, // 单选模式下,是否直接选中,不需要点击确认按钮(需要设置singleCancel:false)
14
15
  itemHeight: 110, // 行高(默认:'110rpx')
15
16
  showItemBottomBorder: true, // 是否显示item下边框(默认:'true')
16
17
  itemStyle: {}, // 行样式(默认:'{}')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.2-beta6",
3
+ "version": "1.2.4-beta2",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/scss/common.scss CHANGED
@@ -816,3 +816,8 @@ uni-toast {
816
816
  .pi-h-100P {
817
817
  height: 100%;
818
818
  }
819
+
820
+ .pi-disabled {
821
+ opacity: $pi-disabled-opacity;
822
+ cursor: not-allowed;
823
+ }