sadais-piui 1.2.7-beta18 → 1.2.7-beta180

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 (104) hide show
  1. package/.prettierrc +8 -0
  2. package/CHANGELOG.md +7 -1
  3. package/components/pi-action-sheet/index.vue +262 -247
  4. package/components/pi-badge/index.vue +66 -8
  5. package/components/pi-bottom-bar/index.vue +15 -4
  6. package/components/pi-bubble/index.vue +14 -3
  7. package/components/pi-button/index.vue +17 -4
  8. package/components/pi-calendar/index.vue +207 -182
  9. package/components/pi-calendar-input/index.vue +72 -31
  10. package/components/pi-calendar-panel/components/calendar-days/index.vue +134 -54
  11. package/components/pi-calendar-panel/index.vue +52 -19
  12. package/components/pi-canvas/index.vue +18 -2
  13. package/components/pi-card/index.vue +5 -1
  14. package/components/pi-cascader/index.vue +635 -0
  15. package/components/pi-checkbox/index.vue +8 -4
  16. package/components/pi-checkbox-group/index.vue +12 -11
  17. package/components/pi-circle-progress/index.vue +75 -19
  18. package/components/pi-code-input/index.vue +11 -2
  19. package/components/pi-collapse/index.vue +18 -7
  20. package/components/pi-collapse-item/index.vue +35 -22
  21. package/components/pi-count-up/index.vue +8 -2
  22. package/components/pi-date-picker/index.vue +678 -391
  23. package/components/pi-date-picker-input/index.vue +74 -31
  24. package/components/pi-divider/index.vue +5 -1
  25. package/components/pi-dropdown/components/dropdown-tab.vue +38 -23
  26. package/components/pi-dropdown/index.vue +50 -23
  27. package/components/pi-dropdown-item/index.vue +82 -62
  28. package/components/pi-form/index.vue +9 -3
  29. package/components/pi-form-item/index.vue +105 -21
  30. package/components/pi-grid/index.vue +6 -2
  31. package/components/pi-grid-item/index.vue +17 -8
  32. package/components/pi-icon/index.vue +6 -1
  33. package/components/pi-img/index.vue +275 -267
  34. package/components/pi-img-cropper/canvas.js +10 -3
  35. package/components/pi-img-cropper/index.vue +6 -3
  36. package/components/pi-img-cropper/touch.js +4 -1
  37. package/components/pi-img-cropper/vector.js +2 -2
  38. package/components/pi-input/index.vue +97 -36
  39. package/components/pi-line-progress/index.vue +9 -2
  40. package/components/pi-list/index.vue +5 -1
  41. package/components/pi-list-item/index.vue +9 -4
  42. package/components/pi-loading/index.vue +10 -2
  43. package/components/pi-marquee/index.vue +322 -310
  44. package/components/pi-marquee-pure-css/index.vue +267 -0
  45. package/components/pi-mask/index.vue +3 -1
  46. package/components/pi-modal/index.vue +311 -303
  47. package/components/pi-navbar/index.vue +22 -5
  48. package/components/pi-notify/index.vue +9 -3
  49. package/components/pi-number-keyboard/index.vue +15 -3
  50. package/components/pi-opentype-button/index.vue +11 -3
  51. package/components/pi-pagination/index.vue +18 -1
  52. package/components/pi-picker/index.vue +332 -317
  53. package/components/pi-popup/index.vue +12 -5
  54. package/components/pi-popup-select/index.vue +13 -4
  55. package/components/pi-radio/index.vue +12 -11
  56. package/components/pi-radio-group/index.vue +28 -6
  57. package/components/pi-rate/index.vue +9 -2
  58. package/components/pi-regions-select/index.vue +50 -12
  59. package/components/pi-regions-select-input/index.vue +69 -31
  60. package/components/pi-search/index.vue +37 -2
  61. package/components/pi-section/index.vue +6 -2
  62. package/components/pi-select/index.vue +237 -22
  63. package/components/pi-select-input/index.vue +106 -41
  64. package/components/pi-skeleton/index.vue +2 -1
  65. package/components/pi-status-bar/index.vue +4 -1
  66. package/components/pi-stepper/index.vue +34 -20
  67. package/components/pi-steps/index.vue +56 -13
  68. package/components/pi-subsection/index.vue +10 -5
  69. package/components/pi-swiper/index.vue +21 -7
  70. package/components/pi-switch/index.vue +19 -6
  71. package/components/pi-table/index.vue +351 -0
  72. package/components/pi-tabs/index.vue +87 -20
  73. package/components/pi-tag/index.vue +17 -5
  74. package/components/pi-upload-img/index.vue +900 -44
  75. package/components/pi-waterfall/index.vue +14 -5
  76. package/components/pi-webview/index.vue +95 -82
  77. package/config/actionSheet.js +1 -2
  78. package/config/badge.js +2 -1
  79. package/config/calendarInput.js +2 -1
  80. package/config/calendarPanel.js +2 -1
  81. package/config/cascader.js +22 -0
  82. package/config/circleProgress.js +32 -4
  83. package/config/codeInput.js +2 -1
  84. package/config/datePicker.js +31 -24
  85. package/config/datePickerInput.js +2 -1
  86. package/config/dropdown.js +3 -1
  87. package/config/formItem.js +2 -1
  88. package/config/input.js +5 -3
  89. package/config/marqueePureCss.js +18 -0
  90. package/config/regionsSelectInput.js +2 -1
  91. package/config/select.js +13 -1
  92. package/config/selectInput.js +2 -1
  93. package/config/table.js +9 -0
  94. package/config/uploadImg.js +57 -12
  95. package/context7.json +4 -0
  96. package/index.js +15 -2
  97. package/mixin/emitter.js +8 -1
  98. package/mixin/page-transitions/index.js +7 -2
  99. package/mixin/value-sync.js +5 -0
  100. package/package.json +5 -2
  101. package/scss/common.scss +18 -21
  102. package/scss/icon/icon.scss +2 -1
  103. package/scss/mixin.scss +5 -5
  104. package/utils/file-utils.js +273 -0
@@ -13,12 +13,19 @@
13
13
  >
14
14
  <slot />
15
15
  </view>
16
- <view v-if="safeArea" class="pi-safearea" :style="[{ backgroundColor: safeAreaBgColor }]" />
16
+ <view
17
+ v-if="safeArea"
18
+ class="pi-safearea"
19
+ :style="[{ backgroundColor: safeAreaBgColor }]"
20
+ />
17
21
  </view>
18
22
  <!-- fixed时候的占位空间 -->
19
23
  <template v-if="fixed">
20
- <view class="pi-bottom-bar-placeholder" :style="[{ height: barHeight }]" />
21
- <view v-if="safeArea" class="pi-safearea" />
24
+ <view
25
+ class="pi-bottom-bar-placeholder"
26
+ :style="[{ height: barHeight }]"
27
+ />
28
+ <!-- <view v-if="safeArea" class="pi-safearea" /> -->
22
29
  </template>
23
30
  </view>
24
31
  </template>
@@ -114,7 +121,11 @@ export default {
114
121
  methods: {
115
122
  async init() {
116
123
  if (!this.fixed || this.height) return // fixed并且未设定height,才需要计算高度
117
- const barRect = await this.$pi.common.queryRect(this, '.pi-bottom-bar', false)
124
+ const barRect = await this.$pi.common.queryRect(
125
+ this,
126
+ '.pi-bottom-bar',
127
+ false
128
+ )
118
129
  this.barHeight = `${barRect.height}px`
119
130
  }
120
131
  }
@@ -16,7 +16,11 @@
16
16
  <view class="pi-bubble-angle pi-abso" />
17
17
  </view>
18
18
  </view>
19
- <pi-mask v-model="showMaks" background="transparent" @close="showBubble = false" />
19
+ <pi-mask
20
+ v-model="showMaks"
21
+ background="transparent"
22
+ @close="showBubble = false"
23
+ />
20
24
  </view>
21
25
  </template>
22
26
 
@@ -109,7 +113,11 @@ export default {
109
113
  this.$set(this, 'bublePosition', { top: '-9999vh', left: 0 })
110
114
  this.showBubble = true
111
115
  setTimeout(() => {
112
- reslove(this.$refs.bubble ? this.$refs.bubble.$el.getBoundingClientRect().width : 0)
116
+ reslove(
117
+ this.$refs.bubble
118
+ ? this.$refs.bubble.$el.getBoundingClientRect().width
119
+ : 0
120
+ )
113
121
  this.showBubble = false
114
122
  }, 500)
115
123
  })
@@ -120,7 +128,10 @@ export default {
120
128
  const lengthGap = (this.bubleWidth - bublePosition.width) / 2
121
129
  const compRight = this.screenWidth - bublePosition.x - bublePosition.width
122
130
  const posRes = {}
123
- if (lengthGap <= 0 || (lengthGap < bublePosition.x && lengthGap < compRight)) {
131
+ if (
132
+ lengthGap <= 0 ||
133
+ (lengthGap < bublePosition.x && lengthGap < compRight)
134
+ ) {
124
135
  posRes.left = -Math.abs(lengthGap) + 'px'
125
136
  } else {
126
137
  posRes.right = 4 - Math.min(bublePosition.x, compRight) + 'px'
@@ -31,7 +31,11 @@
31
31
  <!-- 按钮内容 -->
32
32
  <slot />
33
33
  <view v-if="ripple" class="pi-abso-full pi-of-hidden" :class="[{ round }]">
34
- <view class="wave-ripple" :class="[{ active: waveInfo.active }]" :style="[waveStyle]" />
34
+ <view
35
+ class="wave-ripple"
36
+ :class="[{ active: waveInfo.active }]"
37
+ :style="[waveStyle]"
38
+ />
35
39
  </view>
36
40
  </button>
37
41
  </template>
@@ -57,7 +61,9 @@ export default {
57
61
  // 'default'
58
62
  default: button.size,
59
63
  validator: function(value) {
60
- return ['default', 'large', 'medium', 'small', 'tiny', 'mini'].includes(value)
64
+ return ['default', 'large', 'medium', 'small', 'tiny', 'mini'].includes(
65
+ value
66
+ )
61
67
  }
62
68
  },
63
69
  // 按钮的预置样式
@@ -67,7 +73,14 @@ export default {
67
73
  // 'default'
68
74
  default: button.type,
69
75
  validator: function(value) {
70
- return ['default', 'primary', 'warn', 'secondary', 'line', 'text'].includes(value)
76
+ return [
77
+ 'default',
78
+ 'primary',
79
+ 'warn',
80
+ 'secondary',
81
+ 'line',
82
+ 'text'
83
+ ].includes(value)
71
84
  }
72
85
  },
73
86
  // 按钮是否镂空
@@ -280,7 +293,7 @@ export default {
280
293
  // 查询返回的是一个数组节点
281
294
  let data = res[0]
282
295
  // 查询不到节点信息,不操作
283
- if (!data.width || !data.width) return
296
+ if (!data || !data.width) return
284
297
  // 水波纹的最终形态是一个正方形(通过border-radius让其变为一个圆形),这里要保证正方形的边长等于按钮的最长边
285
298
  // 最终的方形(变换后的圆形)才能覆盖整个按钮
286
299
  data.targetWidth = data.height > data.width ? data.height : data.width
@@ -1,182 +1,207 @@
1
- <template>
2
- <pi-popup
3
- ref="popup"
4
- :value="val"
5
- :custom-class="getPopup.customClass"
6
- :custom-style="getPopup.customStyle"
7
- :position="getPopup.position"
8
- :border-radius="getPopup.borderRadius"
9
- :show-close-icon="showTitle && getPopup.showCloseIcon"
10
- :close-icon="getPopup.closeIcon"
11
- :safe-area-inset-bottom="getPopup.safeAreaInsetBottom"
12
- :mask="getPopup.mask"
13
- :hide-tab-bar="getPopup.hideTabBar"
14
- :append-to-body="getPopup.appendToBody"
15
- :z-index="getPopup.zIndex"
16
- :background="getPopup.background"
17
- @close="handlePopupClose"
18
- >
19
- <view class="pi-calendar" :style="[customStyle]" :class="[customClass]">
20
- <!-- 标题栏 -->
21
- <view class="pi-justify-center pi-fz-32 pi-fw-500" :style="[{ padding: getTitlePadding }]">
22
- <slot v-if="$slots.title" name="title" />
23
- <template v-else>{{ title }}</template>
24
- </view>
25
- <pi-calendar-panel
26
- v-model="calendarValue"
27
- :type="getCalendarPanel.type"
28
- :min-year="getCalendarPanel.minYear"
29
- :max-year="getCalendarPanel.maxYear"
30
- :min-date="getCalendarPanel.minDate"
31
- :max-date="getCalendarPanel.maxDate"
32
- :show-back-today="getCalendarPanel.showBackToday"
33
- :today-active-border-color="getCalendarPanel.todayActiveBorderColor"
34
- :active-color="getCalendarPanel.activeColor"
35
- :active-bg="getCalendarPanel.activeBg"
36
- :active-border-radius="getCalendarPanel.activeBorderRadius"
37
- :range-color="getCalendarPanel.rangeColor"
38
- :range-bg="getCalendarPanel.rangeBg"
39
- :start-text="getCalendarPanel.startText"
40
- :end-text="getCalendarPanel.endText"
41
- :date-format="getCalendarPanel.dateFormat"
42
- />
43
- <!-- footer -->
44
- <view class="pi-w-100P pi-align-center pi-pd-24 pi-solid-top-1">
45
- <view class="pi-flex-sub pi-fz-30 pi-fw-500">{{ getDisplayValue }}</view>
46
- <pi-button type="primary" size="medium" @click="handleConfirm">确定</pi-button>
47
- </view>
48
- </view>
49
- </pi-popup>
50
- </template>
51
-
52
- <script>
53
- import ValueSync from '../../mixin/value-sync'
54
- import { getConfig } from '../../config'
55
-
56
- const TAG = 'PiCalendar'
57
- const { calendar } = getConfig()
58
-
59
- export default {
60
- name: 'PiCalendar',
61
- // 混入v-model
62
- mixins: [ValueSync],
63
- props: {
64
- // 初始值
65
- value: {
66
- required: false
67
- },
68
- // 自定义样式,对象形式
69
- customStyle: {
70
- type: Object,
71
- // {}
72
- default() {
73
- return calendar.customStyle
74
- }
75
- },
76
- // 自定义样式类,字符串形式
77
- customClass: {
78
- type: String,
79
- // ''
80
- default() {
81
- return calendar.customClass
82
- }
83
- },
84
- // 是否显示title
85
- showTitle: {
86
- type: Boolean,
87
- // true
88
- default: calendar.showTitle
89
- },
90
- // 标题
91
- title: {
92
- type: String,
93
- // '日期选择'
94
- default: calendar.title
95
- },
96
- // 标题 padding
97
- titlePadding: {
98
- type: [String, Number],
99
- // 24
100
- default: calendar.titlePadding
101
- },
102
- // 日历面板参数设置
103
- calendarPanel: {
104
- type: Object,
105
- default() {
106
- // 参照calendarPanel
107
- return calendar.calendarPanel
108
- }
109
- },
110
- // 弹窗参数设置
111
- popup: {
112
- type: Object,
113
- default() {
114
- // 参照popup
115
- return calendar.popup
116
- }
117
- }
118
- },
119
- data() {
120
- const mergeCalendarPanel = this.$pi.lang.mergeDeep(calendar.calendarPanel, this.calendarPanel)
121
- return {
122
- calendarValue: mergeCalendarPanel.value
123
- }
124
- },
125
- computed: {
126
- getCalendarPanel() {
127
- return this.$pi.lang.mergeDeep(calendar.calendarPanel, this.calendarPanel)
128
- },
129
- getPopup() {
130
- return this.$pi.lang.mergeDeep(calendar.popup, this.popup)
131
- },
132
- getTitlePadding() {
133
- return this.$pi.common.addUnit(this.titlePadding)
134
- },
135
- getDisplayValue() {
136
- return [].concat(this.calendarValue).join(' - ')
137
- }
138
- },
139
- watch: {
140
- 'getCalendarPanel.value'(val) {
141
- this.calendarValue = val
142
- }
143
- },
144
- methods: {
145
- handlePopupClose() {
146
- this.val = false
147
- // 关闭
148
- this.$emit('close')
149
- this.handleEmitChange()
150
- },
151
- /**
152
- * @vuese
153
- * 确认选择
154
- */
155
- handleConfirm() {
156
- this.$emit('confirm', this.calendarValue)
157
- this.handlePopupClose()
158
- }
159
- }
160
- }
161
- </script>
162
-
163
- <style lang="scss" scoped>
164
- .pi-calendar {
165
- max-width: 960rpx;
166
- margin: 0 auto;
167
- }
168
- .date-item {
169
- position: relative;
170
- z-index: 2;
171
- width: calc(100% / 7);
172
- overflow: hidden;
173
- }
174
- .back-today {
175
- padding: 12rpx 24rpx;
176
- overflow: hidden;
177
- font-size: 20rpx;
178
- color: #ffffff;
179
- background: $pi-primary-color;
180
- border-radius: 50rpx 0 0 50rpx;
181
- }
182
- </style>
1
+ <template>
2
+ <pi-popup
3
+ ref="popup"
4
+ :value="val"
5
+ :custom-class="getPopup.customClass"
6
+ :custom-style="getPopup.customStyle"
7
+ :position="getPopup.position"
8
+ :border-radius="getPopup.borderRadius"
9
+ :show-close-icon="showTitle && getPopup.showCloseIcon"
10
+ :close-icon="getPopup.closeIcon"
11
+ :safe-area-inset-bottom="getPopup.safeAreaInsetBottom"
12
+ :mask="getPopup.mask"
13
+ :hide-tab-bar="getPopup.hideTabBar"
14
+ :append-to-body="getPopup.appendToBody"
15
+ :z-index="getPopup.zIndex"
16
+ :background="getPopup.background"
17
+ @close="handlePopupClose"
18
+ @closed="$emit('closed', $event)"
19
+ @show="$emit('show', $event)"
20
+ @showed="$emit('showed', $event)"
21
+ >
22
+ <view class="pi-calendar" :style="[customStyle]" :class="[customClass]">
23
+ <!-- 标题栏 -->
24
+ <view
25
+ class="pi-justify-center pi-fz-32 pi-fw-500"
26
+ :style="[{ padding: getTitlePadding }]"
27
+ >
28
+ <slot v-if="$slots.title" name="title" />
29
+ <template v-else>{{ title }}</template>
30
+ </view>
31
+ <pi-calendar-panel
32
+ v-model="calendarValue"
33
+ :type="getCalendarPanel.type"
34
+ :min-year="getCalendarPanel.minYear"
35
+ :max-year="getCalendarPanel.maxYear"
36
+ :min-date="getCalendarPanel.minDate"
37
+ :max-date="getCalendarPanel.maxDate"
38
+ :show-back-today="getCalendarPanel.showBackToday"
39
+ :today-active-border-color="getCalendarPanel.todayActiveBorderColor"
40
+ :active-color="getCalendarPanel.activeColor"
41
+ :active-bg="getCalendarPanel.activeBg"
42
+ :active-border-radius="getCalendarPanel.activeBorderRadius"
43
+ :range-color="getCalendarPanel.rangeColor"
44
+ :range-bg="getCalendarPanel.rangeBg"
45
+ :start-text="getCalendarPanel.startText"
46
+ :end-text="getCalendarPanel.endText"
47
+ :marks="getCalendarPanel.marks"
48
+ :date-format="getCalendarPanel.dateFormat"
49
+ @date-change="$emit('date-change', $event)"
50
+ />
51
+ <!-- footer -->
52
+ <view class="pi-w-100P pi-align-center pi-pd-24 pi-solid-top-1">
53
+ <view class="pi-flex-sub pi-fz-30 pi-fw-500">{{
54
+ getDisplayValue
55
+ }}</view>
56
+ <pi-button
57
+ type="primary"
58
+ size="medium"
59
+ :disabled="confirmDisabled"
60
+ @click="handleConfirm"
61
+ >确定</pi-button
62
+ >
63
+ </view>
64
+ </view>
65
+ </pi-popup>
66
+ </template>
67
+
68
+ <script>
69
+ import ValueSync from '../../mixin/value-sync'
70
+ import { getConfig } from '../../config'
71
+
72
+ const TAG = 'PiCalendar'
73
+ const { calendar } = getConfig()
74
+
75
+ export default {
76
+ name: 'PiCalendar',
77
+ // 混入v-model
78
+ mixins: [ValueSync],
79
+ props: {
80
+ // 初始值
81
+ value: {
82
+ required: false
83
+ },
84
+ // 自定义样式,对象形式
85
+ customStyle: {
86
+ type: Object,
87
+ // {}
88
+ default() {
89
+ return calendar.customStyle
90
+ }
91
+ },
92
+ // 自定义样式类,字符串形式
93
+ customClass: {
94
+ type: String,
95
+ // ''
96
+ default() {
97
+ return calendar.customClass
98
+ }
99
+ },
100
+ // 是否显示title
101
+ showTitle: {
102
+ type: Boolean,
103
+ // true
104
+ default: calendar.showTitle
105
+ },
106
+ // 标题
107
+ title: {
108
+ type: String,
109
+ // '日期选择'
110
+ default: calendar.title
111
+ },
112
+ // 标题 padding
113
+ titlePadding: {
114
+ type: [String, Number],
115
+ // 24
116
+ default: calendar.titlePadding
117
+ },
118
+ // 日历面板参数设置
119
+ calendarPanel: {
120
+ type: Object,
121
+ default() {
122
+ // 参照calendarPanel
123
+ return calendar.calendarPanel
124
+ }
125
+ },
126
+ // 弹窗参数设置
127
+ popup: {
128
+ type: Object,
129
+ default() {
130
+ // 参照popup
131
+ return calendar.popup
132
+ }
133
+ }
134
+ },
135
+ data() {
136
+ const mergeCalendarPanel = this.$pi.lang.mergeDeep(
137
+ calendar.calendarPanel,
138
+ this.calendarPanel
139
+ )
140
+ return {
141
+ calendarValue: mergeCalendarPanel.value
142
+ }
143
+ },
144
+ computed: {
145
+ getCalendarPanel() {
146
+ return this.$pi.lang.mergeDeep(calendar.calendarPanel, this.calendarPanel)
147
+ },
148
+ getPopup() {
149
+ return this.$pi.lang.mergeDeep(calendar.popup, this.popup)
150
+ },
151
+ getTitlePadding() {
152
+ return this.$pi.common.addUnit(this.titlePadding)
153
+ },
154
+ getDisplayValue() {
155
+ return [].concat(this.calendarValue).join(' - ')
156
+ },
157
+ confirmDisabled() {
158
+ if (this.getCalendarPanel.type === 'range') {
159
+ return this.calendarValue.length !== 2
160
+ }
161
+ return !this.calendarValue
162
+ }
163
+ },
164
+ watch: {
165
+ 'getCalendarPanel.value'(val) {
166
+ this.calendarValue = val
167
+ }
168
+ },
169
+ methods: {
170
+ handlePopupClose() {
171
+ this.val = false
172
+ // 关闭
173
+ this.$emit('close')
174
+ this.handleEmitChange()
175
+ },
176
+ /**
177
+ * @vuese
178
+ * 确认选择
179
+ */
180
+ handleConfirm() {
181
+ this.$emit('confirm', this.calendarValue)
182
+ this.handlePopupClose()
183
+ }
184
+ }
185
+ }
186
+ </script>
187
+
188
+ <style lang="scss" scoped>
189
+ .pi-calendar {
190
+ max-width: 960rpx;
191
+ margin: 0 auto;
192
+ }
193
+ .date-item {
194
+ position: relative;
195
+ z-index: 2;
196
+ width: calc(100% / 7);
197
+ overflow: hidden;
198
+ }
199
+ .back-today {
200
+ padding: 12rpx 24rpx;
201
+ overflow: hidden;
202
+ font-size: 20rpx;
203
+ color: #ffffff;
204
+ background: $pi-primary-color;
205
+ border-radius: 50rpx 0 0 50rpx;
206
+ }
207
+ </style>