sadais-piui 1.2.7-beta15 → 1.2.7-beta151

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 (75) hide show
  1. package/.prettierrc +8 -0
  2. package/components/pi-action-sheet/index.vue +260 -247
  3. package/components/pi-badge/index.vue +11 -1
  4. package/components/pi-bottom-bar/index.vue +1 -1
  5. package/components/pi-calendar/index.vue +207 -182
  6. package/components/pi-calendar-input/index.vue +61 -30
  7. package/components/pi-calendar-panel/components/calendar-days/index.vue +91 -52
  8. package/components/pi-calendar-panel/index.vue +28 -12
  9. package/components/pi-canvas/index.vue +8 -1
  10. package/components/pi-cascader/index.vue +601 -0
  11. package/components/pi-checkbox/index.vue +8 -4
  12. package/components/pi-checkbox-group/index.vue +12 -11
  13. package/components/pi-circle-progress/index.vue +53 -16
  14. package/components/pi-code-input/index.vue +11 -3
  15. package/components/pi-collapse/index.vue +16 -6
  16. package/components/pi-collapse-item/index.vue +35 -22
  17. package/components/pi-date-picker/index.vue +512 -391
  18. package/components/pi-date-picker-input/index.vue +61 -30
  19. package/components/pi-dropdown/components/dropdown-tab.vue +33 -23
  20. package/components/pi-dropdown/index.vue +34 -19
  21. package/components/pi-dropdown-item/index.vue +70 -58
  22. package/components/pi-form-item/index.vue +98 -20
  23. package/components/pi-grid/index.vue +1 -1
  24. package/components/pi-grid-item/index.vue +4 -4
  25. package/components/pi-img/index.vue +275 -267
  26. package/components/pi-img-cropper/index.vue +6 -3
  27. package/components/pi-input/index.vue +97 -36
  28. package/components/pi-list-item/index.vue +1 -1
  29. package/components/pi-marquee/index.vue +322 -310
  30. package/components/pi-marquee-pure-css/index.vue +267 -0
  31. package/components/pi-mask/index.vue +3 -1
  32. package/components/pi-modal/index.vue +311 -303
  33. package/components/pi-pagination/index.vue +13 -0
  34. package/components/pi-picker/index.vue +332 -317
  35. package/components/pi-popup/index.vue +4 -1
  36. package/components/pi-popup-select/index.vue +13 -4
  37. package/components/pi-radio/index.vue +12 -11
  38. package/components/pi-radio-group/index.vue +25 -5
  39. package/components/pi-regions-select/index.vue +6 -1
  40. package/components/pi-regions-select-input/index.vue +69 -31
  41. package/components/pi-search/index.vue +37 -2
  42. package/components/pi-section/index.vue +1 -1
  43. package/components/pi-select/index.vue +237 -22
  44. package/components/pi-select-input/index.vue +106 -41
  45. package/components/pi-stepper/index.vue +135 -121
  46. package/components/pi-steps/index.vue +115 -36
  47. package/components/pi-swiper/index.vue +22 -7
  48. package/components/pi-switch/index.vue +5 -1
  49. package/components/pi-table/index.vue +351 -0
  50. package/components/pi-tabs/index.vue +46 -10
  51. package/components/pi-upload-img/index.vue +895 -44
  52. package/components/pi-webview/index.vue +95 -82
  53. package/config/actionSheet.js +0 -1
  54. package/config/calendarInput.js +2 -1
  55. package/config/calendarPanel.js +2 -1
  56. package/config/cascader.js +22 -0
  57. package/config/circleProgress.js +12 -4
  58. package/config/codeInput.js +2 -1
  59. package/config/datePicker.js +29 -24
  60. package/config/datePickerInput.js +2 -1
  61. package/config/dropdown.js +3 -1
  62. package/config/input.js +5 -3
  63. package/config/marqueePureCss.js +18 -0
  64. package/config/regionsSelectInput.js +2 -1
  65. package/config/select.js +13 -1
  66. package/config/selectInput.js +2 -1
  67. package/config/steps.js +1 -1
  68. package/config/table.js +9 -0
  69. package/config/uploadImg.js +33 -11
  70. package/mixin/emitter.js +8 -1
  71. package/mixin/value-sync.js +5 -0
  72. package/package.json +5 -2
  73. package/scss/common.scss +11 -14
  74. package/scss/icon/icon.scss +2 -1
  75. package/scss/mixin.scss +5 -5
@@ -1,82 +1,95 @@
1
- <template>
2
- <view class="pi-scroll-container">
3
- <!-- #ifndef MP -->
4
- <slot name="title">
5
- <pi-navbar :show-home="false">{{ title }}</pi-navbar>
6
- </slot>
7
- <!-- #endif -->
8
- <!-- #ifndef APP-PLUS -->
9
- <web-view v-if="webviewURL" :progress="true" :src="webviewURL" class="pi-scroll pi-safearea" />
10
- <!-- #endif -->
11
- </view>
12
- </template>
13
-
14
- <script>
15
- const TAG = 'PiWebview'
16
- export default {
17
- name: 'PiWebview',
18
- props: {
19
- title: {
20
- type: String
21
- },
22
- url: {
23
- type: String
24
- }
25
- },
26
- data() {
27
- return {
28
- webviewURL: ''
29
- }
30
- },
31
- watch: {
32
- url: {
33
- deep: true,
34
- immediate: true,
35
- handler(value) {
36
- value && this.init()
37
- }
38
- }
39
- },
40
- methods: {
41
- init() {
42
- // 设置标题
43
- if (this.title) {
44
- uni.setNavigationBarTitle({
45
- title: this.title
46
- })
47
- }
48
- if (!this.url) return
49
- // H5 url 需要加时间戳,否则会有缓存问题
50
- this.webviewURL = this.urlAddParam(this.url || '', {
51
- sadaisTimestamp: new Date().getTime() + '-' + Math.round(Math.random(1) * 10000)
52
- })
53
- console.log('webview页面即将打开以下URL:', this.webviewURL)
54
- // #ifdef APP-PLUS
55
- const wv = plus.webview.create('', 'custom-webview', {
56
- 'plusrequire': 'none', // 禁止远程网页使用plus的API,有些使用mui制作的网页可能会监听plus.key,造成关闭页面混乱,可以通过这种方式禁止
57
- 'uni-app': 'none', // 不加载uni-app渲染层框架,避免样式冲突
58
- 'top': uni.getSystemInfoSync().statusBarHeight + 44 // 放置在titleNView下方。如果还想在webview上方加个地址栏的什么的,可以继续降低TOP值
59
- })
60
- wv.loadURL(this.webviewURL)
61
- const currentWebview = this.$mp.page.$getAppWebview() // 获取当前页面的webview对象
62
- currentWebview.append(wv) // 一定要append到当前的页面里,才能跟随当前页面一起做动画,一起关闭
63
- // #endif
64
- },
65
- urlAddParam(url, params) {
66
- params = this.$pi.navi.objToUrl(params)
67
- if (url.indexOf('?') !== -1 && params) {
68
- url = url + params.replace('?', '&')
69
- } else {
70
- url = url + params
71
- }
72
- return url
73
- }
74
- }
75
- }
76
- </script>
77
-
78
- <style lang="scss" scoped>
79
- .pi-scroll-container {
80
- background-color: #ffffff;
81
- }
82
- </style>
1
+ <template>
2
+ <view class="pi-scroll-container">
3
+ <!-- #ifndef MP -->
4
+ <slot name="title">
5
+ <pi-navbar :show-home="showHome" :fixed="false">{{ title }}</pi-navbar>
6
+ </slot>
7
+ <!-- #endif -->
8
+ <!-- #ifndef APP-PLUS -->
9
+ <view class="pi-scroll pi-safearea">
10
+ <web-view v-if="webviewURL" :progress="true" :src="webviewURL" />
11
+ </view>
12
+ <!-- #endif -->
13
+ </view>
14
+ </template>
15
+
16
+ <script>
17
+ const TAG = 'PiWebview'
18
+ export default {
19
+ name: 'PiWebview',
20
+ props: {
21
+ title: {
22
+ type: String
23
+ },
24
+ showHome: {
25
+ type: Boolean,
26
+ default: () => false
27
+ },
28
+ url: {
29
+ type: String
30
+ },
31
+ autoAddTimestamp: {
32
+ type: Boolean,
33
+ default: () => true
34
+ }
35
+ },
36
+ data() {
37
+ return {
38
+ webviewURL: ''
39
+ }
40
+ },
41
+ watch: {
42
+ url: {
43
+ deep: true,
44
+ immediate: true,
45
+ handler(value) {
46
+ value && this.init()
47
+ }
48
+ }
49
+ },
50
+ methods: {
51
+ init() {
52
+ // 设置标题
53
+ if (this.title) {
54
+ uni.setNavigationBarTitle({
55
+ title: this.title
56
+ })
57
+ }
58
+ if (!this.url) return
59
+ // H5 url 需要加时间戳,否则会有缓存问题
60
+ this.webviewURL = this.autoAddTimestamp
61
+ ? this.urlAddParam(this.url || '', {
62
+ sadaisTimestamp:
63
+ new Date().getTime() + '-' + Math.round(Math.random(1) * 10000)
64
+ })
65
+ : this.url
66
+ console.log('webview页面即将打开以下URL:', this.webviewURL)
67
+ // #ifdef APP-PLUS
68
+ const wv = plus.webview.create('', 'custom-webview', {
69
+ 'plusrequire': 'none', // 禁止远程网页使用plus的API,有些使用mui制作的网页可能会监听plus.key,造成关闭页面混乱,可以通过这种方式禁止
70
+ 'uni-app': 'none', // 不加载uni-app渲染层框架,避免样式冲突
71
+ 'top': uni.getSystemInfoSync().statusBarHeight + 44 // 放置在titleNView下方。如果还想在webview上方加个地址栏的什么的,可以继续降低TOP值
72
+ })
73
+ wv.loadURL(this.webviewURL)
74
+ const currentWebview = this.$mp.page.$getAppWebview() // 获取当前页面的webview对象
75
+ currentWebview.append(wv) // 一定要append到当前的页面里,才能跟随当前页面一起做动画,一起关闭
76
+ // #endif
77
+ },
78
+ urlAddParam(url, params) {
79
+ params = this.$pi.navi.objToUrl(params)
80
+ if (url.indexOf('?') !== -1 && params) {
81
+ url = url + params.replace('?', '&')
82
+ } else {
83
+ url = url + params
84
+ }
85
+ return url
86
+ }
87
+ }
88
+ }
89
+ </script>
90
+
91
+ <style lang="scss" scoped>
92
+ .pi-scroll-container {
93
+ background-color: #ffffff;
94
+ }
95
+ </style>
@@ -3,7 +3,6 @@ import popupSelect from './popupSelect'
3
3
  export default {
4
4
  customClass: '', // 自定义样式类,字符串形式('')
5
5
  customStyle: {}, // 自定义样式,对象形式(默认值:{})
6
- type: 'single', // 选择器类型:single:单列,multi 多列,multi-auto 多列联动
7
6
  items: [], // 选项列表,默认([])
8
7
  keyField: 'id', // 选项id字段,默认为id
9
8
  displayField: 'text', // 选项显示字段,默认为text
@@ -14,5 +14,6 @@ export default {
14
14
  calendar,
15
15
  dateFormat: 'YYYY-MM-DD', // 已选择的时间格式化显示规则,默认('YYYY-MM-DD')
16
16
  rangeSplit: '至', // 范围选择时间分隔符,默认('至')
17
- parseValueFn: null // 解析值的方法,如果配置了,则读取该函数的返回值作为显示的内容
17
+ parseValueFn: null, // 解析值的方法,如果配置了,则读取该函数的返回值作为显示的内容
18
+ disabled: false
18
19
  }
@@ -22,5 +22,6 @@ export default {
22
22
  endText: '结束', // type=range时生效,结束日期自定义文案,默认('结束')
23
23
  dateFormat: 'YYYY-MM-DD', // 已选择的时间格式化显示规则,默认('YYYY-MM-DD')
24
24
  canChangeWeekView: false, // 是否可切换周视图,默认(false)
25
- defalutWeekView: false // 是否默认显示周视图,默认(false)
25
+ defalutWeekView: false, // 是否默认显示周视图,默认(false)
26
+ marks: [] // 日期标记,数组形式,默认([])
26
27
  }
@@ -0,0 +1,22 @@
1
+ import popupSelect from './popupSelect'
2
+
3
+ export default {
4
+ customClass: '', // 自定义样式类,字符串形式('')
5
+ customStyle: {}, // 自定义样式,对象形式(默认值:{})
6
+ items: [], // 选项列表,默认([])
7
+ keyField: 'id', // 选项id字段,默认为id
8
+ displayField: 'text', // 选项显示字段,默认为text
9
+ childrenField: 'children', // 描述显示字段,默认为children
10
+ defaultValue: null, // 默认值,单选是传Object,多选时传Array,默认null
11
+ itemHeight: 110, // 行高(默认:'110rpx')
12
+ showItemBottomBorder: false, // 是否显示item下边框(默认:'true')
13
+ itemStyle: {}, // 行样式(默认:'{}')
14
+ parentCanSelect: false, // 父节点是否可选(默认:'false')
15
+ popupSelect: popupSelect, // popupSelect配置
16
+ popup: popupSelect.popup, // 弹窗的配置,默认选项请参照popup
17
+ confirmBtn: popupSelect.confirmBtn, // 确认按钮配置
18
+ cancelBtn: {
19
+ ...popupSelect.cancelBtn,
20
+ show: true
21
+ } // 取消按钮配置
22
+ }
@@ -1,12 +1,20 @@
1
1
  export default {
2
2
  percent: 50, // 环形进度条,限制0-100之间,数字形式,默认值:50
3
- bgColor: '#ffffff', // 环形进度区域背景色,字符串形式,默认值:'#ffffff'
4
- inactiveColor: '#ececec', // 环形进度条底色,字符串形式,默认值:'#ececec'
5
- activeColor: '#19be6b', // 环形进度条激活的颜色,字符串形式,默认值:'#19be6b'
3
+ bgColor: '', // 环形进度区域背景色,字符串形式,默认值:'#ffffff'
4
+ inactiveColor: '', // 环形进度条底色,字符串形式,默认值:'#ececec'
5
+ activeColor: '', // 环形进度条激活的颜色,字符串形式,默认值:'#19be6b'
6
6
  borderWidth: 14, // 环形进度条的线条宽度,字符串/数字形式,默认值:14
7
7
  width: 200, // 环形进度条整个圆的宽度,字符串/数字形式,默认值:200
8
8
  duration: 1500, // 整个圆环执行至进度条所需的时间,单位ms,字符串/数字形式,默认值:1500
9
- type: '', // 环形进度条的主题
9
+ type: 'success', // 环形进度条的主题 'success', 'error', 'info', 'primary', 'warning'
10
+ // 主题列表
11
+ typeList: {
12
+ success: { bgColor: '#ffffff', activeColor: '#67c23a', inactiveColor: '#ececec' },
13
+ error: { bgColor: '#fef0f0', activeColor: '#f56c6c', inactiveColor: '#fbc4c4' },
14
+ info: { bgColor: '#f4f4f5', activeColor: '#909399', inactiveColor: '#ececec' },
15
+ primary: { bgColor: '#ecf5ff', activeColor: '#409eff', inactiveColor: '#b3d8ff' },
16
+ warning: { bgColor: '#fdf6ec', activeColor: '#e6a23c', inactiveColor: '#f5dab1' }
17
+ },
10
18
  fontSize: '16px', // 环形进度条中间显示文字的大小,字符串形式,默认值:'16px'
11
19
  text: '' // 环形进度条中间显示的文字,字符串形式,默认值:''
12
20
  }
@@ -8,5 +8,6 @@ export default {
8
8
  autoFocusDelay: 350, // 自动拉起键盘延时
9
9
  stretch: false, // 每项验证码是否均分宽度
10
10
  align: 'left', // 验证码对齐方向,可选值:left、center、right
11
- codeFormat: '' // 验证码显示格式化
11
+ codeFormat: '', // 验证码显示格式化
12
+ disabled: false
12
13
  }
@@ -1,24 +1,29 @@
1
- import popupSelect from './popupSelect'
2
-
3
- const currentYear = new Date().getFullYear()
4
- const startYear = currentYear - 30
5
- const endYear = currentYear
6
-
7
- export default {
8
- customClass: '', // 自定义样式类,字符串形式('')
9
- customStyle: {}, // 自定义样式,对象形式(默认值:{})
10
- startYear, // 开始年份(默认当前年份 - 30)
11
- endYear, // 结束年份(默认当前年份)
12
- field: 'day', // 选择器的粒度 year、month、day、hour、minute、second
13
- dateType: 'datetime', // 日期类型,date、datetime、time(默认值:datetime)
14
- defaultValue: '', // 日期默认值
15
- units: ['年', '月', '日', '时', '分', '秒'], // 单位数组,默认值:['年', '月', '日', '时', '分', '秒']
16
- format: '', // 返回的日期格式,为空的时候,返回的是日期对象
17
- itemHeight: 110, // 行高(默认:'110rpx')
18
- itemStyle: {}, // 行样式(默认:{})
19
- showItemBottomBorder: true, // 是否显示底部边线
20
- popupSelect: popupSelect, // popupSelect配置
21
- popup: popupSelect.popup, // 弹窗的配置,默认选项请参照popup
22
- confirmBtn: popupSelect.confirmBtn, // 确认按钮配置
23
- cancelBtn: popupSelect.cancelBtn // 取消按钮配置
24
- }
1
+ import popupSelect from './popupSelect'
2
+
3
+ const currentYear = new Date().getFullYear()
4
+ const startYear = currentYear - 30
5
+ const endYear = currentYear
6
+
7
+ export default {
8
+ customClass: '', // 自定义样式类,字符串形式('')
9
+ customStyle: {}, // 自定义样式,对象形式(默认值:{})
10
+ startYear, // 开始年份(默认当前年份 - 30)
11
+ endYear, // 结束年份(默认当前年份)
12
+ field: 'day', // 选择器的粒度 year、month、day、hour、minute、second
13
+ dateType: 'datetime', // 日期类型,date、datetime、time(默认值:datetime)
14
+ yearOptions: [], // 年份选项(默认值:[])
15
+ monthOptions: [], // 月份选项(默认值:[])
16
+ dayOptions: [], // 日期选项(默认值:[])
17
+ hourOptions: [], // 小时选项(默认值:[])
18
+ minuteOptions: [], // 分钟选项(默认值:[])
19
+ defaultValue: '', // 日期默认值
20
+ units: ['年', '月', '日', '时', '分', '秒'], // 单位数组,默认值:['年', '月', '日', '时', '分', '秒']
21
+ format: '', // 返回的日期格式,为空的时候,返回的是日期对象
22
+ itemHeight: 110, // 行高(默认:'110rpx')
23
+ itemStyle: {}, // 行样式(默认:{})
24
+ showItemBottomBorder: true, // 是否显示底部边线
25
+ popupSelect: popupSelect, // popupSelect配置
26
+ popup: popupSelect.popup, // 弹窗的配置,默认选项请参照popup
27
+ confirmBtn: popupSelect.confirmBtn, // 确认按钮配置
28
+ cancelBtn: popupSelect.cancelBtn // 取消按钮配置
29
+ }
@@ -13,5 +13,6 @@ export default {
13
13
  // 日期弹窗的配置,默认选项请参照datePicker
14
14
  datePicker,
15
15
  dateFormat: 'YYYY-MM-DD', // 已选择的时间格式化显示规则,默认('YYYY-MM-DD')
16
- parseValueFn: null // 解析值的方法,如果配置了,则读取该函数的返回值作为显示的内容
16
+ parseValueFn: null, // 解析值的方法,如果配置了,则读取该函数的返回值作为显示的内容
17
+ disabled: false
17
18
  }
@@ -19,5 +19,7 @@ export default {
19
19
  selectedImg: null, // 选中图标的配置
20
20
  selectedCheckbox: null, // 选中复选框配置
21
21
  stretch: false, // 标签是否均分布局,可选值 `true`
22
- maskAlignTop: true // 是否需要蒙层顶部对齐组件,可选值 `false`
22
+ tabHeight: 80, // 标签的高度,单位rpx
23
+ maskAlignTop: true, // 是否需要蒙层顶部对齐组件,可选值 `false`
24
+ disabled: false
23
25
  }
package/config/input.js CHANGED
@@ -9,7 +9,7 @@ export default {
9
9
  placeholderClass: 'input-placeholder', // 指定 placeholder 的样式类,注意页面或组件的style中写了scoped时,需要在类名前写::v-deep
10
10
  disabled: false, // 是否禁用
11
11
  border: false, // 边框样式设置
12
- maxlength: 140, // 最大输入长度,设置为 -1 的时候不限制最大长度
12
+ maxlength: -1, // 最大输入长度,设置为 -1 的时候不限制最大长度
13
13
  password: false,
14
14
  cursorSpacing: 0, // 指定光标与键盘的距离,单位 px
15
15
  focus: false, // 是否自动获得焦点
@@ -29,7 +29,9 @@ export default {
29
29
  clearIcon: {
30
30
  // 清空图标设置
31
31
  ...icon,
32
+ size: 36,
32
33
  name: 'close-line',
33
- color: '#cccccc'
34
- }
34
+ color: '#999999'
35
+ },
36
+ updateOnBlur: true // 为false时,输入时更新 v-model,为true时,失焦时更新 v-model
35
37
  }
@@ -0,0 +1,18 @@
1
+ export default {
2
+ // 滚动方向: 'left', 'right', 'up', 'down'
3
+ direction: 'left',
4
+ // 动画持续时间(秒)
5
+ duration: 15,
6
+ // 动画速度曲线: linear, ease, ease-in, ease-out, ease-in-out
7
+ timingFunction: 'linear',
8
+ // 是否暂停动画
9
+ paused: false,
10
+ // 自定义样式
11
+ customStyle: {},
12
+ // 自定义样式类
13
+ customClass: '',
14
+ // 轮播数据
15
+ items: [],
16
+ // 每个item之间的间距(单位:rpx)
17
+ itemGap: 0
18
+ }
@@ -24,5 +24,6 @@ export default {
24
24
  keyDefaultValue: true
25
25
  },
26
26
  rangeSplit: '/', // 地区分隔符,默认('/')
27
- parseValueFn: null // 解析值的方法,如果配置了,则读取该函数的返回值作为显示的内容
27
+ parseValueFn: null, // 解析值的方法,如果配置了,则读取该函数的返回值作为显示的内容
28
+ disabled: false
28
29
  }
package/config/select.js CHANGED
@@ -8,9 +8,11 @@ export default {
8
8
  items: [], // 选项列表,默认([])
9
9
  keyField: 'id', // 选项id字段,默认为id
10
10
  displayField: 'text', // 选项显示字段,默认为text
11
+ descField: 'desc', // 描述显示字段,默认为desc
11
12
  keyDefaultValue: false, // 是否只绑定keyField的默认值,默认false
12
13
  defaultValue: null, // 默认值,单选是传Object,多选时传Array,默认null
13
14
  isMulti: false, // 是否多选,(默认:false)
15
+ showSelectAll: false, // 是否显示全选(多选isMulti开启的情况下)
14
16
  singleCancel: true, // 单选模式下,是否可取消选中
15
17
  singleConfirm: false, // 单选模式下,是否直接选中,不需要点击确认按钮(需要设置singleCancel:false)
16
18
  itemHeight: 110, // 行高(默认:'110rpx')
@@ -25,5 +27,15 @@ export default {
25
27
  popupSelect: popupSelect, // popupSelect配置
26
28
  popup: popupSelect.popup, // 弹窗的配置,默认选项请参照popup
27
29
  confirmBtn: popupSelect.confirmBtn, // 确认按钮配置
28
- cancelBtn: popupSelect.cancelBtn // 取消按钮配置
30
+ cancelBtn: popupSelect.cancelBtn, // 取消按钮配置
31
+ remoteSearchConfig: {
32
+ // 远程搜索配置
33
+ enable: false, // 是否开启远程搜索
34
+ filter: false, // 是否支持筛选
35
+ filterPlaceholder: '请输入关键字', // 筛选框占位符
36
+ filterAction: '搜索',
37
+ filterKey: 'name', // 筛选字段
38
+ pageSize: 20 // 每页数量
39
+ },
40
+ parseRemoteSearchResult: null // 远程搜索结果解析钩子
29
41
  }
@@ -24,5 +24,6 @@ export default {
24
24
  keyDefaultValue: true
25
25
  },
26
26
  rangeSplit: ',', // 范围选择时间分隔符,默认(',')
27
- parseValueFn: null // 解析值的方法,如果配置了,则读取该函数的返回值作为显示的内容
27
+ parseValueFn: null, // 解析值的方法,如果配置了,则读取该函数的返回值作为显示的内容
28
+ disabled: false
28
29
  }
package/config/steps.js CHANGED
@@ -5,7 +5,7 @@ export default {
5
5
  customStyle: {}, // 自定义样式,对象形式(默认值:{})
6
6
  items: [], // 选项列表,默认([])
7
7
  mode: 'dot', // 步骤条的类型,默认('dot')
8
- activeColor: '', // 激活步骤的颜色
8
+ activeColor: '#5a7dff', // 激活步骤的颜色
9
9
  color: '#cccccc', // 未激活的颜色
10
10
  currentColor: '#666666', // 当前步骤的颜色
11
11
  direction: 'row', // 排列方向
@@ -0,0 +1,9 @@
1
+ export default {
2
+ columns: [],
3
+ data: [],
4
+ emptyText: '暂无数据',
5
+ stripe: true,
6
+ headStyle: {},
7
+ cellStyle: {},
8
+ bounce: false
9
+ }
@@ -1,10 +1,10 @@
1
1
  /*
2
2
  * @Author: zhangzhenfei
3
3
  * @Date: 2021-08-13 11:29:02
4
- * @LastEditTime: 2021-11-17 10:07:54
4
+ * @LastEditTime: 2024-10-22 10:43:21
5
5
  * @LastEditors: zhangzhenfei
6
6
  * @Description: 图片上传
7
- * @FilePath: /piui-awesome/src/piui/config/upload-img.js
7
+ * @FilePath: /piui-awesome/src/piui/config/uploadImg.js
8
8
  */
9
9
  import icon from './icon.js'
10
10
  import cropOption from './imgCropper.js'
@@ -18,18 +18,14 @@ export default {
18
18
  formData: {}, // 上传表单额外数据,对象形式(默认值:{})
19
19
  name: 'file', // 上传的文件字段名
20
20
  itemStyle: {
21
- width: '160rpx',
22
- height: '160rpx',
23
21
  borderRadius: '8rpx'
24
22
  }, // 单个文件额外样式,对象形式(默认值:{})
25
23
  uploadBtnStyle: {
26
- width: '160rpx',
27
- height: '160rpx',
28
24
  background: '#f3f3f3',
29
25
  borderRadius: '8rpx'
30
26
  },
31
27
  imageMode: 'aspectFill', // 上传图片模式,默认值:aspectFill
32
- size: '80', // 上传区域尺寸(半径)
28
+ size: '160', // 上传区域尺寸(半径)
33
29
  previewFullImage: true, // 是否在点击预览图后展示全屏图片预览
34
30
  deletable: true, // 是否可以删除上传的文件
35
31
  disabled: false, // 是否禁用上传
@@ -44,20 +40,46 @@ export default {
44
40
  size: '60',
45
41
  color: '#999999'
46
42
  },
47
- // 调用uniapp.chooseImageOpts参数
43
+ type: 'image', // 上传文件类型,可选值为image、video、all
44
+ fileTypes: [], // 当 type 为 all 时生效,允许上传的文件类型是否包含 video 和 image
45
+ // 当type为 "all"时生效,调用uni.chooseFile参数
46
+ chooseFileOpts: {
47
+ sourceType: ['album', 'camera'], // (仅在type为image或video时可用)album 从相册选图,camera 使用相机,默认二者都有。如需直接开相机或直接选相册,请只使用一个选项
48
+ extension: [], // 允许上传的文件类型,不填则不限制
49
+ maxDuration: 60, // 拍摄视频最长拍摄时间,单位秒,默认60
50
+ camera: 'back', // 前置或后置摄像头,默认back
51
+ fromWxMessage: true // 是否来自微信消息
52
+ },
53
+ // 当type为 "image"时生效,调用uni.chooseImage参数
48
54
  chooseImageOpts: {
49
- sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认compressed
50
55
  sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认album
56
+ extension: [], // 允许上传的文件类型,不填则不限制
57
+ sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认compressed
51
58
  crop: {} // 图像裁剪参数,设置后 sizeType 失效
52
59
  },
60
+ // 当type为 "video"时生效,调用uniapp.chooseVideo参数
61
+ chooseVideoOpts: {
62
+ sourceType: ['album', 'camera'], // album 从相册选视频,camera 使用相机拍摄,默认二者都有
63
+ compressed: true, // 是否压缩视频,默认true
64
+ maxDuration: 60, // 拍摄视频最长拍摄时间,单位秒,默认60
65
+ camera: 'back', // 前置或后置摄像头,默认back
66
+ extension: [] // 允许上传的文件类型,不填则不限制
67
+ },
53
68
  parseResultFn: function(result) {
54
69
  try {
55
70
  return JSON.parse(result.data)?.data.url
56
71
  } catch (error) {
57
- console.error('解析上传结果失败,请使用自定义解析函数 parseResultFn ', error)
72
+ console.error(
73
+ '解析上传结果失败,请使用自定义解析函数 parseResultFn ',
74
+ error
75
+ )
58
76
  }
59
77
  },
60
78
  beforeUpload: null, // 上传之前的钩子
61
79
  onProgress: null, // 文件上传时的钩子
62
- beforeRemove: null // 删除之前的钩子
80
+ beforeRemove: null, // 删除之前的钩子
81
+ customTakePhoto: false, // 是否自定义拍照(如果为true,则不调用相机,通过事件自己实现拍照上传)
82
+ fileIconMap: {}, // 文件类型和图标映射关系,对象形式({PDF: 'https://xxx'})
83
+ customUploadParams: {}, // 自定义上传参数,对象形式
84
+ fileLimit: null // 文件大小限制,单位为字节,null表示不限制
63
85
  }
package/mixin/emitter.js CHANGED
@@ -25,7 +25,14 @@ export default {
25
25
  methods: {
26
26
  dispatch(componentName, eventName, params) {
27
27
  let parent = this.$parent || this.$root
28
- let name = parent.$options.componentName
28
+ let name
29
+ // #ifdef H5
30
+ name = parent.$options.componentName
31
+ // #endif
32
+
33
+ // #ifndef H5
34
+ name = parent.$options.name
35
+ // #endif
29
36
 
30
37
  while (parent && (!name || name !== componentName)) {
31
38
  parent = parent.$parent
@@ -3,7 +3,9 @@
3
3
  * 提供v-model双向绑定
4
4
  * 提供传入value属性,将同步到val中
5
5
  */
6
+ import Emitter from './emitter'
6
7
  export default {
8
+ mixins: [Emitter],
7
9
  model: {
8
10
  prop: 'value',
9
11
  event: 'input'
@@ -27,6 +29,9 @@ export default {
27
29
  handleEmitChange() {
28
30
  this.$emit('input', this.val)
29
31
  this.$emit('change', this.val)
32
+
33
+ this.dispatch('PiForm', 'form-change', this.val)
34
+ this.dispatch('PiFormItem', 'form-change', this.val)
30
35
  }
31
36
  }
32
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sadais-piui",
3
- "version": "1.2.7beta15",
3
+ "version": "1.2.7-beta151",
4
4
  "description": "piui组件库",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,5 +21,8 @@
21
21
  "bugs": {
22
22
  "url": "https://github.com/sadais-org/piui/issues"
23
23
  },
24
- "homepage": "https://github.com/sadais-org/piui#readme"
24
+ "homepage": "https://github.com/sadais-org/piui#readme",
25
+ "publishConfig": {
26
+ "registry": "https://registry.npmjs.org/"
27
+ }
25
28
  }