ai.touchui-vue 1.35.2 → 1.37.0

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/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=5477b45b
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=d10b5358
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=5477b45b
616
+ // CONCATENATED MODULE: ./packages/input/src/input.vue?vue&type=template&id=d10b5358
617
617
 
618
618
  // CONCATENATED MODULE: ./src/utils/string.js
619
619
  function filter(chars, from) {
@@ -1059,7 +1059,7 @@ var tip_default = /*#__PURE__*/__webpack_require__.n(tip_);
1059
1059
  this.disabled = val;
1060
1060
  },
1061
1061
  type: function type(val) {
1062
- if (val === 'password') {
1062
+ if (val === 'password' || val === 'number') {
1063
1063
  this.itype = val;
1064
1064
  } else {
1065
1065
  this.itype = 'text';
package/lib/select.js CHANGED
@@ -252,7 +252,7 @@ module.exports = require("ai.touchui-vue/lib/locale");
252
252
  // ESM COMPAT FLAG
253
253
  __webpack_require__.r(__webpack_exports__);
254
254
 
255
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=template&id=bddf1226
255
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/select/src/select.vue?vue&type=template&id=0805d936
256
256
  var render = function () {
257
257
  var _vm = this
258
258
  var _h = _vm.$createElement
@@ -1064,6 +1064,7 @@ var render = function () {
1064
1064
  : _c("to-input", {
1065
1065
  ref: "popupFilter",
1066
1066
  attrs: {
1067
+ tabindex: "-1",
1067
1068
  "sp-chars": false,
1068
1069
  width: "full",
1069
1070
  "prevent-focus": "",
@@ -1095,6 +1096,7 @@ var render = function () {
1095
1096
  ? _c("to-input", {
1096
1097
  ref: "popupInput",
1097
1098
  attrs: {
1099
+ tabindex: "-1",
1098
1100
  "sp-chars":
1099
1101
  _vm.spChars,
1100
1102
  "prevent-focus": "",
@@ -1102,6 +1104,11 @@ var render = function () {
1102
1104
  placeholder:
1103
1105
  _vm.placeholder,
1104
1106
  },
1107
+ on: {
1108
+ focus: _vm.inputFocus,
1109
+ keyup: _vm.inputInput,
1110
+ blur: _vm.inputBlur,
1111
+ },
1105
1112
  model: {
1106
1113
  value: _vm.inputValue,
1107
1114
  callback: function (
@@ -1116,6 +1123,7 @@ var render = function () {
1116
1123
  : _c("to-input", {
1117
1124
  ref: "popupFilter",
1118
1125
  attrs: {
1126
+ tabindex: "-1",
1119
1127
  "sp-chars": false,
1120
1128
  "prevent-focus": "",
1121
1129
  width: "full",
@@ -1124,6 +1132,10 @@ var render = function () {
1124
1132
  on: {
1125
1133
  clear:
1126
1134
  _vm.filterClear,
1135
+ focus:
1136
+ _vm.filterFocus,
1137
+ keyup:
1138
+ _vm.filterInput,
1127
1139
  },
1128
1140
  model: {
1129
1141
  value:
@@ -1894,7 +1906,7 @@ var staticRenderFns = []
1894
1906
  render._withStripped = true
1895
1907
 
1896
1908
 
1897
- // CONCATENATED MODULE: ./packages/select/src/select.vue?vue&type=template&id=bddf1226
1909
+ // CONCATENATED MODULE: ./packages/select/src/select.vue?vue&type=template&id=0805d936
1898
1910
 
1899
1911
  // EXTERNAL MODULE: external "ai.touchui-vue/lib/utils/ajax"
1900
1912
  var ajax_ = __webpack_require__(15);
@@ -2432,6 +2444,7 @@ var lib_locale_ = __webpack_require__(3);
2432
2444
  focused: false,
2433
2445
  blurByLayer: false,
2434
2446
  options: [],
2447
+ s_options: [],
2435
2448
  anotherOptions: [], // 只作用于手机端
2436
2449
  layerSlide: false,
2437
2450
  layerPosition: 'auto',
@@ -2963,6 +2976,7 @@ var lib_locale_ = __webpack_require__(3);
2963
2976
  arr.push(obj);
2964
2977
  }
2965
2978
  if (this.$phone && this.filterable) {
2979
+ this.s_options = arr.slice(0, 100);
2966
2980
  this.options = arr.slice(0, 100);
2967
2981
  this.anotherOptions = arr.slice(100);
2968
2982
  } else {
@@ -2971,6 +2985,7 @@ var lib_locale_ = __webpack_require__(3);
2971
2985
  } else {
2972
2986
  // 如果是手机端,则先取前 100 项,再拼接后面的
2973
2987
  if (this.$phone && this.filterable) {
2988
+ this.s_options = this.data.slice(0, 100);
2974
2989
  this.options = this.data.slice(0, 100);
2975
2990
  this.anotherOptions = this.data.slice(100);
2976
2991
  } else {
@@ -3171,7 +3186,7 @@ var lib_locale_ = __webpack_require__(3);
3171
3186
  _this15.$refs.popupFilter.focus();
3172
3187
  }
3173
3188
  _this15.$nextTick(function () {
3174
- _this15.options = _this15.options.concat(_this15.anotherOptions);
3189
+ _this15.options = _this15.s_options.concat(_this15.anotherOptions);
3175
3190
  });
3176
3191
  }, 500);
3177
3192
  }
package/lib/slide.js CHANGED
@@ -199,7 +199,7 @@ function normalizeComponent(
199
199
  // ESM COMPAT FLAG
200
200
  __webpack_require__.r(__webpack_exports__);
201
201
 
202
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/slide/src/slide.vue?vue&type=template&id=628fc16c
202
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/slide/src/slide.vue?vue&type=template&id=020258e2
203
203
  var render = function () {
204
204
  var _vm = this
205
205
  var _h = _vm.$createElement
@@ -274,7 +274,7 @@ var staticRenderFns = []
274
274
  render._withStripped = true
275
275
 
276
276
 
277
- // CONCATENATED MODULE: ./packages/slide/src/slide.vue?vue&type=template&id=628fc16c
277
+ // CONCATENATED MODULE: ./packages/slide/src/slide.vue?vue&type=template&id=020258e2
278
278
 
279
279
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/slide/src/slide.vue?vue&type=script&lang=js
280
280
  //
@@ -314,7 +314,8 @@ render._withStripped = true
314
314
  animate: true,
315
315
  playTimer: null,
316
316
  startPosition: false,
317
- width: 0
317
+ width: 0,
318
+ observer: null
318
319
  };
319
320
  },
320
321
 
@@ -344,53 +345,80 @@ render._withStripped = true
344
345
  window.addEventListener('resize', function () {
345
346
  _this.width = _this.$el.offsetWidth;
346
347
  });
348
+
349
+ // 初始化 MutationObserver
350
+ var observer = new MutationObserver(function (mutations) {
351
+ _this.setLength(); // 每次子节点变化时更新长度
352
+ });
353
+ observer.observe(_this.$refs.ul, {
354
+ childList: true, // 监听子节点变化
355
+ subtree: true // 监听所有后代节点
356
+ });
357
+ _this.observer = observer;
347
358
  }, 100);
348
359
  },
360
+ beforeDestroy: function beforeDestroy() {
361
+ var _this2 = this;
362
+
363
+ if (this.observer) {
364
+ this.observer.disconnect(); // 断开监听
365
+ }
366
+ clearInterval(this.playTimer); // 清理定时器
367
+ window.removeEventListener('resize', function () {
368
+ _this2.width = _this2.$el.offsetWidth;
369
+ });
370
+ },
349
371
 
350
372
  methods: {
351
373
  play: function play() {
352
- var _this2 = this;
374
+ var _this3 = this;
353
375
 
354
376
  if (!this.autoplay || this.length < 2) {
355
377
  return;
356
378
  }
357
379
  this.playTimer = setInterval(function () {
358
- _this2.next();
380
+ _this3.next();
359
381
  }, Number(this.speed));
360
382
  },
361
383
  pause: function pause() {
362
384
  clearInterval(this.playTimer);
363
385
  },
364
386
  setLength: function setLength() {
365
- this.length = this.$refs.ul.children.length - 2;
387
+ var _this4 = this;
388
+
389
+ this.$nextTick(function () {
390
+ if (_this4.$refs.ul) {
391
+ _this4.length = _this4.$refs.ul.children.length - 2;
392
+ }
393
+ });
366
394
  },
367
395
  next: function next() {
368
- var _this3 = this;
396
+ var _this5 = this;
369
397
 
370
398
  if (this.animate) {
371
399
  this.current += 1;
372
400
  if (this.current === this.length) {
373
401
  setTimeout(function () {
374
- _this3.animate = false;
375
- _this3.current = 0;
402
+ _this5.animate = false;
403
+ _this5.current = 0;
376
404
  setTimeout(function () {
377
- _this3.animate = true;
405
+ _this5.animate = true;
378
406
  }, 300);
379
407
  }, 300);
380
408
  }
381
409
  }
382
410
  },
383
411
  prev: function prev() {
384
- var _this4 = this;
412
+ var _this6 = this;
385
413
 
386
414
  if (this.animate) {
387
415
  this.current -= 1;
388
416
  if (this.current === -1) {
389
417
  setTimeout(function () {
390
- _this4.animate = false;
391
- _this4.current = _this4.length - 1;
418
+ _this6.animate = false;
419
+ _this6.current = _this6.length - 1;
392
420
  setTimeout(function () {
393
- _this4.animate = true;
421
+ _this6.animate = true;
394
422
  }, 300);
395
423
  }, 300);
396
424
  }
package/lib/table.js CHANGED
@@ -245,7 +245,7 @@ module.exports = require("ai.touchui-vue/lib/locale");
245
245
  // ESM COMPAT FLAG
246
246
  __webpack_require__.r(__webpack_exports__);
247
247
 
248
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/table/src/table.vue?vue&type=template&id=0f1f2eda
248
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/table/src/table.vue?vue&type=template&id=a7feb1e0
249
249
  var render = function () {
250
250
  var _vm = this
251
251
  var _h = _vm.$createElement
@@ -1064,7 +1064,7 @@ var staticRenderFns = []
1064
1064
  render._withStripped = true
1065
1065
 
1066
1066
 
1067
- // CONCATENATED MODULE: ./packages/table/src/table.vue?vue&type=template&id=0f1f2eda
1067
+ // CONCATENATED MODULE: ./packages/table/src/table.vue?vue&type=template&id=a7feb1e0
1068
1068
 
1069
1069
  // EXTERNAL MODULE: external "vue"
1070
1070
  var external_vue_ = __webpack_require__(4);
@@ -3579,6 +3579,11 @@ function db(fn) {
3579
3579
  default: function _default() {
3580
3580
  return this.height && !this.fixTop ? '0r' : '1r';
3581
3581
  }
3582
+ },
3583
+ // selectionChange 事件时是否需要将扁平数据转换为层级树形结构输出
3584
+ selectionValueType: {
3585
+ type: String,
3586
+ default: 'flat' // flat | tree
3582
3587
  }
3583
3588
  },
3584
3589
  data: function data() {
@@ -3700,9 +3705,7 @@ function db(fn) {
3700
3705
  this.iData.map(function (item) {
3701
3706
  if (item._checked) {
3702
3707
  var obj = JSON.parse(JSON.stringify(item));
3703
- delete obj._index;
3704
3708
  delete obj._checked;
3705
- delete obj._level;
3706
3709
  delete obj._show;
3707
3710
  delete obj._hover;
3708
3711
  delete obj._active;
@@ -4134,7 +4137,7 @@ function db(fn) {
4134
4137
  if (leftThs.length > 0) {
4135
4138
  for (var _j2 = 0; _j2 < leftThs.length; _j2++) {
4136
4139
  var _th3 = _ths3[_j2];
4137
- var leftTh = leftThs[_i4];
4140
+ var leftTh = leftThs[_j2];
4138
4141
  leftTh.style.width = _th3.getBoundingClientRect().width + 'px';
4139
4142
  leftTh.style.height = _th3.getBoundingClientRect().height + 'px';
4140
4143
  }
@@ -4276,8 +4279,8 @@ function db(fn) {
4276
4279
  }
4277
4280
  });
4278
4281
  this.$emit('change', this.checked, checked);
4279
- this.$emit('selectionChange', this.checked);
4280
- this.$emit('selection-change', this.checked);
4282
+ this.$emit('selectionChange', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked);
4283
+ this.$emit('selection-change', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked);
4281
4284
  },
4282
4285
 
4283
4286
  // 根据 checkbox 计算是否全选
@@ -4299,8 +4302,8 @@ function db(fn) {
4299
4302
  }
4300
4303
  this.setSelectAll();
4301
4304
  this.$emit('change', this.checked, checked, current);
4302
- this.$emit('selectionChange', this.checked, current);
4303
- this.$emit('selection-change', this.checked, current);
4305
+ this.$emit('selectionChange', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked, current);
4306
+ this.$emit('selection-change', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked, current);
4304
4307
  },
4305
4308
 
4306
4309
  // 从记录中移除
@@ -4829,6 +4832,76 @@ function db(fn) {
4829
4832
  this.collapseAll();
4830
4833
  }
4831
4834
  this.expandFlag = !this.expandFlag;
4835
+ },
4836
+
4837
+ // 将扁平数据转换为层级树形结构
4838
+ buildHierarchyTree: function buildHierarchyTree(flatData) {
4839
+ var result = [];
4840
+ var levelStack = [];
4841
+
4842
+ for (var _iterator = flatData, _isArray = Array.isArray(_iterator), _i7 = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
4843
+ var _ref5;
4844
+
4845
+ if (_isArray) {
4846
+ if (_i7 >= _iterator.length) break;
4847
+ _ref5 = _iterator[_i7++];
4848
+ } else {
4849
+ _i7 = _iterator.next();
4850
+ if (_i7.done) break;
4851
+ _ref5 = _i7.value;
4852
+ }
4853
+
4854
+ var item = _ref5;
4855
+
4856
+ var currentNode = Object.assign({}, item);
4857
+ currentNode.children = [];
4858
+
4859
+ var level = currentNode._level;
4860
+
4861
+ // 清除高于当前level的节点
4862
+ while (levelStack.length && levelStack[levelStack.length - 1]._level >= level) {
4863
+ levelStack.pop();
4864
+ }
4865
+
4866
+ if (levelStack.length === 0) {
4867
+ // 当前是顶级节点
4868
+ result.push(currentNode);
4869
+ } else {
4870
+ // 插入到上一层级的 children 中
4871
+ var parent = levelStack[levelStack.length - 1];
4872
+ parent.children.push(currentNode);
4873
+ }
4874
+
4875
+ // 当前节点入栈
4876
+ levelStack.push(currentNode);
4877
+ }
4878
+
4879
+ // 清理空 children
4880
+ var cleanEmptyChildren = function cleanEmptyChildren(nodeList) {
4881
+ for (var _iterator2 = nodeList, _isArray2 = Array.isArray(_iterator2), _i8 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
4882
+ var _ref6;
4883
+
4884
+ if (_isArray2) {
4885
+ if (_i8 >= _iterator2.length) break;
4886
+ _ref6 = _iterator2[_i8++];
4887
+ } else {
4888
+ _i8 = _iterator2.next();
4889
+ if (_i8.done) break;
4890
+ _ref6 = _i8.value;
4891
+ }
4892
+
4893
+ var node = _ref6;
4894
+
4895
+ if (node.children.length === 0) {
4896
+ delete node.children;
4897
+ } else {
4898
+ cleanEmptyChildren(node.children);
4899
+ }
4900
+ }
4901
+ };
4902
+
4903
+ cleanEmptyChildren(result);
4904
+ return result;
4832
4905
  }
4833
4906
  }
4834
4907
  });
package/lib/upload.js CHANGED
@@ -825,7 +825,7 @@ module.exports = require("ai.touchui-vue/lib/locale");
825
825
  // ESM COMPAT FLAG
826
826
  __webpack_require__.r(__webpack_exports__);
827
827
 
828
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload.vue?vue&type=template&id=43bd3902
828
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload.vue?vue&type=template&id=7e861ecf
829
829
  var render = function () {
830
830
  var _vm = this
831
831
  var _h = _vm.$createElement
@@ -1571,7 +1571,7 @@ var staticRenderFns = []
1571
1571
  render._withStripped = true
1572
1572
 
1573
1573
 
1574
- // CONCATENATED MODULE: ./packages/upload/src/upload.vue?vue&type=template&id=43bd3902
1574
+ // CONCATENATED MODULE: ./packages/upload/src/upload.vue?vue&type=template&id=7e861ecf
1575
1575
 
1576
1576
  // EXTERNAL MODULE: external "ai.touchui-vue/lib/mixins/locale"
1577
1577
  var locale_ = __webpack_require__(2);
@@ -2411,7 +2411,7 @@ var ICON = {
2411
2411
 
2412
2412
  this.updateTipFileInfo();
2413
2413
 
2414
- this.$emit('clear', this.iFiles, this.popup);
2414
+ this.$emit('clear', this.iFiles);
2415
2415
  },
2416
2416
  _transferStart: function _transferStart(file) {
2417
2417
  if (!file.guid) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai.touchui-vue",
3
- "version": "1.35.2",
3
+ "version": "1.37.0",
4
4
  "description": "TouchUI Component Library for Vue.js.",
5
5
  "main": "lib/ai.touchui-vue.common.js",
6
6
  "files": [
@@ -57,13 +57,15 @@
57
57
  "vuedraggable": "2.24.3"
58
58
  },
59
59
  "devDependencies": {
60
+ "ssh2-sftp-client": "^12.0.0",
61
+ "ssh2": "1.14.0",
62
+ "archiver": "5.3.1",
60
63
  "@typescript-eslint/eslint-plugin": "5.8.0",
61
64
  "@vue/component-compiler-utils": "2.6.0",
62
65
  "ai.touchui-chat": "^1.9.0",
63
66
  "ai.touchui-desk": "0.0.43",
64
67
  "ai.touchui-plugin": "^1.0.60",
65
68
  "algoliasearch": "3.35.1",
66
- "archiver": "5.3.1",
67
69
  "babel-cli": "6.26.0",
68
70
  "babel-core": "6.26.3",
69
71
  "babel-loader": "7.1.5",
@@ -131,7 +133,6 @@
131
133
  "select-version-cli": "0.0.2",
132
134
  "sinon": "7.5.0",
133
135
  "sinon-chai": "3.7.0",
134
- "ssh2": "1.14.0",
135
136
  "style-loader": "^1.0.0",
136
137
  "transliteration": "1.6.6",
137
138
  "uglifyjs-webpack-plugin": "2.2.0",
@@ -57,7 +57,14 @@
57
57
  <!-- 日期 开始 -->
58
58
  <div v-if="type!=='month'" class="day">
59
59
  <ul>
60
- <li v-for="(item, index) in days" :key="index" v-tip="item.point && item.point.tooltip ? item.point.tooltip : ''" v-dis="isDisableDay(item)" :class="setDayClass(item)" @click="selectDay(item)">
60
+ <li
61
+ v-for="(item, index) in days"
62
+ :key="index"
63
+ v-tip="item.point && item.point.tooltip ? item.point.tooltip : ''"
64
+ v-dis="isDisableDay(item)"
65
+ :class="setDayClass(item)"
66
+ @click="selectDay(item)"
67
+ >
61
68
  <slot :item="item" :index="index">
62
69
  <span v-if="item.value" class="solar">{{ dayText(item.value) }}</span>
63
70
  <span v-if="item.point && item.point.length > 0" class="to-calendar-points">
@@ -334,7 +341,7 @@ export default {
334
341
  isDisableDay() {
335
342
  return (item) => {
336
343
  if (this.year && this.month) {
337
- let dateString = `${this.year}/${this.month}/${Number(item.value) + 1}`
344
+ let dateString = `${this.year}/${this.month}/${Number(item.value)}`
338
345
  let min = ''
339
346
  // 默认使用 2023-03-01 格式时,其 hour = 8 而不是 0,所以要转为 2023/03/01 格式
340
347
  if (typeof this.min === 'string') {
@@ -349,8 +356,7 @@ export default {
349
356
  } else {
350
357
  max = this.max
351
358
  }
352
-
353
- return new Date(dateString) <= new Date(min) || new Date(dateString) > new Date(max)
359
+ return new Date(dateString) < new Date(min) || new Date(dateString) > new Date(max)
354
360
  } else {
355
361
  return false
356
362
  }
@@ -81,7 +81,6 @@ export default {
81
81
  default: 1
82
82
  },
83
83
  wrap: Boolean,
84
- observe: Boolean,
85
84
  readonly: Boolean
86
85
  },
87
86
  data() {
@@ -31,7 +31,18 @@
31
31
  <to-icon v-else slot="suffix" :link="inputable" :class="disabled?'to-dis':''" mode="none" color="primary" value="date" @click="showLayer"></to-icon>
32
32
  <to-float ref="layer" :lazy="lazy" :slide="layerSlide" :position="layerPosition" :paddng="0.5" :width="$platform === 'pc' ? 23 : ''" :align="optionAlign ? optionAlign : $pc ? 'right' : 'auto'" @close="handleLayerClose">
33
33
  <to-scroll v-if="$pc || showCalendar">
34
- <to-calendar ref="calendar" v-model="date" :time="time" :type="type" :min="min" :max="max" :before-change="beforeChange" @change="select" @close="$refs.layer.close()"></to-calendar>
34
+ <to-calendar
35
+ ref="calendar"
36
+ v-model="date"
37
+ :time="time"
38
+ :type="type"
39
+ :min="min"
40
+ :max="max"
41
+ :before-change="beforeChange"
42
+ @change="select"
43
+ @close="$refs.layer.close()"
44
+ >
45
+ </to-calendar>
35
46
  </to-scroll>
36
47
  <picker v-else v-model="date" :time="time" :type="type" :min="min" :max="max" @cancel="$refs.layer.close()" @change="select" @clear="clear()"></picker>
37
48
  </to-float>
@@ -221,7 +232,7 @@ export default {
221
232
  } else {
222
233
  newValue = this.getDateFromValue(newValue, this.valueFormat)
223
234
  this.date = newValue
224
- this.datedisplay = this.formatDate(newValue, this.displayFormat,val)
235
+ this.datedisplay = this.formatDate(newValue, this.displayFormat, val)
225
236
  }
226
237
  }
227
238
  },
@@ -259,28 +270,28 @@ export default {
259
270
  handleDisplayBlur() {
260
271
  setTimeout(() => {
261
272
  if (isNaN(new Date(this.datedisplay))) {
262
- if(this.datedisplay) {
273
+ if (this.datedisplay) {
263
274
  this.$emit('errTime')
264
275
  }
265
276
  this.datedisplay = ''
266
- this.changeValue('','')
277
+ this.changeValue('', '')
267
278
  } else {
268
279
  this.$emit('beforeChange', this.datedisplay)
269
280
  if (!this.displayFormatRegExp.test(this.datedisplay)) {
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)
281
+ this.datedisplay = this.formatDate(new Date(this.datedisplay), this.displayFormat, this.datedisplay)
282
+ this.iValue = this.formatDate(new Date(this.datedisplay), this.displayFormat, this.datedisplay)
272
283
  this.$emit('change', this.iValue)
273
284
  } else {
274
- this.changeValue(this.getDateFromValue(this.datedisplay, this.displayFormat),this.datedisplay)
285
+ this.changeValue(this.getDateFromValue(this.datedisplay, this.displayFormat), this.datedisplay)
275
286
  }
276
287
  }
277
288
  }, 100);
278
289
  },
279
290
  select(value) {
280
- this.changeValue(value,'')
291
+ this.changeValue(value, '')
281
292
  this.$refs.layer.close()
282
293
  },
283
- changeValue(value,oldVal) {
294
+ changeValue(value, oldVal) {
284
295
  this.$emit('beforeChange', value)
285
296
  if (!value) {
286
297
  this.clear()
@@ -289,7 +300,7 @@ export default {
289
300
  this.datedisplay = value.split(' ').length > 1 ? value.split(' ')[1] : value
290
301
  this.iValue = value.split(' ').length > 1 ? value.split(' ')[1] : value
291
302
  } else {
292
- value = this.formatDate(new Date(value), 'yyyy-MM-dd HH:mm:ss',value)
303
+ value = this.formatDate(new Date(value), 'yyyy-MM-dd HH:mm:ss', value)
293
304
  const flag = isNaN(new Date(value).getTime()) // 判断是否可以使用 2022-05 如果不可用,则替换为 2022/05
294
305
  if (flag) {
295
306
  value = value.replace(/-/g, '/')
@@ -303,8 +314,8 @@ export default {
303
314
  if (flag) {
304
315
  value = value.replace(/-/g, '/')
305
316
  }
306
- this.datedisplay = this.formatDate(new Date(value), this.displayFormat,oldVal)
307
- this.iValue = this.formatDate(new Date(value), this.valueFormat,oldVal)
317
+ this.datedisplay = this.formatDate(new Date(value), this.displayFormat, oldVal)
318
+ this.iValue = this.formatDate(new Date(value), this.valueFormat, oldVal)
308
319
  this.$emit('change', this.iValue)
309
320
  }
310
321
  },
@@ -395,7 +406,7 @@ export default {
395
406
  if (!yMatch) return
396
407
  return value.substr(yMatch.index, yMatch[0].length)
397
408
  },
398
- formatDate(date, fmt,value) {
409
+ formatDate(date, fmt, value) {
399
410
  if (date) {
400
411
  // 如果 this.type 不是 'datetime' 或 'time',检查 date 是否为有效的日期格式
401
412
  if (this.type !== 'datetime' && this.type !== 'time' && value) {
@@ -446,6 +457,9 @@ export default {
446
457
  },
447
458
  setDisabled(f) {
448
459
  this.disabled = f
460
+ },
461
+ focus() {
462
+ this.$refs.inputBox.focus()
449
463
  }
450
464
  }
451
465
  };
Binary file
Binary file
@@ -414,7 +414,7 @@ export default {
414
414
  this.disabled = val
415
415
  },
416
416
  type(val) {
417
- if (val === 'password') {
417
+ if (val === 'password' || val === 'number') {
418
418
  this.itype = val;
419
419
  } else {
420
420
  this.itype = 'text';
@@ -121,11 +121,11 @@
121
121
  </span>
122
122
  </span>
123
123
  </template>
124
- <to-input v-else ref="popupFilter" v-model="multipleFilterValue" :sp-chars="false" width="full" prevent-focus :placeholder="selected.filter(item => !item.hide).length > 0 ? '' : placeholder "></to-input>
124
+ <to-input v-else ref="popupFilter" v-model="multipleFilterValue" tabindex="-1" :sp-chars="false" width="full" prevent-focus :placeholder="selected.filter(item => !item.hide).length > 0 ? '' : placeholder "></to-input>
125
125
  </template>
126
126
  <template v-else>
127
- <to-input v-if="inputable" ref="popupInput" v-model="inputValue" :sp-chars="spChars" prevent-focus width="full" :placeholder="placeholder"></to-input>
128
- <to-input v-else ref="popupFilter" v-model="filterValue" :sp-chars="false" prevent-focus width="full" placeholder="筛选" @clear="filterClear"></to-input>
127
+ <to-input v-if="inputable" ref="popupInput" v-model="inputValue" tabindex="-1" :sp-chars="spChars" prevent-focus width="full" :placeholder="placeholder" @focus="inputFocus" @keyup="inputInput" @blur="inputBlur"></to-input>
128
+ <to-input v-else ref="popupFilter" v-model="filterValue" tabindex="-1" :sp-chars="false" prevent-focus width="full" placeholder="筛选" @clear="filterClear" @focus="filterFocus" @keyup="filterInput"></to-input>
129
129
  </template>
130
130
  </to-padding>
131
131
  </to-grid-item>
@@ -505,6 +505,7 @@ export default {
505
505
  focused: false,
506
506
  blurByLayer: false,
507
507
  options: [],
508
+ s_options: [],
508
509
  anotherOptions: [], // 只作用于手机端
509
510
  layerSlide: false,
510
511
  layerPosition: 'auto',
@@ -1002,6 +1003,7 @@ export default {
1002
1003
  arr.push(obj)
1003
1004
  }
1004
1005
  if (this.$phone && this.filterable) {
1006
+ this.s_options = arr.slice(0, 100)
1005
1007
  this.options = arr.slice(0, 100)
1006
1008
  this.anotherOptions = arr.slice(100)
1007
1009
  } else {
@@ -1010,6 +1012,7 @@ export default {
1010
1012
  } else {
1011
1013
  // 如果是手机端,则先取前 100 项,再拼接后面的
1012
1014
  if (this.$phone && this.filterable) {
1015
+ this.s_options = this.data.slice(0, 100)
1013
1016
  this.options = this.data.slice(0, 100)
1014
1017
  this.anotherOptions = this.data.slice(100)
1015
1018
  } else {
@@ -1200,7 +1203,7 @@ export default {
1200
1203
  this.$refs.popupFilter.focus()
1201
1204
  }
1202
1205
  this.$nextTick(() => {
1203
- this.options = this.options.concat(this.anotherOptions)
1206
+ this.options = this.s_options.concat(this.anotherOptions)
1204
1207
  })
1205
1208
  }, 500);
1206
1209
  }