vxe-pc-ui 4.15.5 → 4.15.7

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 (59) hide show
  1. package/dist/all.esm.js +84 -44
  2. package/dist/style.css +1 -1
  3. package/dist/style.min.css +1 -1
  4. package/es/cascader/src/cascader.js +2 -2
  5. package/es/date-panel/src/util.js +16 -0
  6. package/es/date-picker/src/date-picker.js +56 -34
  7. package/es/icon/style.css +1 -1
  8. package/es/pulldown/src/pulldown.js +3 -3
  9. package/es/style.css +1 -1
  10. package/es/style.min.css +1 -1
  11. package/es/table-select/src/table-select.js +1 -1
  12. package/es/tree-select/src/tree-select.js +3 -3
  13. package/es/ui/index.js +3 -1
  14. package/es/ui/src/log.js +1 -1
  15. package/lib/cascader/src/cascader.js +2 -2
  16. package/lib/cascader/src/cascader.min.js +1 -1
  17. package/lib/date-panel/src/util.js +17 -0
  18. package/lib/date-panel/src/util.min.js +1 -1
  19. package/lib/date-picker/src/date-picker.js +62 -30
  20. package/lib/date-picker/src/date-picker.min.js +1 -1
  21. package/lib/icon/style/style.css +1 -1
  22. package/lib/icon/style/style.min.css +1 -1
  23. package/lib/index.umd.js +92 -41
  24. package/lib/index.umd.min.js +1 -1
  25. package/lib/pulldown/src/pulldown.js +3 -3
  26. package/lib/pulldown/src/pulldown.min.js +1 -1
  27. package/lib/style.css +1 -1
  28. package/lib/style.min.css +1 -1
  29. package/lib/table-select/src/table-select.js +1 -1
  30. package/lib/table-select/src/table-select.min.js +1 -1
  31. package/lib/tree-select/src/tree-select.js +3 -3
  32. package/lib/tree-select/src/tree-select.min.js +1 -1
  33. package/lib/ui/index.js +3 -1
  34. package/lib/ui/index.min.js +1 -1
  35. package/lib/ui/src/log.js +1 -1
  36. package/lib/ui/src/log.min.js +1 -1
  37. package/package.json +1 -1
  38. package/packages/cascader/src/cascader.ts +2 -2
  39. package/packages/date-panel/src/util.ts +18 -0
  40. package/packages/date-picker/src/date-picker.ts +62 -31
  41. package/packages/pulldown/src/pulldown.ts +3 -3
  42. package/packages/table-select/src/table-select.ts +1 -1
  43. package/packages/tree-select/src/tree-select.ts +3 -3
  44. package/packages/ui/index.ts +2 -0
  45. package/types/components/date-panel.d.ts +6 -6
  46. package/types/components/date-picker.d.ts +4 -0
  47. package/types/components/table.d.ts +16 -2
  48. /package/es/icon/{iconfont.1781979589724.ttf → iconfont.1782112308661.ttf} +0 -0
  49. /package/es/icon/{iconfont.1781979589724.woff → iconfont.1782112308661.woff} +0 -0
  50. /package/es/icon/{iconfont.1781979589724.woff2 → iconfont.1782112308661.woff2} +0 -0
  51. /package/es/{iconfont.1781979589724.ttf → iconfont.1782112308661.ttf} +0 -0
  52. /package/es/{iconfont.1781979589724.woff → iconfont.1782112308661.woff} +0 -0
  53. /package/es/{iconfont.1781979589724.woff2 → iconfont.1782112308661.woff2} +0 -0
  54. /package/lib/icon/style/{iconfont.1781979589724.ttf → iconfont.1782112308661.ttf} +0 -0
  55. /package/lib/icon/style/{iconfont.1781979589724.woff → iconfont.1782112308661.woff} +0 -0
  56. /package/lib/icon/style/{iconfont.1781979589724.woff2 → iconfont.1782112308661.woff2} +0 -0
  57. /package/lib/{iconfont.1781979589724.ttf → iconfont.1782112308661.ttf} +0 -0
  58. /package/lib/{iconfont.1781979589724.woff → iconfont.1782112308661.woff} +0 -0
  59. /package/lib/{iconfont.1781979589724.woff2 → iconfont.1782112308661.woff2} +0 -0
package/dist/all.esm.js CHANGED
@@ -81,7 +81,7 @@ function checkDynamic() {
81
81
  }
82
82
 
83
83
  const { log } = VxeUI;
84
- const uiVersion = `ui v${"4.15.5"}`;
84
+ const uiVersion = `ui v${"4.15.7"}`;
85
85
  function createComponentLog(name) {
86
86
  const tableVersion = VxeUI.tableVersion ? `table v${VxeUI.tableVersion}` : '';
87
87
  const ganttVersion = VxeUI.ganttVersion ? `gantt v${VxeUI.ganttVersion}` : '';
@@ -94,7 +94,7 @@ function createComponentLog(name) {
94
94
  const warnLog$b = log.create('warn', uiVersion);
95
95
  log.create('error', uiVersion);
96
96
 
97
- const version = "4.15.5";
97
+ const version = "4.15.7";
98
98
  VxeUI.uiVersion = version;
99
99
  VxeUI.dynamicApp = dynamicApp;
100
100
  function config(options) {
@@ -197,6 +197,8 @@ setConfig$1({
197
197
  datePicker: {
198
198
  // size: null,
199
199
  // transfer: false,
200
+ startDate: new Date(1900, 0, 1),
201
+ endDate: new Date(2100, 0, 1),
200
202
  shortcutConfig: {
201
203
  // position: 'left',
202
204
  align: 'left',
@@ -4668,6 +4670,22 @@ function isAllSameChar(str, char) {
4668
4670
  }
4669
4671
  return true;
4670
4672
  }
4673
+ function checkDateFormat(numStr, formatKey) {
4674
+ const numVal = XEUtils.toNumber(numStr);
4675
+ switch (formatKey) {
4676
+ case 'yyyy':
4677
+ return (numVal >= 9999 ? 9999 : (numVal <= 0 ? 0 : numVal));
4678
+ case 'MM':
4679
+ return (numVal >= 12 ? 12 : (numVal <= 0 ? 0 : numVal));
4680
+ case 'dd':
4681
+ return (numVal >= 31 ? 31 : (numVal <= 0 ? 0 : numVal));
4682
+ case 'HH':
4683
+ case 'mm':
4684
+ case 'ss':
4685
+ return (numVal >= 59 ? 59 : (numVal <= 0 ? 0 : numVal));
4686
+ }
4687
+ return numVal;
4688
+ }
4671
4689
 
4672
4690
  const { errLog: errLog$f } = createComponentLog('calendar');
4673
4691
  const { menus: menus$2, getConfig: getConfig$2, getI18n: getI18n$1 } = VxeUI;
@@ -9884,11 +9902,11 @@ var VxeCascaderComponent = defineVxeComponent({
9884
9902
  filterConfig: Object,
9885
9903
  showFullLabel: {
9886
9904
  type: Boolean,
9887
- default: getConfig$3().cascader.showFullLabel
9905
+ default: () => getConfig$3().cascader.showFullLabel
9888
9906
  },
9889
9907
  separator: {
9890
9908
  type: String,
9891
- default: getConfig$3().cascader.separator
9909
+ default: () => getConfig$3().cascader.separator
9892
9910
  },
9893
9911
  multiple: Boolean,
9894
9912
  className: [String, Function],
@@ -18003,6 +18021,12 @@ var VxeDatePickerComponent = defineVxeComponent({
18003
18021
  }
18004
18022
  return [];
18005
18023
  });
18024
+ const computeDateStartDate = computed(() => {
18025
+ return props.startDate ? XEUtils.toStringDate(props.startDate) : null;
18026
+ });
18027
+ const computeDateEndDate = computed(() => {
18028
+ return props.endDate ? XEUtils.toStringDate(props.endDate) : null;
18029
+ });
18006
18030
  const computeLimitMaxCount = computed(() => {
18007
18031
  return props.multiple ? XEUtils.toNumber(props.limitCount) : 0;
18008
18032
  });
@@ -18252,13 +18276,35 @@ var VxeDatePickerComponent = defineVxeComponent({
18252
18276
  handleInputLabel(panelLabel, true);
18253
18277
  };
18254
18278
  const afterCheckValue = (inpVal) => {
18255
- const { type } = props;
18279
+ const { type, editable, multiple, maskedConfig } = props;
18256
18280
  const { inputLabel } = internalData;
18257
18281
  const dateLabelFormat = computeDateLabelFormat.value;
18282
+ const maskedOpts = computeMaskedOpts.value;
18258
18283
  if (!inpVal) {
18259
18284
  handleChange('', { type: 'check' });
18260
18285
  return;
18261
18286
  }
18287
+ // 掩码格式处理
18288
+ if (editable && !multiple && (isEnableConf(maskedConfig) || maskedOpts.enabled)) {
18289
+ const allMaskedKeys = dateLabelFormat.match(new RegExp(`(${inputMaskedKeys.join('|')})+`, 'g'));
18290
+ if (allMaskedKeys) {
18291
+ allMaskedKeys.forEach(formatKey => {
18292
+ const fkIndex = dateLabelFormat.indexOf(formatKey);
18293
+ if (fkIndex > -1) {
18294
+ let val = XEUtils.toNumber(inpVal.slice(fkIndex, formatKey.length).replace(/\D/g, ''));
18295
+ // 自动纠错最小值
18296
+ if (!val && ['MM', 'dd'].includes(formatKey)) {
18297
+ val = 1;
18298
+ }
18299
+ inpVal = inpVal.slice(0, fkIndex) + XEUtils.padStart(checkDateFormat(val, formatKey), formatKey.length, '0') + inpVal.slice(fkIndex + formatKey.length);
18300
+ }
18301
+ });
18302
+ }
18303
+ }
18304
+ const $datePanel = refDatePanel.value;
18305
+ if ($datePanel) {
18306
+ return $datePanel.checkValue(inpVal);
18307
+ }
18262
18308
  let inpDateVal = parseDateValue(inpVal, type, {
18263
18309
  valueFormat: dateLabelFormat
18264
18310
  });
@@ -18306,6 +18352,16 @@ var VxeDatePickerComponent = defineVxeComponent({
18306
18352
  dispatchEvent('suffix-click', { value: inputValue }, evnt);
18307
18353
  }
18308
18354
  };
18355
+ const checkMaskedInputValue = (numStr, chunkFormat, isFull) => {
18356
+ const maskedOpts = computeMaskedOpts.value;
18357
+ const { align } = maskedOpts;
18358
+ const maskChar = computeMaskChar.value;
18359
+ const restVal = checkDateFormat(XEUtils.toNumber(numStr), chunkFormat);
18360
+ if (isFull) {
18361
+ return XEUtils.padStart(restVal, chunkFormat.length, '0');
18362
+ }
18363
+ return XEUtils[align === 'right' ? 'padStart' : 'padEnd'](restVal, chunkFormat.length, maskChar);
18364
+ };
18309
18365
  const handleArrowInputDate = (evnt, isUpArrow, isDwArrow, isLtArrow, isRtArrow) => {
18310
18366
  const { type, multiple } = props;
18311
18367
  if (multiple) {
@@ -18339,7 +18395,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18339
18395
  const chunkValue = inpValue.slice(chunkStartIndex, chunkEndIndex);
18340
18396
  if (parseInputKayMaps[selectKey]) {
18341
18397
  const chunkNum = (isAllSameChar(chunkValue, maskChar) ? getChunkDefaultNum(selectKey) : XEUtils.toNumber(chunkValue)) + (isUpArrow ? 1 : -1);
18342
- const restValue = inpValue.slice(0, chunkStartIndex) + XEUtils.padStart(chunkNum, chunkFormat.length, '0') + inpValue.slice(chunkEndIndex);
18398
+ const restValue = inpValue.slice(0, chunkStartIndex) + checkMaskedInputValue(chunkNum, chunkFormat, true) + inpValue.slice(chunkEndIndex);
18343
18399
  evnt.preventDefault();
18344
18400
  if (restValue.indexOf(maskChar) === -1) {
18345
18401
  // 解析日期
@@ -18400,6 +18456,8 @@ var VxeDatePickerComponent = defineVxeComponent({
18400
18456
  return;
18401
18457
  }
18402
18458
  const { isTriggerMasked } = internalData;
18459
+ const maskedOpts = computeMaskedOpts.value;
18460
+ const { align } = maskedOpts;
18403
18461
  const dateMaskedFormat = computeDateMaskedFormat.value;
18404
18462
  const maskChar = computeMaskChar.value;
18405
18463
  let inpValue = targetElem.value || dateMaskedFormat;
@@ -18419,7 +18477,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18419
18477
  const chunkEndIndex = chunkStartIndex + chunkFormat.length;
18420
18478
  const currKeyIndex = allMaskedKeys.indexOf(selectKey);
18421
18479
  // 全选 | 如果无效字符
18422
- const isAllSelected = !selectionStart && selectionEnd === inpValue.length;
18480
+ const isAllSelected = !selectionStart && selectionEnd === inpValue.length && allMaskedKeys.length > 1;
18423
18481
  const isNotMasked = inpValue && inpValue.length !== dateMaskedFormat.length;
18424
18482
  if (isAllSelected || isNotMasked) {
18425
18483
  inpValue = dateMaskedFormat;
@@ -18429,11 +18487,12 @@ var VxeDatePickerComponent = defineVxeComponent({
18429
18487
  const chunkNumList = isTriggerMasked && !isBackspaceKey ? [] : chunkNums.slice(0);
18430
18488
  if (isNumKey) {
18431
18489
  chunkNumList.push(numKey);
18490
+ chunkValue = checkMaskedInputValue(chunkNumList.join(''), chunkFormat, false);
18432
18491
  }
18433
18492
  else if (isBackspaceKey) {
18434
18493
  chunkNumList.pop();
18494
+ chunkValue = XEUtils[align === 'right' ? 'padStart' : 'padEnd'](chunkNumList.join(''), chunkFormat.length, maskChar);
18435
18495
  }
18436
- chunkValue = chunkNumList.join('').padEnd(chunkFormat.length, maskChar);
18437
18496
  let restValue = inpValue.slice(0, chunkStartIndex) + chunkValue + inpValue.slice(chunkEndIndex);
18438
18497
  restValue = restValue.replace(new RegExp(`(${inputMaskedKeys.join('|')})`, 'g'), maskChar);
18439
18498
  targetElem.value = restValue;
@@ -18465,7 +18524,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18465
18524
  const prveChunkNums = (prveChunkValue.match(/\d/g) || []);
18466
18525
  if (prveChunkNums.length) {
18467
18526
  prveChunkNums.pop();
18468
- prveChunkValue = prveChunkNums.join('').padEnd(prveChunkFormat.length, maskChar);
18527
+ prveChunkValue = XEUtils[align === 'right' ? 'padStart' : 'padEnd'](prveChunkNums.join(''), prveChunkFormat.length, maskChar);
18469
18528
  restValue = restValue.slice(0, prveChunkStartIndex) + prveChunkValue + restValue.slice(prveChunkEndIndex);
18470
18529
  targetElem.value = restValue;
18471
18530
  handleInputLabel(restValue, false);
@@ -18555,7 +18614,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18555
18614
  }
18556
18615
  }
18557
18616
  // 全选 | 如果无效字符
18558
- const isAllSelected = !selectionStart && selectionEnd === inpValue.length;
18617
+ const isAllSelected = !selectionStart && selectionEnd === inpValue.length && allMaskedKeys.length > 1;
18559
18618
  const isNotMasked = inpValue && inpValue.length !== dateMaskedFormat.length;
18560
18619
  if (isAllSelected || isNotMasked) {
18561
18620
  let restValue = '';
@@ -18599,7 +18658,6 @@ var VxeDatePickerComponent = defineVxeComponent({
18599
18658
  }
18600
18659
  };
18601
18660
  const blurEvent = (evnt) => {
18602
- const $datePanel = refDatePanel.value;
18603
18661
  const { inputValue } = reactData;
18604
18662
  const inpImmediate = computeInpImmediate.value;
18605
18663
  const value = inputValue;
@@ -18610,12 +18668,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18610
18668
  const { inputLabel } = internalData;
18611
18669
  reactData.isActivated = false;
18612
18670
  // 未打开面板时才校验
18613
- if ($datePanel) {
18614
- $datePanel.checkValue(inputLabel);
18615
- }
18616
- else {
18617
- afterCheckValue(inputLabel);
18618
- }
18671
+ afterCheckValue(inputLabel);
18619
18672
  }
18620
18673
  dispatchEvent('blur', { value }, evnt);
18621
18674
  // 自动更新校验状态
@@ -18671,18 +18724,12 @@ var VxeDatePickerComponent = defineVxeComponent({
18671
18724
  const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER);
18672
18725
  if (editable) {
18673
18726
  if (isEnter) {
18674
- const $datePanel = refDatePanel.value;
18675
18727
  const { inputLabel } = internalData;
18676
18728
  const targetElem = refInputTarget.value;
18677
18729
  if (visiblePanel) {
18678
18730
  hidePanel();
18679
18731
  }
18680
- if ($datePanel) {
18681
- $datePanel.checkValue(inputLabel);
18682
- }
18683
- else {
18684
- afterCheckValue(inputLabel);
18685
- }
18732
+ afterCheckValue(inputLabel);
18686
18733
  if (targetElem) {
18687
18734
  targetElem.blur();
18688
18735
  }
@@ -18729,7 +18776,6 @@ var VxeDatePickerComponent = defineVxeComponent({
18729
18776
  };
18730
18777
  // 全局事件
18731
18778
  const handleGlobalMousedownEvent = (evnt) => {
18732
- const $datePanel = refDatePanel.value;
18733
18779
  const { visiblePanel, isActivated } = reactData;
18734
18780
  const el = refElem.value;
18735
18781
  const panelWrapperElem = refPanelWrapper.value;
@@ -18743,12 +18789,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18743
18789
  if (visiblePanel) {
18744
18790
  hidePanel();
18745
18791
  const { inputLabel } = internalData;
18746
- if ($datePanel) {
18747
- $datePanel.checkValue(inputLabel);
18748
- }
18749
- else {
18750
- afterCheckValue(inputLabel);
18751
- }
18792
+ afterCheckValue(inputLabel);
18752
18793
  }
18753
18794
  }
18754
18795
  }
@@ -18787,7 +18828,6 @@ var VxeDatePickerComponent = defineVxeComponent({
18787
18828
  }
18788
18829
  };
18789
18830
  const handleGlobalBlurEvent = () => {
18790
- const $datePanel = refDatePanel.value;
18791
18831
  const { isActivated, visiblePanel } = reactData;
18792
18832
  if (visiblePanel) {
18793
18833
  hidePanel();
@@ -18796,9 +18836,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18796
18836
  reactData.isActivated = false;
18797
18837
  }
18798
18838
  if (visiblePanel || isActivated) {
18799
- if ($datePanel) {
18800
- $datePanel.checkValue(internalData.inputLabel);
18801
- }
18839
+ afterCheckValue(internalData.inputLabel);
18802
18840
  const targetElem = refInputTarget.value;
18803
18841
  if (targetElem) {
18804
18842
  targetElem.blur();
@@ -19011,6 +19049,8 @@ var VxeDatePickerComponent = defineVxeComponent({
19011
19049
  const isDateTimeType = computeIsDateTimeType.value;
19012
19050
  const shortcutList = computeShortcutList.value;
19013
19051
  const timeOpts = computeTimeOpts.value;
19052
+ const dateStartDate = computeDateStartDate.value;
19053
+ const dateEndDate = computeDateEndDate.value;
19014
19054
  const { position } = shortcutOpts;
19015
19055
  const headerSlot = slots.header;
19016
19056
  const footerSlot = slots.footer;
@@ -19079,8 +19119,8 @@ var VxeDatePickerComponent = defineVxeComponent({
19079
19119
  className: props.className,
19080
19120
  multiple: props.multiple,
19081
19121
  limitCount: props.limitCount,
19082
- startDate: props.startDate,
19083
- endDate: props.endDate,
19122
+ startDate: dateStartDate,
19123
+ endDate: dateEndDate,
19084
19124
  defaultDate: props.defaultDate,
19085
19125
  defaultTime: props.defaultTime,
19086
19126
  minDate: props.minDate,
@@ -31751,7 +31791,7 @@ var VxePulldownComponent = defineVxeComponent({
31751
31791
  */
31752
31792
  trigger: {
31753
31793
  type: String,
31754
- default: getConfig$3().pulldown.trigger
31794
+ default: () => getConfig$3().pulldown.trigger
31755
31795
  },
31756
31796
  /**
31757
31797
  * 已废弃,请使用 popupConfig.zIndex
@@ -31765,7 +31805,7 @@ var VxePulldownComponent = defineVxeComponent({
31765
31805
  options: Array,
31766
31806
  className: {
31767
31807
  type: [String, Function],
31768
- default: getConfig$3().pulldown.className
31808
+ default: () => getConfig$3().pulldown.className
31769
31809
  },
31770
31810
  /**
31771
31811
  * 已废弃,请使用 popupConfig.className
@@ -31776,7 +31816,7 @@ var VxePulldownComponent = defineVxeComponent({
31776
31816
  popupConfig: Object,
31777
31817
  destroyOnClose: {
31778
31818
  type: Boolean,
31779
- default: getConfig$3().pulldown.destroyOnClose
31819
+ default: () => getConfig$3().pulldown.destroyOnClose
31780
31820
  },
31781
31821
  transfer: {
31782
31822
  type: Boolean,
@@ -35144,7 +35184,7 @@ var VxeTableSelectComponent = defineVxeComponent({
35144
35184
  modelValue: [String, Number, Array],
35145
35185
  clearable: {
35146
35186
  type: Boolean,
35147
- default: getConfig$3().tableSelect.clearable
35187
+ default: () => getConfig$3().tableSelect.clearable
35148
35188
  },
35149
35189
  placeholder: {
35150
35190
  type: String,
@@ -40625,7 +40665,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
40625
40665
  modelValue: [String, Number, Array],
40626
40666
  clearable: {
40627
40667
  type: Boolean,
40628
- default: getConfig$3().treeSelect.clearable
40668
+ default: () => getConfig$3().treeSelect.clearable
40629
40669
  },
40630
40670
  placeholder: {
40631
40671
  type: String,
@@ -40642,11 +40682,11 @@ var VxeTreeSelectComponent = defineVxeComponent({
40642
40682
  },
40643
40683
  showFullLabel: {
40644
40684
  type: Boolean,
40645
- default: getConfig$3().treeSelect.showFullLabel
40685
+ default: () => getConfig$3().treeSelect.showFullLabel
40646
40686
  },
40647
40687
  separator: {
40648
40688
  type: String,
40649
- default: getConfig$3().treeSelect.separator
40689
+ default: () => getConfig$3().treeSelect.separator
40650
40690
  },
40651
40691
  filterable: Boolean,
40652
40692
  filterConfig: Object,