sadais-piui 1.2.7-beta6 → 1.2.7-beta60

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 (55) hide show
  1. package/components/pi-bottom-bar/index.vue +1 -1
  2. package/components/pi-calendar/index.vue +4 -0
  3. package/components/pi-calendar-input/index.vue +6 -2
  4. package/components/pi-calendar-panel/components/calendar-days/index.vue +410 -0
  5. package/components/pi-calendar-panel/index.vue +201 -163
  6. package/components/pi-cascader/index.vue +536 -0
  7. package/components/pi-checkbox/index.vue +3 -4
  8. package/components/pi-checkbox-group/index.vue +2 -8
  9. package/components/pi-circle-progress/index.vue +65 -9
  10. package/components/pi-collapse/index.vue +124 -0
  11. package/components/pi-collapse-item/index.vue +352 -0
  12. package/components/pi-date-picker/index.vue +4 -1
  13. package/components/pi-date-picker-input/index.vue +6 -2
  14. package/components/pi-dropdown/components/dropdown-tab.vue +33 -24
  15. package/components/pi-dropdown/index.vue +53 -21
  16. package/components/pi-dropdown-item/index.vue +74 -55
  17. package/components/pi-form-item/index.vue +9 -4
  18. package/components/pi-grid/index.vue +1 -1
  19. package/components/pi-grid-item/index.vue +4 -4
  20. package/components/pi-img/index.vue +0 -1
  21. package/components/pi-input/index.vue +21 -3
  22. package/components/pi-list-item/index.vue +1 -1
  23. package/components/pi-popup/index.vue +4 -0
  24. package/components/pi-radio/index.vue +5 -5
  25. package/components/pi-radio-group/index.vue +0 -4
  26. package/components/pi-regions-select/index.vue +6 -1
  27. package/components/pi-regions-select-input/index.vue +6 -2
  28. package/components/pi-search/index.vue +29 -2
  29. package/components/pi-section/index.vue +1 -1
  30. package/components/pi-select/index.vue +48 -4
  31. package/components/pi-select-input/index.vue +6 -2
  32. package/components/pi-stepper/index.vue +1 -1
  33. package/components/pi-steps/index.vue +115 -36
  34. package/components/pi-table/index.vue +298 -0
  35. package/components/pi-tabs/index.vue +11 -4
  36. package/components/pi-tag/index.vue +488 -0
  37. package/components/pi-upload-img/index.vue +58 -9
  38. package/components/pi-webview/index.vue +9 -3
  39. package/config/actionSheet.js +0 -1
  40. package/config/calendarPanel.js +4 -1
  41. package/config/cascader.js +22 -0
  42. package/config/circleProgress.js +7 -8
  43. package/config/collapse.js +7 -0
  44. package/config/collapseItem.js +11 -0
  45. package/config/dropdown.js +4 -1
  46. package/config/input.js +1 -0
  47. package/config/select.js +2 -0
  48. package/config/steps.js +1 -1
  49. package/config/table.js +6 -0
  50. package/config/tag.js +21 -0
  51. package/config/uploadImg.js +3 -7
  52. package/package.json +1 -1
  53. package/scss/common.scss +11 -11
  54. package/scss/icon/icon.scss +2 -1
  55. package/scss/mixin.scss +1 -1
@@ -18,7 +18,7 @@
18
18
  <!-- fixed时候的占位空间 -->
19
19
  <template v-if="fixed">
20
20
  <view class="pi-bottom-bar-placeholder" :style="[{ height: barHeight }]" />
21
- <view v-if="safeArea" class="pi-safearea" />
21
+ <!-- <view v-if="safeArea" class="pi-safearea" /> -->
22
22
  </template>
23
23
  </view>
24
24
  </template>
@@ -15,6 +15,9 @@
15
15
  :z-index="getPopup.zIndex"
16
16
  :background="getPopup.background"
17
17
  @close="handlePopupClose"
18
+ @closed="$emit('closed', $event)"
19
+ @show="$emit('show', $event)"
20
+ @showed="$emit('showed', $event)"
18
21
  >
19
22
  <view class="pi-calendar" :style="[customStyle]" :class="[customClass]">
20
23
  <!-- 标题栏 -->
@@ -39,6 +42,7 @@
39
42
  :start-text="getCalendarPanel.startText"
40
43
  :end-text="getCalendarPanel.endText"
41
44
  :date-format="getCalendarPanel.dateFormat"
45
+ @date-change="$emit('date-change', $event)"
42
46
  />
43
47
  <!-- footer -->
44
48
  <view class="pi-w-100P pi-align-center pi-pd-24 pi-solid-top-1">
@@ -1,10 +1,10 @@
1
1
  <!--
2
2
  * @Author: zhangzhenfei
3
3
  * @Date: 2022-05-18 11:08:49
4
- * @LastEditTime: 2022-05-21 15:00:48
4
+ * @LastEditTime: 2022-10-20 09:32:17
5
5
  * @LastEditors: zhangzhenfei
6
6
  * @Description: 日历输入
7
- * @FilePath: /hfmp-checkin-front/Users/feilin/workspace/piui/piui-awesome/src/piui/components/pi-calendar-input/index.vue
7
+ * @FilePath: /dt-weitibao-console/Users/feilin/workspace/piui/piui-awesome/src/piui/components/pi-calendar-input/index.vue
8
8
  -->
9
9
 
10
10
  <template>
@@ -61,6 +61,10 @@
61
61
  }"
62
62
  :popup="getCalendar.popup"
63
63
  @confirm="handleCalendarConfirm"
64
+ @close="$emit('close', $event)"
65
+ @closed="$emit('closed', $event)"
66
+ @show="$emit('show', $event)"
67
+ @showed="$emit('showed', $event)"
64
68
  />
65
69
  </view>
66
70
  </template>
@@ -0,0 +1,410 @@
1
+ <!--
2
+ * @Author: zhangzhenfei
3
+ * @Date: 2022-06-28 16:53:54
4
+ * @LastEditTime: 2022-11-24 10:35:53
5
+ * @LastEditors: zhangzhenfei
6
+ * @Description: 日历日期数据
7
+ * @FilePath: /dt-weitibao-console/Users/feilin/workspace/piui/piui-awesome/src/piui/components/pi-calendar-panel/components/calendar-days/index.vue
8
+ -->
9
+
10
+ <template>
11
+ <view class="pi-rela pi-align-center pi-flex-wrap pi-pd-24">
12
+ <view
13
+ v-for="day in days"
14
+ :key="day.key"
15
+ class="date-item"
16
+ style="cursor: pointer;"
17
+ :class="[
18
+ { 'pi-disabled': day.disabled || day.type === 'disabled' },
19
+ { range: day.range },
20
+ { marked: day.marked }
21
+ ]"
22
+ @tap.stop="handleSelectDate(day)"
23
+ >
24
+ <view class="pi-square">
25
+ <view class="pi-rela date-item-inner">
26
+ <view
27
+ class="pi-w-100P pi-h-100P pi-flex-column-center pi-lh-28"
28
+ :style="[day.nowStyle, day.activeStyle, day.rangeStyle]"
29
+ >
30
+ <text>{{ day.date }}</text>
31
+ <text v-if="day.tip" class=" pi-text-nowrap pi-fz-18 pi-mg-top-6">
32
+ {{ day.tip }}
33
+ </text>
34
+ </view>
35
+ </view>
36
+ </view>
37
+ </view>
38
+ <!-- 日历蒙层 -->
39
+ <view
40
+ class="pi-abso-center pi-fw-500 pi-light-gray pi-text-nowrap"
41
+ style="
42
+ z-index: -1;
43
+ pointer-events: none;
44
+ opacity: 0.15;"
45
+ :style="[
46
+ { fontSize: weekView ? '32rpx' : '300rpx' },
47
+ { marginTop: weekView ? '30rpx' : '0' }
48
+ ]"
49
+ >
50
+ {{ getBgTip }}
51
+ </view>
52
+ </view>
53
+ </template>
54
+
55
+ <script>
56
+ import { getConfig } from '../../../../config'
57
+ const { calendarPanel } = getConfig()
58
+
59
+ export default {
60
+ name: 'PiCalendarDays',
61
+ props: {
62
+ calendarValue: {
63
+ type: [String, Object, Array],
64
+ default: ''
65
+ },
66
+ year: {
67
+ type: [String, Number],
68
+ default: ''
69
+ },
70
+ month: {
71
+ type: [String, Number],
72
+ default: ''
73
+ },
74
+ // 当前展示周
75
+ week: {
76
+ type: Number,
77
+ default: 0
78
+ },
79
+ // 日历类型
80
+ type: {
81
+ // `'date'-单个日期`, `'range'-范围日期`
82
+ type: String,
83
+ // 'date'
84
+ default: calendarPanel.type,
85
+ validator: function(value) {
86
+ return ['date', 'range'].includes(value)
87
+ }
88
+ },
89
+ // 最小可选日期(不在范围内日期禁用不可选,默认'',不作限制)
90
+ minDate: {
91
+ type: [Number, String, Date],
92
+ // ''
93
+ default: calendarPanel.minDate
94
+ },
95
+ // 最大可选日期(不在范围内日期禁用不可选,默认'',不作限制)
96
+ maxDate: {
97
+ type: [Number, String, Date],
98
+ // ''
99
+ default: calendarPanel.maxDate
100
+ },
101
+ // 是否显示回到今日
102
+ showBackToday: {
103
+ type: Boolean,
104
+ // true
105
+ default: calendarPanel.showBackToday
106
+ },
107
+ // 今日日期激活边框颜色
108
+ todayActiveBorderColor: {
109
+ type: String,
110
+ // '#ff6a00'
111
+ default: calendarPanel.todayActiveBorderColor
112
+ },
113
+ // 选中|起始结束日期字体颜色
114
+ activeColor: {
115
+ type: String,
116
+ // '#ffffff'
117
+ default: calendarPanel.activeColor
118
+ },
119
+ // 选中|起始结束日期背景,默认
120
+ activeBg: {
121
+ type: String,
122
+ // '#ff6a00'
123
+ default: calendarPanel.activeBg
124
+ },
125
+ // 选中圆角效果
126
+ activeBorderRadius: {
127
+ type: [String, Number],
128
+ // '0 0 0 0'
129
+ default: calendarPanel.activeBorderRadius
130
+ },
131
+ // 范围内日期字体颜色默认
132
+ rangeColor: {
133
+ type: String,
134
+ // '#ff6a00'
135
+ default: calendarPanel.rangeColor
136
+ },
137
+ // 范围内日期背景色
138
+ rangeBg: {
139
+ type: String,
140
+ // 'rgba(254, 106, 0, 0.1)'
141
+ default: calendarPanel.rangeBg
142
+ },
143
+ // type=range时生效,起始日期自定义文案
144
+ startText: {
145
+ type: String,
146
+ // '开始'
147
+ default: calendarPanel.startText
148
+ },
149
+ // type=range时生效,结束日期自定义文案
150
+ endText: {
151
+ type: String,
152
+ // '结束'
153
+ default: calendarPanel.endText
154
+ },
155
+ weekView: {
156
+ type: Boolean,
157
+ // '是否显示周视图'
158
+ default: calendarPanel.defalutWeekView
159
+ },
160
+ // 日期标记,数组形式,默认([])
161
+ marks: {
162
+ type: Array,
163
+ // []
164
+ default: () => calendarPanel.marks
165
+ }
166
+ },
167
+ data() {
168
+ const now = this.$pi.date.parseDate()
169
+ return {
170
+ now: now // 当前时间
171
+ }
172
+ },
173
+ computed: {
174
+ getActiveBorderRadius() {
175
+ return this.$pi.common.addUnit(this.activeBorderRadius)
176
+ },
177
+ // 获取上个月最后一天
178
+ getPreMonthLastDay() {
179
+ let year = this.year
180
+ let month = this.month - 1
181
+ if (month === 0) {
182
+ year = year - 1
183
+ month = 12
184
+ }
185
+ return new Date(year, month, '0')
186
+ },
187
+ getNextMonthFirstDay() {
188
+ let year = this.year
189
+ let month = this.month + 1
190
+ if (month === 13) {
191
+ year = year + 1
192
+ month = 1
193
+ }
194
+ return new Date(year, month - 1, '1')
195
+ },
196
+ // 第一天
197
+ firstDay() {
198
+ const firstDays = []
199
+ const preMonthLastDay = this.getPreMonthLastDay
200
+ const lastDay = preMonthLastDay.getDate()
201
+ const firstDay = new Date(this.year, this.month - 1, '1').getDay()
202
+ for (let i = 0; i < firstDay; i++) {
203
+ const day = preMonthLastDay.setDate(lastDay - firstDay + i + 1)
204
+ firstDays.push(new Date(day))
205
+ }
206
+ return firstDays
207
+ },
208
+ getMinDate() {
209
+ return this.minDate ? this.$pi.date.parseDate(this.minDate) : ''
210
+ },
211
+ getMaxDate() {
212
+ return this.maxDate ? this.$pi.date.parseDate(this.maxDate) : ''
213
+ },
214
+ getMarks() {
215
+ return this.marks.map(item => {
216
+ return this.$pi.date.parseDate(item)
217
+ })
218
+ },
219
+ // 总天数
220
+ days() {
221
+ const days = []
222
+ const dayCount = 7 * 6 // 固定显示6周
223
+ const monthDays = new Date(this.year, this.month, 0).getDate()
224
+ const firstDayCount = this.firstDay.length
225
+ console.log(this.firstDay)
226
+ const nextMonthFirstDay = this.getNextMonthFirstDay
227
+ for (let i = 1; i <= dayCount; i++) {
228
+ let day = {
229
+ key: this.$pi.guid(),
230
+ index: i
231
+ }
232
+
233
+ // 上月数据
234
+ if (i <= firstDayCount) {
235
+ day = {
236
+ ...day,
237
+ ...this.$pi.date.parseDate(this.firstDay[i - 1]),
238
+ type: this.weekView ? '' : 'disabled'
239
+ }
240
+ } else if (i > monthDays + firstDayCount) {
241
+ // 下月数据
242
+ day = {
243
+ ...day,
244
+ ...this.$pi.date.parseDate(
245
+ new Date(nextMonthFirstDay.setDate(i - monthDays - firstDayCount))
246
+ ),
247
+ type: this.weekView ? '' : 'disabled'
248
+ }
249
+ } else {
250
+ // 当月数据
251
+ day = {
252
+ ...day,
253
+ ...this.$pi.date.parseDate(new Date(this.year, this.month - 1, i - firstDayCount))
254
+ }
255
+ const isDisabled = this.isDisabled(day)
256
+ // 禁用
257
+ if (isDisabled) {
258
+ day.disabled = true
259
+ }
260
+ // 单选选中样式
261
+ if (this.type === 'date' && this.isSameDay(this.calendarValue, day)) {
262
+ const activeStyle = {
263
+ color: this.activeColor,
264
+ borderRadius: this.getActiveBorderRadius
265
+ }
266
+ if (this.activeBg) activeStyle.background = this.activeBg
267
+ day.activeStyle = activeStyle
268
+ }
269
+ // 范围选中样式
270
+ if (this.type === 'range') {
271
+ const start = this.calendarValue[0]
272
+ const end = this.calendarValue[1]
273
+ const isBegin = this.isSameDay(start, day)
274
+ const isEnd = this.isSameDay(end, day)
275
+ const inRange =
276
+ start && end && day.timestamp > start.timestamp && day.timestamp < end.timestamp
277
+ const rangeStyle = {}
278
+ // 处理中间范围的样式
279
+ if (inRange) {
280
+ rangeStyle.color = this.rangeColor
281
+ rangeStyle.background = this.rangeBg
282
+ }
283
+ // 处理两端
284
+ if (isBegin || isEnd) {
285
+ rangeStyle.color = this.activeColor
286
+ rangeStyle.borderRadius = isBegin
287
+ ? `${this.getActiveBorderRadius} 0 0 0`
288
+ : `0 0 ${this.getActiveBorderRadius} 0`
289
+ if (this.activeBg) rangeStyle.background = this.activeBg
290
+ }
291
+ day.range = true
292
+ day.rangeStyle = rangeStyle
293
+ // type 为 range 开始和结束的提示
294
+ if (isBegin) day.tip = this.startText
295
+ if (isEnd) day.tip = this.endText
296
+ if (isBegin && isEnd) {
297
+ day.tip = this.startText + '-' + this.endText
298
+ }
299
+ }
300
+ }
301
+ // 是否打点
302
+ if (this.getMarks.length) {
303
+ const mark = this.getMarks.find(item => {
304
+ return this.isSameDay(item, day)
305
+ })
306
+ if (mark) {
307
+ day.marked = mark
308
+ }
309
+ }
310
+ // 当天样式
311
+ if (this.isSameDay(this.now, day)) {
312
+ day.today = true
313
+ if (this.showBackToday) {
314
+ day.nowStyle = {
315
+ color: this.todayActiveBorderColor,
316
+ border: '1px solid ' + this.todayActiveBorderColor,
317
+ borderRadius: this.getActiveBorderRadius
318
+ }
319
+ }
320
+ }
321
+ days.push(day)
322
+ }
323
+ if (this.weekView) {
324
+ days.splice(0, (this.week - 1) * 7)
325
+ days.splice(7, days.length - 7)
326
+ }
327
+ return days
328
+ },
329
+ getBgTip() {
330
+ if (!this.days.length) return ''
331
+ const startDay = this.days[0]
332
+ const endDay = this.days[this.days.length - 1]
333
+ return this.weekView
334
+ ? `${startDay.month}月 ${startDay.date}日 - ${endDay.month}月 ${endDay.date}日`
335
+ : this.month
336
+ }
337
+ },
338
+ methods: {
339
+ isSameDay(day1, day2) {
340
+ return (
341
+ day1 &&
342
+ day2 &&
343
+ day1.year === day2.year &&
344
+ day1.month === day2.month &&
345
+ day1.date === day2.date
346
+ )
347
+ },
348
+ isDisabled(day) {
349
+ const isDisabled =
350
+ (this.getMinDate && day.timestamp < this.getMinDate.timestamp) ||
351
+ (this.getMaxDate && day.timestamp > this.getMaxDate.timestamp)
352
+ return isDisabled
353
+ },
354
+ handleChange(value) {
355
+ this.$emit('change', value)
356
+ },
357
+ handleSelectDate(date) {
358
+ if (date.disabled) return
359
+ if (this.type === 'date') {
360
+ // 单选方式
361
+ this.handleChange(date)
362
+ return
363
+ }
364
+ // 处理范围选择方式
365
+ if (this.calendarValue.length === 0 || this.calendarValue.length === 2) {
366
+ // 如果选了两项,则重新开始选择范围
367
+ this.handleChange([date])
368
+ } else {
369
+ // 和第一项判断大小,小的放前面
370
+ if (date.timestamp > this.calendarValue[0].timestamp) {
371
+ this.handleChange([this.calendarValue[0], date])
372
+ } else {
373
+ this.handleChange([date, this.calendarValue[0]])
374
+ }
375
+ }
376
+ }
377
+ }
378
+ }
379
+ </script>
380
+
381
+ <style lang="scss" scoped>
382
+ .date-item {
383
+ position: relative;
384
+ z-index: 2;
385
+ width: calc(100% / 7);
386
+ overflow: hidden;
387
+ &.marked {
388
+ &::after {
389
+ content: '';
390
+ position: absolute;
391
+ bottom: 18rpx;
392
+ left: 50%;
393
+ width: 8rpx;
394
+ height: 8rpx;
395
+ background: #ff0027;
396
+ border-radius: 50%;
397
+ transform: translateX(-50%);
398
+ overflow: hidden;
399
+ }
400
+ }
401
+ .date-item-inner {
402
+ padding: 8rpx;
403
+ }
404
+ &.range {
405
+ .date-item-inner {
406
+ padding: 6rpx 0rpx;
407
+ }
408
+ }
409
+ }
410
+ </style>