vxe-pc-ui 4.15.5 → 4.15.6

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 +80 -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 +52 -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 +58 -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 +88 -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 +58 -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.1782111198241.ttf} +0 -0
  49. /package/es/icon/{iconfont.1781979589724.woff → iconfont.1782111198241.woff} +0 -0
  50. /package/es/icon/{iconfont.1781979589724.woff2 → iconfont.1782111198241.woff2} +0 -0
  51. /package/es/{iconfont.1781979589724.ttf → iconfont.1782111198241.ttf} +0 -0
  52. /package/es/{iconfont.1781979589724.woff → iconfont.1782111198241.woff} +0 -0
  53. /package/es/{iconfont.1781979589724.woff2 → iconfont.1782111198241.woff2} +0 -0
  54. /package/lib/icon/style/{iconfont.1781979589724.ttf → iconfont.1782111198241.ttf} +0 -0
  55. /package/lib/icon/style/{iconfont.1781979589724.woff → iconfont.1782111198241.woff} +0 -0
  56. /package/lib/icon/style/{iconfont.1781979589724.woff2 → iconfont.1782111198241.woff2} +0 -0
  57. /package/lib/{iconfont.1781979589724.ttf → iconfont.1782111198241.ttf} +0 -0
  58. /package/lib/{iconfont.1781979589724.woff → iconfont.1782111198241.woff} +0 -0
  59. /package/lib/{iconfont.1781979589724.woff2 → iconfont.1782111198241.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.6"}`;
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.6";
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 < 1 ? 1 : numVal));
4678
+ case 'MM':
4679
+ return (numVal >= 12 ? 12 : (numVal < 1 ? 1 : numVal));
4680
+ case 'dd':
4681
+ return (numVal >= 31 ? 31 : (numVal < 1 ? 1 : 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,31 @@ 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
+ const val = XEUtils.toNumber(inpVal.slice(fkIndex, formatKey.length).replace(/\D/g, ''));
18295
+ inpVal = inpVal.slice(0, fkIndex) + XEUtils.padStart(checkDateFormat(val, formatKey), formatKey.length, '0') + inpVal.slice(fkIndex + formatKey.length);
18296
+ }
18297
+ });
18298
+ }
18299
+ }
18300
+ const $datePanel = refDatePanel.value;
18301
+ if ($datePanel) {
18302
+ return $datePanel.checkValue(inpVal);
18303
+ }
18262
18304
  let inpDateVal = parseDateValue(inpVal, type, {
18263
18305
  valueFormat: dateLabelFormat
18264
18306
  });
@@ -18306,6 +18348,16 @@ var VxeDatePickerComponent = defineVxeComponent({
18306
18348
  dispatchEvent('suffix-click', { value: inputValue }, evnt);
18307
18349
  }
18308
18350
  };
18351
+ const checkMaskedInputValue = (numStr, chunkFormat, isFull) => {
18352
+ const maskedOpts = computeMaskedOpts.value;
18353
+ const { align } = maskedOpts;
18354
+ const maskChar = computeMaskChar.value;
18355
+ const restVal = checkDateFormat(XEUtils.toNumber(numStr), chunkFormat);
18356
+ if (isFull) {
18357
+ return XEUtils.padStart(restVal, chunkFormat.length, '0');
18358
+ }
18359
+ return XEUtils[align === 'right' ? 'padStart' : 'padEnd'](restVal, chunkFormat.length, maskChar);
18360
+ };
18309
18361
  const handleArrowInputDate = (evnt, isUpArrow, isDwArrow, isLtArrow, isRtArrow) => {
18310
18362
  const { type, multiple } = props;
18311
18363
  if (multiple) {
@@ -18339,7 +18391,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18339
18391
  const chunkValue = inpValue.slice(chunkStartIndex, chunkEndIndex);
18340
18392
  if (parseInputKayMaps[selectKey]) {
18341
18393
  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);
18394
+ const restValue = inpValue.slice(0, chunkStartIndex) + checkMaskedInputValue(chunkNum, chunkFormat, true) + inpValue.slice(chunkEndIndex);
18343
18395
  evnt.preventDefault();
18344
18396
  if (restValue.indexOf(maskChar) === -1) {
18345
18397
  // 解析日期
@@ -18400,6 +18452,8 @@ var VxeDatePickerComponent = defineVxeComponent({
18400
18452
  return;
18401
18453
  }
18402
18454
  const { isTriggerMasked } = internalData;
18455
+ const maskedOpts = computeMaskedOpts.value;
18456
+ const { align } = maskedOpts;
18403
18457
  const dateMaskedFormat = computeDateMaskedFormat.value;
18404
18458
  const maskChar = computeMaskChar.value;
18405
18459
  let inpValue = targetElem.value || dateMaskedFormat;
@@ -18419,7 +18473,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18419
18473
  const chunkEndIndex = chunkStartIndex + chunkFormat.length;
18420
18474
  const currKeyIndex = allMaskedKeys.indexOf(selectKey);
18421
18475
  // 全选 | 如果无效字符
18422
- const isAllSelected = !selectionStart && selectionEnd === inpValue.length;
18476
+ const isAllSelected = !selectionStart && selectionEnd === inpValue.length && allMaskedKeys.length > 1;
18423
18477
  const isNotMasked = inpValue && inpValue.length !== dateMaskedFormat.length;
18424
18478
  if (isAllSelected || isNotMasked) {
18425
18479
  inpValue = dateMaskedFormat;
@@ -18429,11 +18483,12 @@ var VxeDatePickerComponent = defineVxeComponent({
18429
18483
  const chunkNumList = isTriggerMasked && !isBackspaceKey ? [] : chunkNums.slice(0);
18430
18484
  if (isNumKey) {
18431
18485
  chunkNumList.push(numKey);
18486
+ chunkValue = checkMaskedInputValue(chunkNumList.join(''), chunkFormat, false);
18432
18487
  }
18433
18488
  else if (isBackspaceKey) {
18434
18489
  chunkNumList.pop();
18490
+ chunkValue = XEUtils[align === 'right' ? 'padStart' : 'padEnd'](chunkNumList.join(''), chunkFormat.length, maskChar);
18435
18491
  }
18436
- chunkValue = chunkNumList.join('').padEnd(chunkFormat.length, maskChar);
18437
18492
  let restValue = inpValue.slice(0, chunkStartIndex) + chunkValue + inpValue.slice(chunkEndIndex);
18438
18493
  restValue = restValue.replace(new RegExp(`(${inputMaskedKeys.join('|')})`, 'g'), maskChar);
18439
18494
  targetElem.value = restValue;
@@ -18465,7 +18520,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18465
18520
  const prveChunkNums = (prveChunkValue.match(/\d/g) || []);
18466
18521
  if (prveChunkNums.length) {
18467
18522
  prveChunkNums.pop();
18468
- prveChunkValue = prveChunkNums.join('').padEnd(prveChunkFormat.length, maskChar);
18523
+ prveChunkValue = XEUtils[align === 'right' ? 'padStart' : 'padEnd'](prveChunkNums.join(''), prveChunkFormat.length, maskChar);
18469
18524
  restValue = restValue.slice(0, prveChunkStartIndex) + prveChunkValue + restValue.slice(prveChunkEndIndex);
18470
18525
  targetElem.value = restValue;
18471
18526
  handleInputLabel(restValue, false);
@@ -18555,7 +18610,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18555
18610
  }
18556
18611
  }
18557
18612
  // 全选 | 如果无效字符
18558
- const isAllSelected = !selectionStart && selectionEnd === inpValue.length;
18613
+ const isAllSelected = !selectionStart && selectionEnd === inpValue.length && allMaskedKeys.length > 1;
18559
18614
  const isNotMasked = inpValue && inpValue.length !== dateMaskedFormat.length;
18560
18615
  if (isAllSelected || isNotMasked) {
18561
18616
  let restValue = '';
@@ -18599,7 +18654,6 @@ var VxeDatePickerComponent = defineVxeComponent({
18599
18654
  }
18600
18655
  };
18601
18656
  const blurEvent = (evnt) => {
18602
- const $datePanel = refDatePanel.value;
18603
18657
  const { inputValue } = reactData;
18604
18658
  const inpImmediate = computeInpImmediate.value;
18605
18659
  const value = inputValue;
@@ -18610,12 +18664,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18610
18664
  const { inputLabel } = internalData;
18611
18665
  reactData.isActivated = false;
18612
18666
  // 未打开面板时才校验
18613
- if ($datePanel) {
18614
- $datePanel.checkValue(inputLabel);
18615
- }
18616
- else {
18617
- afterCheckValue(inputLabel);
18618
- }
18667
+ afterCheckValue(inputLabel);
18619
18668
  }
18620
18669
  dispatchEvent('blur', { value }, evnt);
18621
18670
  // 自动更新校验状态
@@ -18671,18 +18720,12 @@ var VxeDatePickerComponent = defineVxeComponent({
18671
18720
  const isEnter = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ENTER);
18672
18721
  if (editable) {
18673
18722
  if (isEnter) {
18674
- const $datePanel = refDatePanel.value;
18675
18723
  const { inputLabel } = internalData;
18676
18724
  const targetElem = refInputTarget.value;
18677
18725
  if (visiblePanel) {
18678
18726
  hidePanel();
18679
18727
  }
18680
- if ($datePanel) {
18681
- $datePanel.checkValue(inputLabel);
18682
- }
18683
- else {
18684
- afterCheckValue(inputLabel);
18685
- }
18728
+ afterCheckValue(inputLabel);
18686
18729
  if (targetElem) {
18687
18730
  targetElem.blur();
18688
18731
  }
@@ -18729,7 +18772,6 @@ var VxeDatePickerComponent = defineVxeComponent({
18729
18772
  };
18730
18773
  // 全局事件
18731
18774
  const handleGlobalMousedownEvent = (evnt) => {
18732
- const $datePanel = refDatePanel.value;
18733
18775
  const { visiblePanel, isActivated } = reactData;
18734
18776
  const el = refElem.value;
18735
18777
  const panelWrapperElem = refPanelWrapper.value;
@@ -18743,12 +18785,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18743
18785
  if (visiblePanel) {
18744
18786
  hidePanel();
18745
18787
  const { inputLabel } = internalData;
18746
- if ($datePanel) {
18747
- $datePanel.checkValue(inputLabel);
18748
- }
18749
- else {
18750
- afterCheckValue(inputLabel);
18751
- }
18788
+ afterCheckValue(inputLabel);
18752
18789
  }
18753
18790
  }
18754
18791
  }
@@ -18787,7 +18824,6 @@ var VxeDatePickerComponent = defineVxeComponent({
18787
18824
  }
18788
18825
  };
18789
18826
  const handleGlobalBlurEvent = () => {
18790
- const $datePanel = refDatePanel.value;
18791
18827
  const { isActivated, visiblePanel } = reactData;
18792
18828
  if (visiblePanel) {
18793
18829
  hidePanel();
@@ -18796,9 +18832,7 @@ var VxeDatePickerComponent = defineVxeComponent({
18796
18832
  reactData.isActivated = false;
18797
18833
  }
18798
18834
  if (visiblePanel || isActivated) {
18799
- if ($datePanel) {
18800
- $datePanel.checkValue(internalData.inputLabel);
18801
- }
18835
+ afterCheckValue(internalData.inputLabel);
18802
18836
  const targetElem = refInputTarget.value;
18803
18837
  if (targetElem) {
18804
18838
  targetElem.blur();
@@ -19011,6 +19045,8 @@ var VxeDatePickerComponent = defineVxeComponent({
19011
19045
  const isDateTimeType = computeIsDateTimeType.value;
19012
19046
  const shortcutList = computeShortcutList.value;
19013
19047
  const timeOpts = computeTimeOpts.value;
19048
+ const dateStartDate = computeDateStartDate.value;
19049
+ const dateEndDate = computeDateEndDate.value;
19014
19050
  const { position } = shortcutOpts;
19015
19051
  const headerSlot = slots.header;
19016
19052
  const footerSlot = slots.footer;
@@ -19079,8 +19115,8 @@ var VxeDatePickerComponent = defineVxeComponent({
19079
19115
  className: props.className,
19080
19116
  multiple: props.multiple,
19081
19117
  limitCount: props.limitCount,
19082
- startDate: props.startDate,
19083
- endDate: props.endDate,
19118
+ startDate: dateStartDate,
19119
+ endDate: dateEndDate,
19084
19120
  defaultDate: props.defaultDate,
19085
19121
  defaultTime: props.defaultTime,
19086
19122
  minDate: props.minDate,
@@ -31751,7 +31787,7 @@ var VxePulldownComponent = defineVxeComponent({
31751
31787
  */
31752
31788
  trigger: {
31753
31789
  type: String,
31754
- default: getConfig$3().pulldown.trigger
31790
+ default: () => getConfig$3().pulldown.trigger
31755
31791
  },
31756
31792
  /**
31757
31793
  * 已废弃,请使用 popupConfig.zIndex
@@ -31765,7 +31801,7 @@ var VxePulldownComponent = defineVxeComponent({
31765
31801
  options: Array,
31766
31802
  className: {
31767
31803
  type: [String, Function],
31768
- default: getConfig$3().pulldown.className
31804
+ default: () => getConfig$3().pulldown.className
31769
31805
  },
31770
31806
  /**
31771
31807
  * 已废弃,请使用 popupConfig.className
@@ -31776,7 +31812,7 @@ var VxePulldownComponent = defineVxeComponent({
31776
31812
  popupConfig: Object,
31777
31813
  destroyOnClose: {
31778
31814
  type: Boolean,
31779
- default: getConfig$3().pulldown.destroyOnClose
31815
+ default: () => getConfig$3().pulldown.destroyOnClose
31780
31816
  },
31781
31817
  transfer: {
31782
31818
  type: Boolean,
@@ -35144,7 +35180,7 @@ var VxeTableSelectComponent = defineVxeComponent({
35144
35180
  modelValue: [String, Number, Array],
35145
35181
  clearable: {
35146
35182
  type: Boolean,
35147
- default: getConfig$3().tableSelect.clearable
35183
+ default: () => getConfig$3().tableSelect.clearable
35148
35184
  },
35149
35185
  placeholder: {
35150
35186
  type: String,
@@ -40625,7 +40661,7 @@ var VxeTreeSelectComponent = defineVxeComponent({
40625
40661
  modelValue: [String, Number, Array],
40626
40662
  clearable: {
40627
40663
  type: Boolean,
40628
- default: getConfig$3().treeSelect.clearable
40664
+ default: () => getConfig$3().treeSelect.clearable
40629
40665
  },
40630
40666
  placeholder: {
40631
40667
  type: String,
@@ -40642,11 +40678,11 @@ var VxeTreeSelectComponent = defineVxeComponent({
40642
40678
  },
40643
40679
  showFullLabel: {
40644
40680
  type: Boolean,
40645
- default: getConfig$3().treeSelect.showFullLabel
40681
+ default: () => getConfig$3().treeSelect.showFullLabel
40646
40682
  },
40647
40683
  separator: {
40648
40684
  type: String,
40649
- default: getConfig$3().treeSelect.separator
40685
+ default: () => getConfig$3().treeSelect.separator
40650
40686
  },
40651
40687
  filterable: Boolean,
40652
40688
  filterConfig: Object,