@mdsfe/mds-ui 0.3.0-20 → 0.3.0-23

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 (63) hide show
  1. package/dist/_util/iconfont/index.js +1 -1
  2. package/dist/datepicker.js +356 -138
  3. package/dist/font/iconfont.06c8a26.woff +0 -0
  4. package/dist/font/iconfont.c9840a2.woff2 +0 -0
  5. package/dist/font/{iconfont.bf5c999.ttf → iconfont.dffa89c.ttf} +0 -0
  6. package/dist/index.js +1 -1
  7. package/dist/mds-ui.min.css +1 -1
  8. package/dist/mds-ui.min.js +374 -158
  9. package/dist/style/affix.css +1 -1
  10. package/dist/style/alert.css +1 -1
  11. package/dist/style/anchor.css +1 -1
  12. package/dist/style/avatar.css +1 -1
  13. package/dist/style/badge.css +1 -1
  14. package/dist/style/bordershadow.css +1 -1
  15. package/dist/style/breadcrumb.css +1 -1
  16. package/dist/style/button.css +1 -1
  17. package/dist/style/card.css +1 -1
  18. package/dist/style/carousel.css +1 -1
  19. package/dist/style/checkbox.css +1 -1
  20. package/dist/style/col.css +1 -1
  21. package/dist/style/collapse.css +1 -1
  22. package/dist/style/color.css +1 -1
  23. package/dist/style/datepicker.css +8 -1
  24. package/dist/style/divider.css +1 -1
  25. package/dist/style/drawer.css +1 -1
  26. package/dist/style/dropdown.css +1 -1
  27. package/dist/style/empty.css +1 -1
  28. package/dist/style/font.css +1 -1
  29. package/dist/style/form.css +1 -1
  30. package/dist/style/icon.css +1 -1
  31. package/dist/style/input.css +1 -1
  32. package/dist/style/inputnumber.css +1 -1
  33. package/dist/style/layout.css +1 -1
  34. package/dist/style/list.css +1 -1
  35. package/dist/style/loading.css +1 -1
  36. package/dist/style/menu.css +1 -1
  37. package/dist/style/modal.css +1 -1
  38. package/dist/style/notification.css +1 -1
  39. package/dist/style/pagination.css +1 -1
  40. package/dist/style/popconfirm.css +1 -1
  41. package/dist/style/popover.css +1 -1
  42. package/dist/style/progress.css +1 -1
  43. package/dist/style/radio.css +1 -1
  44. package/dist/style/rate.css +1 -1
  45. package/dist/style/row.css +1 -1
  46. package/dist/style/select.css +1 -1
  47. package/dist/style/slider.css +1 -1
  48. package/dist/style/slottable.css +1 -1
  49. package/dist/style/steps.css +1 -1
  50. package/dist/style/switch.css +1 -1
  51. package/dist/style/table.css +1 -1
  52. package/dist/style/tabs.css +1 -1
  53. package/dist/style/tag.css +1 -1
  54. package/dist/style/text.css +1 -1
  55. package/dist/style/timeline.css +1 -1
  56. package/dist/style/timepicker.css +1 -1
  57. package/dist/style/tooltip.css +1 -1
  58. package/dist/style/tree.css +1 -1
  59. package/dist/style/typography.css +1 -1
  60. package/dist/style/upload.css +1 -1
  61. package/package.json +1 -1
  62. package/dist/font/iconfont.ba42e6f.woff +0 -0
  63. package/dist/font/iconfont.d8e6666.woff2 +0 -0
@@ -4147,6 +4147,10 @@ var pickervue_type_script_lang_js_validator = function validator(val) {
4147
4147
  pickerType: {
4148
4148
  type: String,
4149
4149
  default: 'date'
4150
+ },
4151
+ appendToBody: {
4152
+ type: Boolean,
4153
+ default: true // 默认插入到 body
4150
4154
  }
4151
4155
  },
4152
4156
 
@@ -4544,31 +4548,46 @@ var pickervue_type_script_lang_js_validator = function validator(val) {
4544
4548
  }
4545
4549
  this.$emit('focus', this);
4546
4550
  },
4547
- hidePicker: function hidePicker() {
4548
- if (this.picker) {
4549
- this.picker.resetView && this.picker.resetView();
4550
- this.pickerVisible = this.picker.visible = false;
4551
- this.destroyPopper();
4552
- }
4553
- },
4551
+
4552
+
4553
+ // 修复 showPicker 方法
4554
4554
  showPicker: function showPicker() {
4555
4555
  var _this2 = this;
4556
4556
 
4557
4557
  if (this.$isServer) return;
4558
- if (!this.picker) {
4558
+
4559
+ // 如果面板已存在,先重置状态
4560
+ if (this.picker) {
4561
+ this.picker.resetView && this.picker.resetView();
4562
+ this.picker.visible = false;
4563
+ } else {
4564
+ // 面板不存在时才创建
4559
4565
  this.mountPicker();
4560
4566
  }
4567
+
4568
+ // 设置面板可见
4561
4569
  this.pickerVisible = this.picker.visible = true;
4562
4570
 
4571
+ // 确保面板在正确的位置
4572
+ this.ensurePanelPosition();
4573
+
4574
+ // 更新 Popper 定位
4563
4575
  this.updatePopper();
4564
4576
 
4577
+ // 重置面板状态
4565
4578
  this.picker.value = this.parsedValue;
4566
4579
  this.picker.resetView && this.picker.resetView();
4567
4580
 
4568
4581
  this.$nextTick(function () {
4569
4582
  _this2.picker.adjustSpinners && _this2.picker.adjustSpinners();
4583
+ // 再次确保位置正确并更新定位
4584
+ _this2.ensurePanelPosition();
4585
+ _this2.updatePopper();
4570
4586
  });
4571
4587
  },
4588
+
4589
+
4590
+ // 修复 mountPicker 方法
4572
4591
  mountPicker: function mountPicker() {
4573
4592
  var _this3 = this;
4574
4593
 
@@ -4576,16 +4595,25 @@ var pickervue_type_script_lang_js_validator = function validator(val) {
4576
4595
  this.picker = new Panel({
4577
4596
  propsData: {
4578
4597
  pickerType: this.type,
4579
- referenceElm: this.reference, // 关键:传递 referenceElm
4598
+ referenceElm: this.reference,
4580
4599
  popperClass: this.popperClass,
4581
- appendToBody: true,
4582
- placement: 'bottom-start' // 关键
4600
+ appendToBody: this.appendToBody, // 使用组件的 appendToBody 配置
4601
+ placement: this.placement
4583
4602
  }
4584
4603
  }).$mount();
4585
- // 只对非季度类型 appendChild
4604
+
4605
+ // 根据配置决定插入位置
4586
4606
  if (this.type !== 'quarter') {
4587
- this.$el.appendChild(this.picker.$el);
4607
+ if (this.appendToBody !== false) {
4608
+ // 插入到 body 下
4609
+ document.body.appendChild(this.picker.$el);
4610
+ } else {
4611
+ // 插入到当前元素下
4612
+ this.$el.appendChild(this.picker.$el);
4613
+ }
4588
4614
  }
4615
+
4616
+ // 设置面板属性
4589
4617
  this.picker.defaultValue = this.defaultValue;
4590
4618
  this.picker.defaultTime = this.defaultTime;
4591
4619
  this.picker.popperClass = this.popperClass;
@@ -4597,58 +4625,41 @@ var pickervue_type_script_lang_js_validator = function validator(val) {
4597
4625
  this.picker.arrowControl = this.arrowControl || this.timeArrowControl || false;
4598
4626
  this.picker.listenScroll = this.listenScroll;
4599
4627
  this.picker.step = this.step;
4628
+
4629
+ // 监听格式变化
4600
4630
  this.$watch('format', function (format) {
4601
4631
  _this3.picker.format = format;
4602
4632
  });
4603
4633
 
4604
- var updateOptions = function updateOptions() {
4605
- var options = _this3.pickerOptions;
4606
-
4607
- if (options && options.selectableRange) {
4608
- var ranges = options.selectableRange;
4609
- var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
4610
- var format = DEFAULT_FORMATS.timerange;
4611
-
4612
- ranges = Array.isArray(ranges) ? ranges : [ranges];
4613
- _this3.picker.selectableRange = ranges.map(function (range) {
4614
- return parser(range, format, _this3.rangeSeparator);
4615
- });
4616
- }
4617
-
4618
- for (var option in options) {
4619
- if (options.hasOwnProperty(option) &&
4620
- // 忽略 time-picker 的该配置项
4621
- option !== 'selectableRange') {
4622
- _this3.picker[option] = options[option];
4623
- }
4624
- }
4625
-
4626
- // main format must prevail over undocumented pickerOptions.format
4627
- if (_this3.format) {
4628
- _this3.picker.format = _this3.format;
4629
- }
4630
- };
4631
- updateOptions();
4632
- this.unwatchPickerOptions = this.$watch('pickerOptions', function () {
4633
- return updateOptions();
4634
- }, { deep: true });
4635
- // this.$el.appendChild(this.picker.$el)
4636
- this.picker.resetView && this.picker.resetView();
4634
+ // 更新选项
4635
+ this.updatePickerOptions();
4637
4636
 
4637
+ // 设置事件监听
4638
4638
  this.picker.$on('dodestroy', this.doDestroy);
4639
+
4640
+ // 修复 pick 事件处理
4639
4641
  this.picker.$on('pick', function () {
4640
4642
  var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
4641
4643
  var visible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
4642
4644
 
4643
4645
  _this3.userInput = null;
4644
- _this3.pickerVisible = _this3.picker.visible = visible;
4646
+
4647
+ if (visible === false) {
4648
+ // 隐藏面板但不销毁
4649
+ _this3.pickerVisible = false;
4650
+ _this3.picker.visible = false;
4651
+ _this3.hidePicker();
4652
+ } else {
4653
+ // 保持面板可见
4654
+ _this3.pickerVisible = true;
4655
+ _this3.picker.visible = true;
4656
+ }
4657
+
4645
4658
  _this3.emitInput(date);
4646
4659
  _this3.picker.resetView && _this3.picker.resetView();
4647
- if (!visible) {
4648
- _this3.unmountPicker();
4649
- }
4650
4660
  });
4651
4661
 
4662
+ // 其他事件监听保持不变
4652
4663
  this.picker.$on('select-range', function (start, end, pos) {
4653
4664
  if (_this3.refInput.length === 0) return;
4654
4665
  if (!pos || pos === 'min') {
@@ -4660,14 +4671,99 @@ var pickervue_type_script_lang_js_validator = function validator(val) {
4660
4671
  }
4661
4672
  });
4662
4673
  },
4674
+
4675
+
4676
+ // 新增方法:更新面板选项
4677
+ updatePickerOptions: function updatePickerOptions() {
4678
+ var _this4 = this;
4679
+
4680
+ var options = this.pickerOptions;
4681
+
4682
+ if (options && options.selectableRange) {
4683
+ var ranges = options.selectableRange;
4684
+ var parser = TYPE_VALUE_RESOLVER_MAP.datetimerange.parser;
4685
+ var format = DEFAULT_FORMATS.timerange;
4686
+
4687
+ ranges = Array.isArray(ranges) ? ranges : [ranges];
4688
+ this.picker.selectableRange = ranges.map(function (range) {
4689
+ return parser(range, format, _this4.rangeSeparator);
4690
+ });
4691
+ }
4692
+
4693
+ for (var option in options) {
4694
+ if (options.hasOwnProperty(option) && option !== 'selectableRange') {
4695
+ this.picker[option] = options[option];
4696
+ }
4697
+ }
4698
+
4699
+ // 主格式优先
4700
+ if (this.format) {
4701
+ this.picker.format = this.format;
4702
+ }
4703
+ },
4704
+
4705
+
4706
+ // 修复 hidePicker 方法
4707
+ hidePicker: function hidePicker() {
4708
+ if (this.picker) {
4709
+ this.picker.resetView && this.picker.resetView();
4710
+ this.pickerVisible = this.picker.visible = false;
4711
+
4712
+ // 不要立即销毁面板,只是隐藏
4713
+ // this.destroyPopper()
4714
+
4715
+ // 确保面板位置正确
4716
+ this.ensurePanelPosition();
4717
+ }
4718
+ },
4719
+
4720
+
4721
+ // 确保面板位置正确的方法
4722
+ ensurePanelPosition: function ensurePanelPosition() {
4723
+ var _this5 = this;
4724
+
4725
+ if (!this.picker || !this.picker.$el) return;
4726
+
4727
+ var panelEl = this.picker.$el;
4728
+ var currentParent = panelEl.parentNode;
4729
+
4730
+ // 检查面板是否在正确的位置
4731
+ if (this.appendToBody !== false && currentParent !== document.body) {
4732
+ // 面板不在 body 下,需要移动到 body
4733
+ if (currentParent) {
4734
+ currentParent.removeChild(panelEl);
4735
+ }
4736
+ document.body.appendChild(panelEl);
4737
+
4738
+ // 重新计算定位
4739
+ this.$nextTick(function () {
4740
+ _this5.updatePopper();
4741
+ });
4742
+ } else if (this.appendToBody === false && currentParent !== this.$el) {
4743
+ // 面板不在当前元素下,需要移动
4744
+ if (currentParent) {
4745
+ currentParent.removeChild(panelEl);
4746
+ }
4747
+ this.$el.appendChild(panelEl);
4748
+ }
4749
+ },
4750
+
4751
+
4752
+ // 修复 unmountPicker 方法
4663
4753
  unmountPicker: function unmountPicker() {
4664
4754
  if (this.picker) {
4755
+ // 确保面板从正确的父元素中移除
4756
+ if (this.picker.$el && this.picker.$el.parentNode) {
4757
+ this.picker.$el.parentNode.removeChild(this.picker.$el);
4758
+ }
4759
+
4665
4760
  this.picker.$destroy();
4666
4761
  this.picker.$off();
4762
+
4667
4763
  if (typeof this.unwatchPickerOptions === 'function') {
4668
4764
  this.unwatchPickerOptions();
4669
4765
  }
4670
- if (this.picker.$el.parentNode) this.picker.$el.parentNode.removeChild(this.picker.$el);
4766
+
4671
4767
  this.picker = null;
4672
4768
  }
4673
4769
  },
@@ -4716,6 +4812,11 @@ var pickervue_type_script_lang_js_validator = function validator(val) {
4716
4812
  var selectedMonth = this.value.getMonth();
4717
4813
  return selectedYear === this.currentYear && selectedMonth >= quarter.startMonth && selectedMonth <= quarter.endMonth;
4718
4814
  }
4815
+ },
4816
+
4817
+ // 生命周期钩子
4818
+ beforeDestroy: function beforeDestroy() {
4819
+ this.unmountPicker();
4719
4820
  }
4720
4821
  });
4721
4822
  // CONCATENATED MODULE: ./components/datepicker/picker/picker.vue?vue&type=script&lang=js&
@@ -7078,7 +7179,8 @@ var date_tablevue_type_script_lang_js_getDateTimestamp = function getDateTimesta
7078
7179
  // return a new array if modification occurs
7079
7180
  // return the original array otherwise
7080
7181
  var date_tablevue_type_script_lang_js_removeFromArray = function removeFromArray(arr, pred) {
7081
- var idx = typeof pred === 'function' ? Object(util["b" /* arrayFindIndex */])(arr, pred) : arr.indexOf(pred);
7182
+ var idx = typeof pred === 'function' ? arr.findIndex(pred) // 使用原生 findIndex 方法
7183
+ : arr.indexOf(pred);
7082
7184
  return idx >= 0 ? [].concat(toConsumableArray_default()(arr.slice(0, idx)), toConsumableArray_default()(arr.slice(idx + 1))) : arr;
7083
7185
  };
7084
7186
 
@@ -7157,27 +7259,29 @@ var date_tablevue_type_script_lang_js_removeFromArray = function removeFromArray
7157
7259
  rows: function rows() {
7158
7260
  var _this = this;
7159
7261
 
7160
- // TODO: refactory rows / getCellClasses
7262
+ // 确保每次计算都从干净的状态开始
7161
7263
  var date = new Date(this.year, this.month, 1);
7162
- var day = getFirstDayOfMonth(date); // day of first day
7264
+ var day = getFirstDayOfMonth(date);
7163
7265
  var dateCountOfMonth = getDayCountOfMonth(date.getFullYear(), date.getMonth());
7164
7266
  var dateCountOfLastMonth = getDayCountOfMonth(date.getFullYear(), date.getMonth() === 0 ? 11 : date.getMonth() - 1);
7165
7267
 
7166
7268
  day = day === 0 ? 7 : day;
7167
-
7168
7269
  var offset = this.offsetDay;
7169
7270
  var rows = this.tableRows;
7170
7271
  var count = 1;
7171
-
7172
7272
  var startDate = this.startDate;
7173
7273
  var disabledDate = this.disabledDate;
7174
7274
  var cellClassName = this.cellClassName;
7275
+
7276
+ // 关键修复:确保 selectedDate 是当前有效的选择状态
7175
7277
  var selectedDate = this.selectionMode === 'dates' ? Object(util["c" /* coerceTruthyValueToArray */])(this.value) : [];
7278
+
7176
7279
  var now = date_tablevue_type_script_lang_js_getDateTimestamp(new Date());
7177
7280
 
7178
7281
  for (var i = 0; i < 6; i++) {
7179
7282
  var row = rows[i];
7180
7283
 
7284
+ // 重置行状态
7181
7285
  if (this.showWeekNumber) {
7182
7286
  if (!row[0]) {
7183
7287
  row[0] = {
@@ -7189,33 +7293,51 @@ var date_tablevue_type_script_lang_js_removeFromArray = function removeFromArray
7189
7293
 
7190
7294
  var _loop = function _loop(j) {
7191
7295
  var cell = row[_this.showWeekNumber ? j + 1 : j];
7192
- if (!cell) {
7193
- cell = {
7194
- row: i,
7195
- column: j,
7196
- type: 'normal',
7197
- inRange: false,
7198
- start: false,
7199
- end: false
7200
- };
7201
- }
7202
7296
 
7203
- cell.type = 'normal';
7297
+ // 关键修复:每次都创建新的 cell 对象,避免状态污染
7298
+ cell = {
7299
+ row: i,
7300
+ column: j,
7301
+ type: 'normal',
7302
+ inRange: false,
7303
+ start: false,
7304
+ end: false,
7305
+ disabled: false,
7306
+ selected: false,
7307
+ customClass: null
7308
+ };
7204
7309
 
7205
7310
  var index = i * 7 + j;
7206
7311
  var time = nextDate(startDate, index - offset).getTime();
7207
- cell.inRange = time >= date_tablevue_type_script_lang_js_getDateTimestamp(_this.minDate) && time <= date_tablevue_type_script_lang_js_getDateTimestamp(_this.maxDate);
7208
- cell.start = _this.minDate && time === date_tablevue_type_script_lang_js_getDateTimestamp(_this.minDate);
7209
- cell.end = _this.maxDate && time === date_tablevue_type_script_lang_js_getDateTimestamp(_this.maxDate);
7210
- var isToday = time === now;
7312
+ var cellDate = new Date(time);
7313
+
7314
+ // 正确计算范围状态
7315
+ if (_this.minDate && _this.maxDate) {
7316
+ var minTime = date_tablevue_type_script_lang_js_getDateTimestamp(_this.minDate);
7317
+ var maxTime = date_tablevue_type_script_lang_js_getDateTimestamp(_this.maxDate);
7318
+ cell.inRange = time >= minTime && time <= maxTime;
7319
+ cell.start = time === minTime;
7320
+ cell.end = time === maxTime;
7321
+ }
7211
7322
 
7323
+ // 正确计算选中状态
7324
+ if (_this.selectionMode === 'dates') {
7325
+ cell.selected = selectedDate.some(function (date) {
7326
+ return date && date.getTime() === cellDate.getTime();
7327
+ });
7328
+ } else if (_this.selectionMode === 'day' && _this.value) {
7329
+ cell.selected = _this.value.getTime() === cellDate.getTime();
7330
+ }
7331
+
7332
+ // 其他状态计算...
7333
+ var isToday = time === now;
7212
7334
  if (isToday) {
7213
7335
  cell.type = 'today';
7214
7336
  }
7215
7337
 
7338
+ // 日期文本计算...
7216
7339
  if (i >= 0 && i <= 1) {
7217
7340
  var numberOfDaysFromPreviousMonth = day + offset < 0 ? 7 + day + offset : day + offset;
7218
-
7219
7341
  if (j + i * 7 >= numberOfDaysFromPreviousMonth) {
7220
7342
  cell.text = count++;
7221
7343
  } else {
@@ -7231,29 +7353,19 @@ var date_tablevue_type_script_lang_js_removeFromArray = function removeFromArray
7231
7353
  }
7232
7354
  }
7233
7355
 
7234
- var cellDate = new Date(time);
7356
+ // 禁用状态
7235
7357
  cell.disabled = typeof disabledDate === 'function' && disabledDate(cellDate);
7236
- cell.selected = Object(util["a" /* arrayFind */])(selectedDate, function (date) {
7237
- return (date && date.getTime()) === (cellDate && cellDate.getTime());
7238
- });
7358
+
7359
+ // 自定义类名
7239
7360
  cell.customClass = typeof cellClassName === 'function' && cellClassName(cellDate);
7361
+
7362
+ // 更新行数据
7240
7363
  _this.$set(row, _this.showWeekNumber ? j + 1 : j, cell);
7241
7364
  };
7242
7365
 
7243
7366
  for (var j = 0; j < 7; j++) {
7244
7367
  _loop(j);
7245
7368
  }
7246
-
7247
- if (this.selectionMode === 'week') {
7248
- var start = this.showWeekNumber ? 1 : 0;
7249
- var end = this.showWeekNumber ? 7 : 6;
7250
- var isWeekActive = this.isWeekActive(row[start + 1]);
7251
-
7252
- row[start].inRange = isWeekActive;
7253
- row[start].start = isWeekActive;
7254
- row[end].inRange = isWeekActive;
7255
- row[end].end = isWeekActive;
7256
- }
7257
7369
  }
7258
7370
 
7259
7371
  return rows;
@@ -7385,11 +7497,11 @@ var date_tablevue_type_script_lang_js_removeFromArray = function removeFromArray
7385
7497
 
7386
7498
  var _cell = row[j];
7387
7499
  var index = i * 7 + j + (this.showWeekNumber ? -1 : 0);
7388
- var time = nextDate(startDate, index - this.offsetDay).getTime();
7500
+ var _time = nextDate(startDate, index - this.offsetDay).getTime();
7389
7501
 
7390
- _cell.inRange = minDate && time >= minDate && time <= maxDate;
7391
- _cell.start = minDate && time === minDate;
7392
- _cell.end = maxDate && time === maxDate;
7502
+ _cell.inRange = minDate && _time >= minDate && _time <= maxDate;
7503
+ _cell.start = minDate && _time === minDate;
7504
+ _cell.end = maxDate && _time === maxDate;
7393
7505
  }
7394
7506
  }
7395
7507
  },
@@ -8575,6 +8687,7 @@ var date_rangevue_type_template_id_6eca7cf8_render = function () {
8575
8687
  { class: this.prefixCls + "-picker-panel-content" },
8576
8688
  [
8577
8689
  _c("date-table", {
8690
+ ref: "leftDateTable",
8578
8691
  attrs: {
8579
8692
  "selection-mode": "range",
8580
8693
  date: _vm.leftDate,
@@ -8734,6 +8847,7 @@ var date_rangevue_type_template_id_6eca7cf8_render = function () {
8734
8847
  { class: this.prefixCls + "-picker-panel-content" },
8735
8848
  [
8736
8849
  _c("date-table", {
8850
+ ref: "rightDateTable",
8737
8851
  attrs: {
8738
8852
  "selection-mode": "range",
8739
8853
  date: _vm.rightDate,
@@ -9676,6 +9790,8 @@ datetime_select_component.options.__file = "components/datepicker/picker/datetim
9676
9790
  //
9677
9791
  //
9678
9792
  //
9793
+ //
9794
+ //
9679
9795
 
9680
9796
 
9681
9797
 
@@ -9686,6 +9802,7 @@ datetime_select_component.options.__file = "components/datepicker/picker/datetim
9686
9802
 
9687
9803
 
9688
9804
 
9805
+ // 确保 calcDefaultValue 函数可用
9689
9806
  var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultValue(defaultValue) {
9690
9807
  if (Array.isArray(defaultValue)) {
9691
9808
  return [new Date(defaultValue[0]), new Date(defaultValue[1])];
@@ -9834,39 +9951,76 @@ var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultVal
9834
9951
 
9835
9952
  watch: {
9836
9953
  visible: function visible(val) {
9837
- val && (this.timePickerVisible = false);
9838
- },
9839
- minDate: function minDate(val) {
9840
9954
  var _this = this;
9841
9955
 
9842
- this.dateUserInput.min = null;
9843
- this.timeUserInput.min = null;
9844
- this.$nextTick(function () {
9845
- if (_this.$refs.maxTimePicker && _this.maxDate && _this.maxDate < _this.minDate) {
9846
- var format = 'HH:mm:ss';
9847
- _this.$refs.maxTimePicker.selectableRange = [[Object(dateUtil_["parseDate"])(Object(dateUtil_["formatDate"])(_this.minDate, format), format), Object(dateUtil_["parseDate"])('23:59:59', format)]];
9848
- }
9849
- });
9850
- if (val && this.$refs.minTimePicker) {
9851
- this.$refs.minTimePicker.date = val;
9852
- this.$refs.minTimePicker.value = val;
9956
+ if (val) {
9957
+ this.timePickerVisible = false;
9958
+ // 当面板显示时重置状态
9959
+ this.resetView();
9960
+ // 强制重新计算布局
9853
9961
  this.$nextTick(function () {
9854
- _this.$refs.maxTimePicker.adjustSpinners();
9962
+ _this.$forceUpdate();
9855
9963
  });
9856
9964
  }
9857
9965
  },
9858
- maxDate: function maxDate(val) {
9966
+
9967
+
9968
+ // 分别监听 minDate 和 maxDate
9969
+ minDate: function minDate(newVal, oldVal) {
9859
9970
  var _this2 = this;
9860
9971
 
9861
- this.dateUserInput.max = null;
9862
- this.timeUserInput.max = null;
9863
- if (val && this.$refs.maxTimePicker) {
9864
- this.$refs.maxTimePicker.date = val;
9865
- this.$refs.maxTimePicker.value = val;
9972
+ if (newVal !== oldVal && this.minDate) {
9973
+ this.dateUserInput.min = null;
9974
+ this.timeUserInput.min = null;
9866
9975
  this.$nextTick(function () {
9867
- _this2.$refs.minTimePicker.adjustSpinners();
9976
+ if (_this2.$refs.maxTimePicker && _this2.maxDate && _this2.maxDate < _this2.minDate) {
9977
+ var format = 'HH:mm:ss';
9978
+ _this2.$refs.maxTimePicker.selectableRange = [[Object(dateUtil_["parseDate"])(Object(dateUtil_["formatDate"])(_this2.minDate, format), format), Object(dateUtil_["parseDate"])('23:59:59', format)]];
9979
+ }
9868
9980
  });
9981
+ if (this.$refs.minTimePicker) {
9982
+ this.$refs.minTimePicker.date = this.minDate;
9983
+ this.$refs.minTimePicker.value = this.minDate;
9984
+ this.$nextTick(function () {
9985
+ _this2.$refs.maxTimePicker && _this2.$refs.maxTimePicker.adjustSpinners();
9986
+ });
9987
+ }
9988
+ }
9989
+
9990
+ // 强制子组件重新计算状态
9991
+ this.$nextTick(function () {
9992
+ if (_this2.$refs.leftDateTable) {
9993
+ _this2.$refs.leftDateTable.$forceUpdate();
9994
+ }
9995
+ if (_this2.$refs.rightDateTable) {
9996
+ _this2.$refs.rightDateTable.$forceUpdate();
9997
+ }
9998
+ });
9999
+ },
10000
+ maxDate: function maxDate(newVal, oldVal) {
10001
+ var _this3 = this;
10002
+
10003
+ if (newVal !== oldVal && this.maxDate) {
10004
+ this.dateUserInput.max = null;
10005
+ this.timeUserInput.max = null;
10006
+ if (this.$refs.maxTimePicker) {
10007
+ this.$refs.maxTimePicker.date = this.maxDate;
10008
+ this.$refs.maxTimePicker.value = this.maxDate;
10009
+ this.$nextTick(function () {
10010
+ _this3.$refs.minTimePicker && _this3.$refs.minTimePicker.adjustSpinners();
10011
+ });
10012
+ }
9869
10013
  }
10014
+
10015
+ // 强制子组件重新计算状态
10016
+ this.$nextTick(function () {
10017
+ if (_this3.$refs.leftDateTable) {
10018
+ _this3.$refs.leftDateTable.$forceUpdate();
10019
+ }
10020
+ if (_this3.$refs.rightDateTable) {
10021
+ _this3.$refs.rightDateTable.$forceUpdate();
10022
+ }
10023
+ });
9870
10024
  },
9871
10025
  value: function value(newVal) {
9872
10026
  if (!newVal) {
@@ -9904,24 +10058,28 @@ var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultVal
9904
10058
  }
9905
10059
  },
9906
10060
  format: function format() {
9907
- this.$refs.minTimePicker.format = this.timeFormat;
9908
- this.$refs.maxTimePicker.format = this.timeFormat;
10061
+ if (this.$refs.minTimePicker) {
10062
+ this.$refs.minTimePicker.format = this.timeFormat;
10063
+ }
10064
+ if (this.$refs.maxTimePicker) {
10065
+ this.$refs.maxTimePicker.format = this.timeFormat;
10066
+ }
9909
10067
  }
9910
10068
  },
9911
10069
 
9912
10070
  methods: {
9913
10071
  selectTime: function selectTime() {
9914
- var _this3 = this;
10072
+ var _this4 = this;
9915
10073
 
9916
10074
  this.timePickerVisible = !this.timePickerVisible;
9917
10075
  if (this.timePickerVisible) {
9918
10076
  this.$nextTick(function () {
9919
- _this3.$refs.maxTimePicker.date = _this3.maxDate;
9920
- _this3.$refs.maxTimePicker.value = _this3.maxDate;
9921
- _this3.$refs.maxTimePicker.adjustSpinners();
9922
- _this3.$refs.minTimePicker.date = _this3.minDate;
9923
- _this3.$refs.minTimePicker.value = _this3.minDate;
9924
- _this3.$refs.minTimePicker.adjustSpinners();
10077
+ _this4.$refs.maxTimePicker.date = _this4.maxDate;
10078
+ _this4.$refs.maxTimePicker.value = _this4.maxDate;
10079
+ _this4.$refs.maxTimePicker.adjustSpinners();
10080
+ _this4.$refs.minTimePicker.date = _this4.minDate;
10081
+ _this4.$refs.minTimePicker.value = _this4.minDate;
10082
+ _this4.$refs.minTimePicker.adjustSpinners();
9925
10083
  });
9926
10084
  }
9927
10085
  },
@@ -9930,12 +10088,36 @@ var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultVal
9930
10088
  this.maxDate = null;
9931
10089
  this.leftDate = date_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
9932
10090
  this.rightDate = Object(dateUtil_["nextMonth"])(this.leftDate);
10091
+
10092
+ // 重置 rangeState
10093
+ this.rangeState = {
10094
+ endDate: null,
10095
+ selecting: false,
10096
+ row: null,
10097
+ column: null
10098
+ };
9933
10099
  this.$emit('pick', null);
9934
10100
  },
9935
10101
  handleChangeRange: function handleChangeRange(val) {
9936
- this.minDate = val.minDate;
9937
- this.maxDate = val.maxDate;
9938
- this.rangeState = val.rangeState;
10102
+ var _this5 = this;
10103
+
10104
+ // 确保状态一致性
10105
+ if (val.minDate && val.maxDate) {
10106
+ this.minDate = new Date(val.minDate);
10107
+ this.maxDate = new Date(val.maxDate);
10108
+ }
10109
+
10110
+ // 更新 rangeState,确保所有字段都被正确设置
10111
+ this.rangeState = {
10112
+ endDate: val.rangeState ? val.rangeState.endDate : null,
10113
+ selecting: val.rangeState ? val.rangeState.selecting : false,
10114
+ row: val.rangeState ? val.rangeState.row : null,
10115
+ column: val.rangeState ? val.rangeState.column : null
10116
+
10117
+ // 强制重新计算 date-table 的状态
10118
+ };this.$nextTick(function () {
10119
+ _this5.$forceUpdate();
10120
+ });
9939
10121
  },
9940
10122
  handleDateInput: function handleDateInput(value, type) {
9941
10123
  this.dateUserInput[type] = value;
@@ -9978,7 +10160,7 @@ var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultVal
9978
10160
  }
9979
10161
  },
9980
10162
  handleTimeInput: function handleTimeInput(value, type) {
9981
- var _this4 = this;
10163
+ var _this6 = this;
9982
10164
 
9983
10165
  this.timeUserInput[type] = value;
9984
10166
  if (value.length !== this.timeFormat.length) return;
@@ -9988,12 +10170,12 @@ var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultVal
9988
10170
  if (type === 'min') {
9989
10171
  this.minDate = Object(dateUtil_["modifyTime"])(this.minDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
9990
10172
  this.$nextTick(function (_) {
9991
- return _this4.$refs.minTimePicker.adjustSpinners();
10173
+ return _this6.$refs.minTimePicker.adjustSpinners();
9992
10174
  });
9993
10175
  } else {
9994
10176
  this.maxDate = Object(dateUtil_["modifyTime"])(this.maxDate, parsedValue.getHours(), parsedValue.getMinutes(), parsedValue.getSeconds());
9995
10177
  this.$nextTick(function (_) {
9996
- return _this4.$refs.maxTimePicker.adjustSpinners();
10178
+ return _this6.$refs.maxTimePicker.adjustSpinners();
9997
10179
  });
9998
10180
  }
9999
10181
  }
@@ -10017,7 +10199,7 @@ var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultVal
10017
10199
  }
10018
10200
  },
10019
10201
  handleRangePick: function handleRangePick(val) {
10020
- var _this5 = this;
10202
+ var _this7 = this;
10021
10203
 
10022
10204
  var close = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
10023
10205
 
@@ -10034,8 +10216,8 @@ var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultVal
10034
10216
 
10035
10217
  // workaround for https://github.com/ElemeFE/element/issues/7539, should remove this block when we don't have to care about Chromium 55 - 57
10036
10218
  setTimeout(function () {
10037
- _this5.maxDate = maxDate;
10038
- _this5.minDate = minDate;
10219
+ _this7.maxDate = maxDate;
10220
+ _this7.minDate = minDate;
10039
10221
  }, 10);
10040
10222
  if (!close || this.showTime) return;
10041
10223
  this.handleConfirm();
@@ -10135,14 +10317,50 @@ var date_rangevue_type_script_lang_js_calcDefaultValue = function calcDefaultVal
10135
10317
  return Array.isArray(value) && value && value[0] && value[1] && Object(dateUtil_["isDate"])(value[0]) && Object(dateUtil_["isDate"])(value[1]) && value[0].getTime() <= value[1].getTime() && (typeof this.disabledDate === 'function' ? !this.disabledDate(value[0]) && !this.disabledDate(value[1]) : true);
10136
10318
  },
10137
10319
  resetView: function resetView() {
10138
- // NOTE: this is a hack to reset {min, max}Date on picker open.
10139
- // TODO: correct way of doing so is to refactor {min, max}Date to be dependent on value and internal selection state
10140
- // an alternative would be resetView whenever picker becomes visible, should also investigate date-panel's resetView
10141
- if (this.minDate && this.maxDate == null) {
10142
- this.rangeState.selecting = false;
10320
+ var _this8 = this;
10321
+
10322
+ // 完全重置所有状态
10323
+ this.rangeState = {
10324
+ endDate: null,
10325
+ selecting: false,
10326
+ row: null,
10327
+ column: null
10328
+
10329
+ // 重置日期状态
10330
+ };if (this.value && Array.isArray(this.value) && this.value.length === 2) {
10331
+ this.minDate = new Date(this.value[0]);
10332
+ this.maxDate = new Date(this.value[1]);
10333
+
10334
+ // 确保左右面板日期正确
10335
+ this.leftDate = new Date(this.value[0]);
10336
+ if (this.unlinkPanels) {
10337
+ this.rightDate = new Date(this.value[1]);
10338
+ } else {
10339
+ this.rightDate = Object(dateUtil_["nextMonth"])(this.leftDate);
10340
+ }
10341
+ } else {
10342
+ // 如果没有值,重置为默认状态
10343
+ this.minDate = null;
10344
+ this.maxDate = null;
10345
+ this.leftDate = date_rangevue_type_script_lang_js_calcDefaultValue(this.defaultValue)[0];
10346
+ this.rightDate = Object(dateUtil_["nextMonth"])(this.leftDate);
10143
10347
  }
10144
- this.minDate = this.value && Object(dateUtil_["isDate"])(this.value[0]) ? new Date(this.value[0]) : null;
10145
- this.maxDate = this.value && Object(dateUtil_["isDate"])(this.value[0]) ? new Date(this.value[1]) : null;
10348
+
10349
+ // 重置用户输入状态
10350
+ this.dateUserInput = { min: null, max: null };
10351
+ this.timeUserInput = { min: null, max: null
10352
+
10353
+ // 强制重新渲染所有子组件
10354
+ };this.$nextTick(function () {
10355
+ // 通知子组件重置状态
10356
+ if (_this8.$refs.leftDateTable) {
10357
+ _this8.$refs.leftDateTable.$forceUpdate();
10358
+ }
10359
+ if (_this8.$refs.rightDateTable) {
10360
+ _this8.$refs.rightDateTable.$forceUpdate();
10361
+ }
10362
+ _this8.$forceUpdate();
10363
+ });
10146
10364
  }
10147
10365
  },
10148
10366