ai.touchui-vue 1.35.0 → 1.35.1
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.
- package/lib/ai.touchui-vue.common.js +55 -30
- package/lib/date-picker.js +36 -17
- package/lib/index.js +1 -1
- package/lib/input.js +8 -2
- package/package.json +1 -1
- package/packages/date-picker/src/date-picker.vue +31 -11
- package/packages/input/src/input.vue +6 -0
- package/packages/theme/src/less/.DS_Store +0 -0
- package/src/index.js +1 -1
package/lib/input.js
CHANGED
|
@@ -206,7 +206,7 @@ module.exports = require("ai.touchui-vue/lib/mixins/locale");
|
|
|
206
206
|
// ESM COMPAT FLAG
|
|
207
207
|
__webpack_require__.r(__webpack_exports__);
|
|
208
208
|
|
|
209
|
-
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=template&id=
|
|
209
|
+
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/input/src/input.vue?vue&type=template&id=5477b45b
|
|
210
210
|
var render = function () {
|
|
211
211
|
var _vm = this
|
|
212
212
|
var _h = _vm.$createElement
|
|
@@ -613,7 +613,7 @@ var staticRenderFns = []
|
|
|
613
613
|
render._withStripped = true
|
|
614
614
|
|
|
615
615
|
|
|
616
|
-
// CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=
|
|
616
|
+
// CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=5477b45b
|
|
617
617
|
|
|
618
618
|
// CONCATENATED MODULE: ./src/utils/string.js
|
|
619
619
|
function filter(chars, from) {
|
|
@@ -1111,6 +1111,12 @@ var tip_default = /*#__PURE__*/__webpack_require__.n(tip_);
|
|
|
1111
1111
|
this.$el.addEventListener('mouseout', this.hideClear);
|
|
1112
1112
|
}
|
|
1113
1113
|
document.body.addEventListener('click', this.blur);
|
|
1114
|
+
var inputElement = this.$refs.input;
|
|
1115
|
+
inputElement.addEventListener('keydown', function (e) {
|
|
1116
|
+
if (e.altKey) {
|
|
1117
|
+
e.preventDefault();
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1114
1120
|
},
|
|
1115
1121
|
deactivated: function deactivated() {
|
|
1116
1122
|
this.destroy();
|
package/package.json
CHANGED
|
@@ -221,7 +221,7 @@ export default {
|
|
|
221
221
|
} else {
|
|
222
222
|
newValue = this.getDateFromValue(newValue, this.valueFormat)
|
|
223
223
|
this.date = newValue
|
|
224
|
-
this.datedisplay = this.formatDate(newValue, this.displayFormat)
|
|
224
|
+
this.datedisplay = this.formatDate(newValue, this.displayFormat,val)
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
},
|
|
@@ -259,25 +259,28 @@ export default {
|
|
|
259
259
|
handleDisplayBlur() {
|
|
260
260
|
setTimeout(() => {
|
|
261
261
|
if (isNaN(new Date(this.datedisplay))) {
|
|
262
|
+
if(this.datedisplay) {
|
|
263
|
+
this.$emit('errTime')
|
|
264
|
+
}
|
|
262
265
|
this.datedisplay = ''
|
|
263
|
-
this.changeValue('')
|
|
266
|
+
this.changeValue('','')
|
|
264
267
|
} else {
|
|
265
268
|
this.$emit('beforeChange', this.datedisplay)
|
|
266
269
|
if (!this.displayFormatRegExp.test(this.datedisplay)) {
|
|
267
|
-
this.datedisplay = this.formatDate(new Date(this.datedisplay), this.displayFormat)
|
|
268
|
-
this.iValue = this.formatDate(new Date(this.datedisplay), this.displayFormat)
|
|
270
|
+
this.datedisplay = this.formatDate(new Date(this.datedisplay), this.displayFormat,this.datedisplay)
|
|
271
|
+
this.iValue = this.formatDate(new Date(this.datedisplay), this.displayFormat,this.datedisplay)
|
|
269
272
|
this.$emit('change', this.iValue)
|
|
270
273
|
} else {
|
|
271
|
-
this.changeValue(this.getDateFromValue(this.datedisplay, this.displayFormat))
|
|
274
|
+
this.changeValue(this.getDateFromValue(this.datedisplay, this.displayFormat),this.datedisplay)
|
|
272
275
|
}
|
|
273
276
|
}
|
|
274
277
|
}, 100);
|
|
275
278
|
},
|
|
276
279
|
select(value) {
|
|
277
|
-
this.changeValue(value)
|
|
280
|
+
this.changeValue(value,'')
|
|
278
281
|
this.$refs.layer.close()
|
|
279
282
|
},
|
|
280
|
-
changeValue(value) {
|
|
283
|
+
changeValue(value,oldVal) {
|
|
281
284
|
this.$emit('beforeChange', value)
|
|
282
285
|
if (!value) {
|
|
283
286
|
this.clear()
|
|
@@ -286,7 +289,7 @@ export default {
|
|
|
286
289
|
this.datedisplay = value.split(' ').length > 1 ? value.split(' ')[1] : value
|
|
287
290
|
this.iValue = value.split(' ').length > 1 ? value.split(' ')[1] : value
|
|
288
291
|
} else {
|
|
289
|
-
value = this.formatDate(new Date(value), 'yyyy-MM-dd HH:mm:ss')
|
|
292
|
+
value = this.formatDate(new Date(value), 'yyyy-MM-dd HH:mm:ss',value)
|
|
290
293
|
const flag = isNaN(new Date(value).getTime()) // 判断是否可以使用 2022-05 如果不可用,则替换为 2022/05
|
|
291
294
|
if (flag) {
|
|
292
295
|
value = value.replace(/-/g, '/')
|
|
@@ -300,8 +303,8 @@ export default {
|
|
|
300
303
|
if (flag) {
|
|
301
304
|
value = value.replace(/-/g, '/')
|
|
302
305
|
}
|
|
303
|
-
this.datedisplay = this.formatDate(new Date(value), this.displayFormat)
|
|
304
|
-
this.iValue = this.formatDate(new Date(value), this.valueFormat)
|
|
306
|
+
this.datedisplay = this.formatDate(new Date(value), this.displayFormat,oldVal)
|
|
307
|
+
this.iValue = this.formatDate(new Date(value), this.valueFormat,oldVal)
|
|
305
308
|
this.$emit('change', this.iValue)
|
|
306
309
|
}
|
|
307
310
|
},
|
|
@@ -392,8 +395,25 @@ export default {
|
|
|
392
395
|
if (!yMatch) return
|
|
393
396
|
return value.substr(yMatch.index, yMatch[0].length)
|
|
394
397
|
},
|
|
395
|
-
formatDate(date, fmt) {
|
|
398
|
+
formatDate(date, fmt,value) {
|
|
396
399
|
if (date) {
|
|
400
|
+
// 如果 this.type 不是 'datetime' 或 'time',检查 date 是否为有效的日期格式
|
|
401
|
+
if (this.type !== 'datetime' && this.type !== 'time' && value) {
|
|
402
|
+
const dateStr = String(value);
|
|
403
|
+
const isValidDate = (
|
|
404
|
+
// 匹配 2025-07-06
|
|
405
|
+
/^\d{4}-\d{2}-\d{2}$/.test(dateStr) ||
|
|
406
|
+
// 匹配 20250706
|
|
407
|
+
/^\d{8}$/.test(dateStr) ||
|
|
408
|
+
// 匹配 2025/07/06
|
|
409
|
+
/^\d{4}\/\d{2}\/\d{2}$/.test(dateStr)
|
|
410
|
+
);
|
|
411
|
+
if (!isValidDate) {
|
|
412
|
+
this.$emit('errTime')
|
|
413
|
+
return '';
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
397
417
|
if (!fmt) {
|
|
398
418
|
if (this.type === 'datetime') {
|
|
399
419
|
fmt = 'yyyy-MM-dd HH:mm:ss'
|
|
@@ -469,6 +469,12 @@ export default {
|
|
|
469
469
|
this.$el.addEventListener('mouseout', this.hideClear);
|
|
470
470
|
}
|
|
471
471
|
document.body.addEventListener('click', this.blur);
|
|
472
|
+
const inputElement = this.$refs.input;
|
|
473
|
+
inputElement.addEventListener('keydown', function(e) {
|
|
474
|
+
if (e.altKey) {
|
|
475
|
+
e.preventDefault();
|
|
476
|
+
}
|
|
477
|
+
});
|
|
472
478
|
},
|
|
473
479
|
deactivated() {
|
|
474
480
|
this.destroy()
|
|
Binary file
|