sadais-piui 1.2.7-beta11 → 1.2.7-beta111

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 (69) hide show
  1. package/.prettierrc +8 -0
  2. package/components/pi-badge/index.vue +11 -1
  3. package/components/pi-bottom-bar/index.vue +1 -1
  4. package/components/pi-calendar/index.vue +207 -182
  5. package/components/pi-calendar-input/index.vue +61 -30
  6. package/components/pi-calendar-panel/components/calendar-days/index.vue +91 -52
  7. package/components/pi-calendar-panel/index.vue +28 -12
  8. package/components/pi-canvas/index.vue +8 -1
  9. package/components/pi-cascader/index.vue +601 -0
  10. package/components/pi-checkbox/index.vue +1 -2
  11. package/components/pi-checkbox-group/index.vue +12 -11
  12. package/components/pi-circle-progress/index.vue +108 -21
  13. package/components/pi-code-input/index.vue +11 -3
  14. package/components/pi-collapse/index.vue +124 -0
  15. package/components/pi-collapse-item/index.vue +352 -0
  16. package/components/pi-date-picker/index.vue +504 -391
  17. package/components/pi-date-picker-input/index.vue +61 -30
  18. package/components/pi-dropdown/components/dropdown-tab.vue +33 -23
  19. package/components/pi-dropdown/index.vue +35 -20
  20. package/components/pi-dropdown-item/index.vue +70 -58
  21. package/components/pi-form-item/index.vue +9 -4
  22. package/components/pi-grid/index.vue +1 -1
  23. package/components/pi-grid-item/index.vue +4 -4
  24. package/components/pi-img/index.vue +0 -1
  25. package/components/pi-img-cropper/index.vue +110 -110
  26. package/components/pi-input/index.vue +93 -28
  27. package/components/pi-list-item/index.vue +1 -1
  28. package/components/pi-pagination/index.vue +13 -0
  29. package/components/pi-popup/index.vue +4 -1
  30. package/components/pi-popup-select/index.vue +8 -1
  31. package/components/pi-radio/index.vue +5 -8
  32. package/components/pi-radio-group/index.vue +25 -5
  33. package/components/pi-regions-select/index.vue +6 -1
  34. package/components/pi-regions-select-input/index.vue +69 -31
  35. package/components/pi-search/index.vue +29 -2
  36. package/components/pi-section/index.vue +1 -1
  37. package/components/pi-select/index.vue +237 -22
  38. package/components/pi-select-input/index.vue +106 -41
  39. package/components/pi-stepper/index.vue +135 -121
  40. package/components/pi-steps/index.vue +115 -36
  41. package/components/pi-switch/index.vue +5 -1
  42. package/components/pi-table/index.vue +351 -0
  43. package/components/pi-tabs/index.vue +46 -10
  44. package/components/pi-tag/index.vue +488 -0
  45. package/components/pi-upload-img/index.vue +507 -37
  46. package/components/pi-webview/index.vue +92 -82
  47. package/config/actionSheet.js +0 -1
  48. package/config/calendarInput.js +2 -1
  49. package/config/calendarPanel.js +2 -1
  50. package/config/cascader.js +22 -0
  51. package/config/circleProgress.js +17 -10
  52. package/config/codeInput.js +2 -1
  53. package/config/collapse.js +7 -0
  54. package/config/collapseItem.js +11 -0
  55. package/config/datePicker.js +29 -24
  56. package/config/datePickerInput.js +2 -1
  57. package/config/dropdown.js +3 -1
  58. package/config/input.js +4 -2
  59. package/config/regionsSelectInput.js +2 -1
  60. package/config/select.js +13 -1
  61. package/config/selectInput.js +2 -1
  62. package/config/steps.js +1 -1
  63. package/config/table.js +9 -0
  64. package/config/tag.js +21 -0
  65. package/config/uploadImg.js +28 -10
  66. package/package.json +5 -2
  67. package/scss/common.scss +11 -13
  68. package/scss/icon/icon.scss +2 -1
  69. package/scss/mixin.scss +1 -1
package/.prettierrc ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "trailingComma": "none",
3
+ "arrowParens": "avoid",
4
+ "bracketSpacing": true,
5
+ "quoteProps": "consistent",
6
+ "semi": false,
7
+ "singleQuote": true
8
+ }
@@ -2,7 +2,13 @@
2
2
  <view class="badge-wrap" :style="[customStyle]" :class="[customClass]" @tap="handleClick">
3
3
  <view
4
4
  class="badge"
5
- :class="[{ dot, abso: $slots.default || $slots.$default }]"
5
+ :class="[
6
+ {
7
+ dot,
8
+ 'abso': $slots.default || $slots.$default,
9
+ 'hide-border': !dot && !getContent && !($slots.content || $slots.$content)
10
+ }
11
+ ]"
6
12
  :style="[badgeStyle]"
7
13
  >
8
14
  <slot name="content">
@@ -119,6 +125,10 @@ export default {
119
125
  border: 1px solid #ffffff;
120
126
  border-radius: 16px;
121
127
 
128
+ &.hide-border {
129
+ border: none;
130
+ }
131
+
122
132
  &.dot {
123
133
  min-width: 0;
124
134
  background-color: #ee0a24;
@@ -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>
@@ -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>
@@ -1,48 +1,49 @@
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: 2023-09-02 11:40:12
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: \piui-awesome\src\piui\components\pi-calendar-input\index.vue
8
8
  -->
9
9
 
10
10
  <template>
11
11
  <view class="pi-calendar-input">
12
12
  <!-- 输入框 -->
13
- <view v-if="$slots.default || $slots.$default" class="pi-w-100P" @click="show = true">
13
+ <view v-if="$slots.default || $slots.$default" class="pi-w-100P" @click="handleShow()">
14
14
  <slot />
15
15
  </view>
16
16
  <pi-input
17
17
  v-else
18
18
  type="text"
19
19
  :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"
20
+ :custom-class="getInput.customClass"
21
+ :custom-style="getInput.customStyle"
22
+ :placeholder="getInput.placeholder"
23
+ :placeholder-style="getInput.placeholderStyle"
24
+ :placeholder-class="getInput.placeholderClass"
25
+ :disabled="getInput.disabled"
26
+ :border="getInput.border"
27
+ :maxlength="getInput.maxlength"
28
+ :password="getInput.password"
29
+ :cursor-spacing="getInput.cursorSpacing"
30
+ :focus="getInput.focus"
31
+ :confirm-type="getInput.confirmType"
32
+ :confirm-hold="getInput.confirmHold"
33
+ :cursor="getInput.cursor"
34
+ :selection-start="getInput.selectionStart"
35
+ :selection-end="getInput.selectionEnd"
36
+ :adjust-position="getInput.adjustPosition"
37
+ :hold-keyboard="getInput.holdKeyboard"
38
+ :auto-blur="getInput.autoBlur"
39
+ :show-confirmbar="getInput.showConfirmbar"
40
+ :auto-height="getInput.autoHeight"
41
+ :fixed="getInput.fixed"
42
+ :disable-default-padding="getInput.disableDefaultPadding"
43
+ :clearable="getInput.clearable"
44
+ :clear-icon="getInput.clearIcon"
45
+ @click="handleShow()"
46
+ @clear="handleClearValue"
46
47
  />
47
48
 
48
49
  <!-- 日历弹出框 -->
@@ -61,6 +62,10 @@
61
62
  }"
62
63
  :popup="getCalendar.popup"
63
64
  @confirm="handleCalendarConfirm"
65
+ @close="$emit('close', $event)"
66
+ @closed="$emit('closed', $event)"
67
+ @show="$emit('show', $event)"
68
+ @showed="$emit('showed', $event)"
64
69
  />
65
70
  </view>
66
71
  </template>
@@ -136,6 +141,10 @@ export default {
136
141
  fn: calendarInput.parseValueFn
137
142
  }
138
143
  }
144
+ },
145
+ disabled: {
146
+ type: Boolean,
147
+ default: calendarInput.disabled
139
148
  }
140
149
  },
141
150
  data() {
@@ -144,6 +153,9 @@ export default {
144
153
  }
145
154
  },
146
155
  computed: {
156
+ getInput() {
157
+ return this.$pi.lang.mergeDeep(calendarInput.input, this.input)
158
+ },
147
159
  getCalendar() {
148
160
  return this.$pi.lang.mergeDeep(calendarInput.calendar, this.calendar)
149
161
  },
@@ -175,9 +187,20 @@ export default {
175
187
  .join(this.rangeSplit)
176
188
  }
177
189
  return ''
178
- }
190
+ },
191
+ getDisabled() {
192
+ const parentFormItem = this.$pi.parent(this, 'PiFormItem')
193
+ const disabled = this.disabled || (parentFormItem && parentFormItem.getDisabled)
194
+ return disabled
195
+ },
179
196
  },
180
197
  methods: {
198
+ handleShow() {
199
+ if (this.getDisabled) {
200
+ return
201
+ }
202
+ this.show = true
203
+ },
181
204
  handlePopupClose() {
182
205
  this.val = false
183
206
  // 关闭
@@ -187,6 +210,14 @@ export default {
187
210
  handleCalendarConfirm(value) {
188
211
  this.val = value
189
212
  this.handleEmitChange()
213
+ },
214
+ handleClearValue() {
215
+ if (this.calendar.calendarPanel.type === 'date') {
216
+ this.handleCalendarConfirm('')
217
+ }
218
+ if (this.calendar.calendarPanel.type === 'range') {
219
+ this.handleCalendarConfirm([])
220
+ }
190
221
  }
191
222
  }
192
223
  }