mali-applet-ui 0.2.79 → 0.2.81

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.
@@ -46,10 +46,7 @@ export default {
46
46
  value: [String, Number],
47
47
  align: String,
48
48
  border: Boolean,
49
- min: {
50
- type: [Number, String],
51
- default: 0
52
- },
49
+ min: [Number, String],
53
50
  max: {
54
51
  type: [Number, String],
55
52
  default: 9999999999
@@ -58,6 +55,7 @@ export default {
58
55
  type: Number,
59
56
  default: 12
60
57
  },
58
+ negative: Boolean,
61
59
  placeholder: {
62
60
  type: String,
63
61
  default: '请输入'
@@ -101,13 +99,16 @@ export default {
101
99
  },
102
100
  minNum () {
103
101
  if (XEUtils.isNumber(this.min) || this.min) {
104
- return Number(this.min || 0)
102
+ return Number(this.min || 0)
103
+ }
104
+ if (this.negative) {
105
+ return -9999999999
105
106
  }
106
107
  return null
107
108
  },
108
109
  maxNum () {
109
110
  if (XEUtils.isNumber(this.max) || this.max) {
110
- return Number(this.max)
111
+ return Number(this.max)
111
112
  }
112
113
  return null
113
114
  },
@@ -50,10 +50,6 @@ export default {
50
50
  align: String,
51
51
  border: Boolean,
52
52
  type: String,
53
- maxLength: {
54
- type: Number,
55
- default: 12
56
- },
57
53
  min: [String, Number],
58
54
  max: [String, Number],
59
55
  step: [String, Number],
@@ -89,6 +85,12 @@ export default {
89
85
  isFromReadonly () {
90
86
  return this.form ? this.form.readonly : false
91
87
  },
88
+ maxLength () {
89
+ if (this.type === 'integer') {
90
+ return this.maxNum ? `${this.maxNum}`.length : 9
91
+ }
92
+ return this.maxNum ? (`${this.maxNum}`.length + 3) : 12
93
+ },
92
94
  minNum () {
93
95
  if (XEUtils.isNumber(this.min) || this.min) {
94
96
  return XEUtils.toNumber(this.min || 0)
@@ -129,11 +131,6 @@ export default {
129
131
  return { status: true, value: this.inpVal }
130
132
  }
131
133
  const numVal = XEUtils.toNumber(XEUtils.toValueString(this.inpVal).slice(0, this.maxLength))
132
- if (this.type === 'integer' && !/^[0-9]$/.test(numVal)) {
133
- const value = XEUtils.toInteger(numVal)
134
- this.$emit('input', value)
135
- return { status: false, value: value }
136
- }
137
134
  if (this.minNum !== null && (numVal < this.minNum)) {
138
135
  this.$emit('input', this.minNum)
139
136
  return { status: false, value: this.minNum }
@@ -142,6 +139,11 @@ export default {
142
139
  this.$emit('input', this.maxNum)
143
140
  return { status: false, value: this.maxNum }
144
141
  }
142
+ if (this.type === 'integer' && !/^-?[0-9]+$/.test(numVal)) {
143
+ const value = XEUtils.toInteger(numVal)
144
+ this.$emit('input', value)
145
+ return { status: false, value: value }
146
+ }
145
147
  if (`${numVal}` !== this.inpVal) {
146
148
  this.$emit('input', numVal)
147
149
  return { status: false, value: numVal }
@@ -299,7 +299,7 @@ export default {
299
299
  },
300
300
  previewDocs (item) {
301
301
  // 仅支持文档和图片
302
- if (previewTypes.includes(item[this.typeField])) {
302
+ if (this.previewTypes.includes(item[this.typeField])) {
303
303
  uni.downloadFile({
304
304
  url: this.getUrl(item),
305
305
  success: (downRes) => {
@@ -308,7 +308,7 @@ export default {
308
308
  filePath: downRes.tempFilePath,
309
309
  showMenu: true,
310
310
  success () {},
311
- fail () {
311
+ fail: () => {
312
312
  uni.showModal({
313
313
  content: '打开失败',
314
314
  showCancel: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "0.2.79",
3
+ "version": "0.2.81",
4
4
  "description": "码里云小程序组件库",
5
5
  "scripts": {
6
6
  "release": "node script/release.js && npm publish"