vxe-pc-ui 1.7.19 → 1.7.20

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 (119) hide show
  1. package/es/date-input/src/date-input.js +94 -406
  2. package/es/date-input/style.css +939 -0
  3. package/es/date-input/style.min.css +1 -0
  4. package/es/form/src/form-gather.js +2 -2
  5. package/es/form-design/src/default-setting-data.js +2 -1
  6. package/es/form-design/src/form-design.js +2 -2
  7. package/es/form-design/src/form-view.js +64 -31
  8. package/es/form-design/src/layout-style.js +2 -0
  9. package/es/form-design/src/widget-info.js +33 -20
  10. package/es/form-design/widget-select/select-view.js +1 -1
  11. package/es/form-design/widget-vxe-checkbox-group/vxe-checkbox-group-view.js +3 -2
  12. package/es/form-design/widget-vxe-input/vxe-input-view.js +3 -2
  13. package/es/form-design/widget-vxe-radio-group/vxe-radio-group-view.js +3 -2
  14. package/es/form-design/widget-vxe-select/vxe-select-view.js +4 -3
  15. package/es/form-design/widget-vxe-textarea/vxe-textarea-view.js +3 -2
  16. package/es/icon/style.css +1 -1
  17. package/es/number-input/src/number-input.js +67 -1714
  18. package/es/number-input/style.css +215 -0
  19. package/es/number-input/style.min.css +1 -0
  20. package/es/style.css +1 -1
  21. package/es/style.min.css +1 -1
  22. package/es/ui/index.js +1 -1
  23. package/es/vxe-date-input/style.css +939 -0
  24. package/es/vxe-date-input/style.min.css +1 -0
  25. package/es/vxe-number-input/style.css +215 -0
  26. package/es/vxe-number-input/style.min.css +1 -0
  27. package/lib/date-input/src/date-input.js +95 -450
  28. package/lib/date-input/src/date-input.min.js +1 -1
  29. package/lib/date-input/style/style.css +939 -0
  30. package/lib/date-input/style/style.min.css +1 -0
  31. package/lib/form/src/form-gather.js +2 -2
  32. package/lib/form/src/form-gather.min.js +1 -1
  33. package/lib/form-design/src/default-setting-data.js +2 -1
  34. package/lib/form-design/src/default-setting-data.min.js +1 -1
  35. package/lib/form-design/src/form-design.js +2 -2
  36. package/lib/form-design/src/form-design.min.js +1 -1
  37. package/lib/form-design/src/form-view.js +37 -12
  38. package/lib/form-design/src/form-view.min.js +1 -1
  39. package/lib/form-design/src/layout-style.js +4 -0
  40. package/lib/form-design/src/layout-style.min.js +1 -1
  41. package/lib/form-design/src/widget-info.js +38 -24
  42. package/lib/form-design/src/widget-info.min.js +1 -1
  43. package/lib/form-design/widget-select/select-view.js +1 -1
  44. package/lib/form-design/widget-select/select-view.min.js +1 -1
  45. package/lib/form-design/widget-vxe-checkbox-group/vxe-checkbox-group-view.js +3 -2
  46. package/lib/form-design/widget-vxe-checkbox-group/vxe-checkbox-group-view.min.js +1 -1
  47. package/lib/form-design/widget-vxe-input/vxe-input-view.js +3 -2
  48. package/lib/form-design/widget-vxe-input/vxe-input-view.min.js +1 -1
  49. package/lib/form-design/widget-vxe-radio-group/vxe-radio-group-view.js +3 -2
  50. package/lib/form-design/widget-vxe-radio-group/vxe-radio-group-view.min.js +1 -1
  51. package/lib/form-design/widget-vxe-select/vxe-select-view.js +4 -3
  52. package/lib/form-design/widget-vxe-select/vxe-select-view.min.js +1 -1
  53. package/lib/form-design/widget-vxe-textarea/vxe-textarea-view.js +3 -2
  54. package/lib/form-design/widget-vxe-textarea/vxe-textarea-view.min.js +1 -1
  55. package/lib/icon/style/style.css +1 -1
  56. package/lib/icon/style/style.min.css +1 -1
  57. package/lib/index.umd.js +803 -2902
  58. package/lib/index.umd.min.js +1 -1
  59. package/lib/number-input/src/number-input.js +70 -1806
  60. package/lib/number-input/src/number-input.min.js +1 -1
  61. package/lib/number-input/style/style.css +215 -0
  62. package/lib/number-input/style/style.min.css +1 -0
  63. package/lib/style.css +1 -1
  64. package/lib/style.min.css +1 -1
  65. package/lib/ui/index.js +1 -1
  66. package/lib/ui/index.min.js +1 -1
  67. package/lib/vxe-date-input/style/style.css +939 -0
  68. package/lib/vxe-date-input/style/style.min.css +1 -0
  69. package/lib/vxe-number-input/style/style.css +215 -0
  70. package/lib/vxe-number-input/style/style.min.css +1 -0
  71. package/package.json +2 -2
  72. package/packages/date-input/src/date-input.ts +93 -429
  73. package/packages/form/src/form-gather.ts +2 -2
  74. package/packages/form-design/src/default-setting-data.ts +3 -1
  75. package/packages/form-design/src/form-design.ts +2 -2
  76. package/packages/form-design/src/form-view.ts +68 -32
  77. package/packages/form-design/src/layout-style.ts +2 -0
  78. package/packages/form-design/src/widget-info.ts +43 -21
  79. package/packages/form-design/widget-select/select-view.ts +1 -1
  80. package/packages/form-design/widget-vxe-checkbox-group/vxe-checkbox-group-view.ts +3 -2
  81. package/packages/form-design/widget-vxe-input/vxe-input-view.ts +3 -2
  82. package/packages/form-design/widget-vxe-radio-group/vxe-radio-group-view.ts +3 -2
  83. package/packages/form-design/widget-vxe-select/vxe-select-view.ts +4 -3
  84. package/packages/form-design/widget-vxe-textarea/vxe-textarea-view.ts +3 -2
  85. package/packages/number-input/src/number-input.ts +92 -1809
  86. package/styles/components/date-input.scss +833 -0
  87. package/styles/components/number-input.scss +291 -0
  88. package/types/components/date-input.d.ts +155 -0
  89. package/types/components/form-design.d.ts +1 -1
  90. package/types/components/form-view.d.ts +3 -1
  91. package/types/components/number-input.d.ts +81 -1
  92. package/es/date-input/src/date.js +0 -41
  93. package/es/date-input/src/number.js +0 -10
  94. package/es/number-input/src/date.js +0 -41
  95. package/es/number-input/src/number.js +0 -10
  96. package/lib/date-input/src/date.js +0 -46
  97. package/lib/date-input/src/date.min.js +0 -1
  98. package/lib/date-input/src/number.js +0 -18
  99. package/lib/date-input/src/number.min.js +0 -1
  100. package/lib/number-input/src/date.js +0 -46
  101. package/lib/number-input/src/date.min.js +0 -1
  102. package/lib/number-input/src/number.js +0 -18
  103. package/lib/number-input/src/number.min.js +0 -1
  104. package/packages/date-input/src/date.ts +0 -42
  105. package/packages/date-input/src/number.ts +0 -12
  106. package/packages/number-input/src/date.ts +0 -42
  107. package/packages/number-input/src/number.ts +0 -12
  108. /package/es/icon/style/{iconfont.1716869827417.ttf → iconfont.1716893632653.ttf} +0 -0
  109. /package/es/icon/style/{iconfont.1716869827417.woff → iconfont.1716893632653.woff} +0 -0
  110. /package/es/icon/style/{iconfont.1716869827417.woff2 → iconfont.1716893632653.woff2} +0 -0
  111. /package/es/{iconfont.1716869827417.ttf → iconfont.1716893632653.ttf} +0 -0
  112. /package/es/{iconfont.1716869827417.woff → iconfont.1716893632653.woff} +0 -0
  113. /package/es/{iconfont.1716869827417.woff2 → iconfont.1716893632653.woff2} +0 -0
  114. /package/lib/icon/style/{iconfont.1716869827417.ttf → iconfont.1716893632653.ttf} +0 -0
  115. /package/lib/icon/style/{iconfont.1716869827417.woff → iconfont.1716893632653.woff} +0 -0
  116. /package/lib/icon/style/{iconfont.1716869827417.woff2 → iconfont.1716893632653.woff2} +0 -0
  117. /package/lib/{iconfont.1716869827417.ttf → iconfont.1716893632653.ttf} +0 -0
  118. /package/lib/{iconfont.1716869827417.woff → iconfont.1716893632653.woff} +0 -0
  119. /package/lib/{iconfont.1716869827417.woff2 → iconfont.1716893632653.woff2} +0 -0
@@ -3,18 +3,56 @@ import XEUtils from 'xe-utils';
3
3
  import { getConfig, getIcon, getI18n, globalEvents, GLOBAL_EVENT_KEYS, createEvent, useSize } from '@vxe-ui/core';
4
4
  import { getFuncText, getLastZIndex, nextZIndex } from '../../ui/src/utils';
5
5
  import { hasClass, getAbsolutePos, getEventTargetNode } from '../../ui/src/dom';
6
- import { toStringTimeDate, getDateQuarter } from './date';
7
- import { handleNumber, toFloatValueFixed } from './number';
8
6
  const yearSize = 12;
9
7
  const monthSize = 20;
10
8
  const quarterSize = 8;
9
+ export function toStringTimeDate(str) {
10
+ if (str) {
11
+ const rest = new Date();
12
+ let h = 0;
13
+ let m = 0;
14
+ let s = 0;
15
+ if (XEUtils.isDate(str)) {
16
+ h = str.getHours();
17
+ m = str.getMinutes();
18
+ s = str.getSeconds();
19
+ }
20
+ else {
21
+ str = XEUtils.toValueString(str);
22
+ const parses = str.match(/^(\d{1,2})(:(\d{1,2}))?(:(\d{1,2}))?/);
23
+ if (parses) {
24
+ h = XEUtils.toNumber(parses[1]);
25
+ m = XEUtils.toNumber(parses[3]);
26
+ s = XEUtils.toNumber(parses[5]);
27
+ }
28
+ }
29
+ rest.setHours(h);
30
+ rest.setMinutes(m);
31
+ rest.setSeconds(s);
32
+ return rest;
33
+ }
34
+ return new Date('');
35
+ }
36
+ export function getDateQuarter(date) {
37
+ const month = date.getMonth();
38
+ if (month < 3) {
39
+ return 1;
40
+ }
41
+ else if (month < 6) {
42
+ return 2;
43
+ }
44
+ else if (month < 9) {
45
+ return 3;
46
+ }
47
+ return 4;
48
+ }
11
49
  export default defineComponent({
12
50
  name: 'VxeDateInput',
13
51
  props: {
14
52
  modelValue: [String, Number, Date],
15
53
  immediate: { type: Boolean, default: true },
16
54
  name: String,
17
- type: { type: String, default: 'text' },
55
+ type: { type: String, default: 'date' },
18
56
  clearable: { type: Boolean, default: () => getConfig().input.clearable },
19
57
  readonly: Boolean,
20
58
  disabled: Boolean,
@@ -132,47 +170,14 @@ export default defineComponent({
132
170
  const { type } = props;
133
171
  return type === 'time' || type === 'datetime';
134
172
  });
135
- const computeIsNumType = computed(() => {
136
- return ['number', 'integer', 'float'].indexOf(props.type) > -1;
137
- });
138
- const computeInputCount = computed(() => {
139
- return XEUtils.getSize(reactData.inputValue);
140
- });
141
- const computeIsCountError = computed(() => {
142
- const inputCount = computeInputCount.value;
143
- return props.maxlength && inputCount > XEUtils.toNumber(props.maxlength);
144
- });
145
173
  const computeIsDatePickerType = computed(() => {
146
174
  const isDateTimeType = computeIsDateTimeType.value;
147
175
  return isDateTimeType || ['date', 'week', 'month', 'quarter', 'year'].indexOf(props.type) > -1;
148
176
  });
149
- const computeIsPawdType = computed(() => {
150
- return props.type === 'password';
151
- });
152
- const computeIsSearchType = computed(() => {
153
- return props.type === 'search';
154
- });
155
- const computeDigitsValue = computed(() => {
156
- return XEUtils.toInteger(props.digits) || 1;
157
- });
158
- const computeStepValue = computed(() => {
159
- const { type } = props;
160
- const digitsValue = computeDigitsValue.value;
161
- const step = props.step;
162
- if (type === 'integer') {
163
- return XEUtils.toInteger(step) || 1;
164
- }
165
- else if (type === 'float') {
166
- return XEUtils.toNumber(step) || (1 / Math.pow(10, digitsValue));
167
- }
168
- return XEUtils.toNumber(step) || 1;
169
- });
170
177
  const computeIsClearable = computed(() => {
171
178
  const { type } = props;
172
- const isNumType = computeIsNumType.value;
173
179
  const isDatePickerType = computeIsDatePickerType.value;
174
- const isPawdType = computeIsPawdType.value;
175
- return props.clearable && (isPawdType || isNumType || isDatePickerType || type === 'text' || type === 'search');
180
+ return props.clearable && (isDatePickerType || type === 'text' || type === 'search');
176
181
  });
177
182
  const computeDateStartTime = computed(() => {
178
183
  return props.startDate ? XEUtils.toStringDate(props.startDate) : null;
@@ -497,17 +502,6 @@ export default defineComponent({
497
502
  const { type, readonly, editable, multiple } = props;
498
503
  return readonly || multiple || !editable || type === 'week' || type === 'quarter';
499
504
  });
500
- const computeInputType = computed(() => {
501
- const { type } = props;
502
- const { showPwd } = reactData;
503
- const isNumType = computeIsNumType.value;
504
- const isDatePickerType = computeIsDatePickerType.value;
505
- const isPawdType = computeIsPawdType.value;
506
- if (isDatePickerType || isNumType || (isPawdType && showPwd) || type === 'number') {
507
- return 'text';
508
- }
509
- return type;
510
- });
511
505
  const computeInpPlaceholder = computed(() => {
512
506
  const { placeholder } = props;
513
507
  if (placeholder) {
@@ -515,57 +509,10 @@ export default defineComponent({
515
509
  }
516
510
  return '';
517
511
  });
518
- const computeInpMaxlength = computed(() => {
519
- const { maxlength } = props;
520
- const isNumType = computeIsNumType.value;
521
- // 数值最大长度限制 16 位,包含小数
522
- return isNumType && !XEUtils.toNumber(maxlength) ? 16 : maxlength;
523
- });
524
512
  const computeInpImmediate = computed(() => {
525
513
  const { type, immediate } = props;
526
- return immediate || !(type === 'text' || type === 'number' || type === 'integer' || type === 'float');
527
- });
528
- const computeNumValue = computed(() => {
529
- const { type } = props;
530
- const { inputValue } = reactData;
531
- const isNumType = computeIsNumType.value;
532
- if (isNumType) {
533
- return type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
534
- }
535
- return 0;
536
- });
537
- const computeIsDisabledSubtractNumber = computed(() => {
538
- const { min } = props;
539
- const { inputValue } = reactData;
540
- const isNumType = computeIsNumType.value;
541
- const numValue = computeNumValue.value;
542
- // 当有值时再进行判断
543
- if ((inputValue || inputValue === 0) && isNumType && min !== null) {
544
- return numValue <= XEUtils.toNumber(min);
545
- }
546
- return false;
547
- });
548
- const computeIsDisabledAddNumber = computed(() => {
549
- const { max } = props;
550
- const { inputValue } = reactData;
551
- const isNumType = computeIsNumType.value;
552
- const numValue = computeNumValue.value;
553
- // 当有值时再进行判断
554
- if ((inputValue || inputValue === 0) && isNumType && max !== null) {
555
- return numValue >= XEUtils.toNumber(max);
556
- }
557
- return false;
514
+ return immediate || !(type === 'text');
558
515
  });
559
- const getNumberValue = (val) => {
560
- const { type, exponential } = props;
561
- const inpMaxlength = computeInpMaxlength.value;
562
- const digitsValue = computeDigitsValue.value;
563
- const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : XEUtils.toValueString(val));
564
- if (exponential && (val === restVal || XEUtils.toValueString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
565
- return val;
566
- }
567
- return restVal.slice(0, inpMaxlength);
568
- };
569
516
  const triggerEvent = (evnt) => {
570
517
  const { inputValue } = reactData;
571
518
  inputMethods.dispatchEvent(evnt.type, { value: inputValue }, evnt);
@@ -632,15 +579,10 @@ export default defineComponent({
632
579
  });
633
580
  };
634
581
  const clearValueEvent = (evnt, value) => {
635
- const { type } = props;
636
- const isNumType = computeIsNumType.value;
637
582
  const isDatePickerType = computeIsDatePickerType.value;
638
583
  if (isDatePickerType) {
639
584
  hidePanel();
640
585
  }
641
- if (isNumType || ['text', 'search', 'password'].indexOf(type) > -1) {
642
- focus();
643
- }
644
586
  inputMethods.dispatchEvent('clear', { value }, evnt);
645
587
  };
646
588
  const clickSuffixEvent = (evnt) => {
@@ -703,27 +645,10 @@ export default defineComponent({
703
645
  * 检查初始值
704
646
  */
705
647
  const initValue = () => {
706
- const { type } = props;
707
- const { inputValue } = reactData;
708
648
  const isDatePickerType = computeIsDatePickerType.value;
709
- const digitsValue = computeDigitsValue.value;
710
649
  if (isDatePickerType) {
711
650
  changeValue();
712
651
  }
713
- else if (type === 'float') {
714
- if (inputValue) {
715
- const validValue = toFloatValueFixed(inputValue, digitsValue);
716
- if (inputValue !== validValue) {
717
- emitModel(validValue, { type: 'init' });
718
- }
719
- }
720
- }
721
- };
722
- const vaildMaxNum = (num) => {
723
- return props.max === null || XEUtils.toNumber(num) <= XEUtils.toNumber(props.max);
724
- };
725
- const vaildMinNum = (num) => {
726
- return props.min === null || XEUtils.toNumber(num) >= XEUtils.toNumber(props.min);
727
652
  };
728
653
  const dateRevert = () => {
729
654
  reactData.inputValue = props.multiple ? computeDateMultipleLabel.value : reactData.datePanelLabel;
@@ -793,32 +718,13 @@ export default defineComponent({
793
718
  }
794
719
  };
795
720
  const afterCheckValue = () => {
796
- const { type, min, max, exponential } = props;
721
+ const { type } = props;
797
722
  const { inputValue, datetimePanelValue } = reactData;
798
- const isNumType = computeIsNumType.value;
799
723
  const isDatePickerType = computeIsDatePickerType.value;
800
724
  const dateLabelFormat = computeDateLabelFormat.value;
801
725
  const inpReadonly = computeInpReadonly.value;
802
726
  if (!inpReadonly) {
803
- if (isNumType) {
804
- if (inputValue) {
805
- let inpNumVal = type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
806
- if (!vaildMinNum(inpNumVal)) {
807
- inpNumVal = min;
808
- }
809
- else if (!vaildMaxNum(inpNumVal)) {
810
- inpNumVal = max;
811
- }
812
- if (exponential) {
813
- const inpStringVal = XEUtils.toValueString(inputValue).toLowerCase();
814
- if (inpStringVal === XEUtils.toNumber(inpNumVal).toExponential()) {
815
- inpNumVal = inpStringVal;
816
- }
817
- }
818
- emitModel(getNumberValue(inpNumVal), { type: 'check' });
819
- }
820
- }
821
- else if (isDatePickerType) {
727
+ if (isDatePickerType) {
822
728
  if (inputValue) {
823
729
  let inpDateVal = parseDate(inputValue, dateLabelFormat);
824
730
  if (XEUtils.isValidDate(inpDateVal)) {
@@ -872,144 +778,12 @@ export default defineComponent({
872
778
  }
873
779
  inputMethods.dispatchEvent('blur', { value: inputValue }, evnt);
874
780
  };
875
- // 密码
876
- const passwordToggleEvent = (evnt) => {
877
- const { readonly, disabled } = props;
878
- const { showPwd } = reactData;
879
- if (!disabled && !readonly) {
880
- reactData.showPwd = !showPwd;
881
- }
882
- inputMethods.dispatchEvent('toggle-visible', { visible: reactData.showPwd }, evnt);
883
- };
884
- // 密码
885
- // 搜索
886
- const searchEvent = (evnt) => {
887
- inputMethods.dispatchEvent('search-click', {}, evnt);
888
- };
889
- // 搜索
890
- // 数值
891
- const numberChange = (isPlus, evnt) => {
892
- const { min, max, type } = props;
893
- const { inputValue } = reactData;
894
- const stepValue = computeStepValue.value;
895
- const numValue = type === 'integer' ? XEUtils.toInteger(handleNumber(inputValue)) : XEUtils.toNumber(handleNumber(inputValue));
896
- const newValue = isPlus ? XEUtils.add(numValue, stepValue) : XEUtils.subtract(numValue, stepValue);
897
- let restNum;
898
- if (!vaildMinNum(newValue)) {
899
- restNum = min;
900
- }
901
- else if (!vaildMaxNum(newValue)) {
902
- restNum = max;
903
- }
904
- else {
905
- restNum = newValue;
906
- }
907
- emitInputEvent(getNumberValue(restNum), evnt);
908
- };
909
- let downbumTimeout;
910
- const numberNextEvent = (evnt) => {
911
- const { readonly, disabled } = props;
912
- const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value;
913
- clearTimeout(downbumTimeout);
914
- if (!disabled && !readonly && !isDisabledSubtractNumber) {
915
- numberChange(false, evnt);
916
- }
917
- inputMethods.dispatchEvent('next-number', {}, evnt);
918
- };
919
- const numberDownNextEvent = (evnt) => {
920
- downbumTimeout = window.setTimeout(() => {
921
- numberNextEvent(evnt);
922
- numberDownNextEvent(evnt);
923
- }, 60);
924
- };
925
- const numberPrevEvent = (evnt) => {
926
- const { readonly, disabled } = props;
927
- const isDisabledAddNumber = computeIsDisabledAddNumber.value;
928
- clearTimeout(downbumTimeout);
929
- if (!disabled && !readonly && !isDisabledAddNumber) {
930
- numberChange(true, evnt);
931
- }
932
- inputMethods.dispatchEvent('prev-number', {}, evnt);
933
- };
934
- const numberKeydownEvent = (evnt) => {
935
- const isUpArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_UP);
936
- const isDwArrow = globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.ARROW_DOWN);
937
- if (isUpArrow || isDwArrow) {
938
- evnt.preventDefault();
939
- if (isUpArrow) {
940
- numberPrevEvent(evnt);
941
- }
942
- else {
943
- numberNextEvent(evnt);
944
- }
945
- }
946
- };
947
781
  const keydownEvent = (evnt) => {
948
- const { exponential, controls } = props;
949
- const isNumType = computeIsNumType.value;
950
- if (isNumType) {
951
- const isCtrlKey = evnt.ctrlKey;
952
- const isShiftKey = evnt.shiftKey;
953
- const isAltKey = evnt.altKey;
954
- const keyCode = evnt.keyCode;
955
- if (!isCtrlKey && !isShiftKey && !isAltKey && (globalEvents.hasKey(evnt, GLOBAL_EVENT_KEYS.SPACEBAR) || ((!exponential || keyCode !== 69) && (keyCode >= 65 && keyCode <= 90)) || (keyCode >= 186 && keyCode <= 188) || keyCode >= 191)) {
956
- evnt.preventDefault();
957
- }
958
- if (controls) {
959
- numberKeydownEvent(evnt);
960
- }
961
- }
962
782
  triggerEvent(evnt);
963
783
  };
964
784
  const keyupEvent = (evnt) => {
965
785
  triggerEvent(evnt);
966
786
  };
967
- // 数值
968
- const numberStopDown = () => {
969
- clearTimeout(downbumTimeout);
970
- };
971
- const numberDownPrevEvent = (evnt) => {
972
- downbumTimeout = window.setTimeout(() => {
973
- numberPrevEvent(evnt);
974
- numberDownPrevEvent(evnt);
975
- }, 60);
976
- };
977
- const numberMousedownEvent = (evnt) => {
978
- numberStopDown();
979
- if (evnt.button === 0) {
980
- const isPrevNumber = hasClass(evnt.currentTarget, 'is--prev');
981
- if (isPrevNumber) {
982
- numberPrevEvent(evnt);
983
- }
984
- else {
985
- numberNextEvent(evnt);
986
- }
987
- downbumTimeout = window.setTimeout(() => {
988
- if (isPrevNumber) {
989
- numberDownPrevEvent(evnt);
990
- }
991
- else {
992
- numberDownNextEvent(evnt);
993
- }
994
- }, 500);
995
- }
996
- };
997
- const wheelEvent = (evnt) => {
998
- const isNumType = computeIsNumType.value;
999
- if (isNumType && props.controls) {
1000
- if (reactData.isActivated) {
1001
- const delta = evnt.deltaY;
1002
- if (delta > 0) {
1003
- numberNextEvent(evnt);
1004
- }
1005
- else if (delta < 0) {
1006
- numberPrevEvent(evnt);
1007
- }
1008
- evnt.preventDefault();
1009
- }
1010
- }
1011
- triggerEvent(evnt);
1012
- };
1013
787
  // 日期
1014
788
  const dateMonthHandle = (date, offsetMonth) => {
1015
789
  reactData.selectMonth = XEUtils.getWhatMonth(date, offsetMonth, 'first');
@@ -1627,14 +1401,14 @@ export default defineComponent({
1627
1401
  const extraItem = festivalItem.extra ? (XEUtils.isString(festivalItem.extra) ? { label: festivalItem.extra } : festivalItem.extra) : null;
1628
1402
  const labels = [
1629
1403
  h('span', {
1630
- class: ['vxe-input--date-label', {
1404
+ class: ['vxe-date-input--date-label', {
1631
1405
  'is-notice': festivalItem.notice
1632
1406
  }]
1633
1407
  }, extraItem && extraItem.label
1634
1408
  ? [
1635
1409
  h('span', label),
1636
1410
  h('span', {
1637
- class: ['vxe-input--date-label--extra', extraItem.important ? 'is-important' : '', extraItem.className],
1411
+ class: ['vxe-date-input--date-label--extra', extraItem.important ? 'is-important' : '', extraItem.className],
1638
1412
  style: extraItem.style
1639
1413
  }, XEUtils.toValueString(extraItem.label))
1640
1414
  ]
@@ -1645,15 +1419,15 @@ export default defineComponent({
1645
1419
  // 默认最多支持3个节日重叠
1646
1420
  const festivalLabels = XEUtils.toValueString(festivalLabel).split(',');
1647
1421
  labels.push(h('span', {
1648
- class: ['vxe-input--date-festival', festivalItem.important ? 'is-important' : '', festivalItem.className],
1422
+ class: ['vxe-date-input--date-festival', festivalItem.important ? 'is-important' : '', festivalItem.className],
1649
1423
  style: festivalItem.style
1650
1424
  }, [
1651
1425
  festivalLabels.length > 1
1652
1426
  ? h('span', {
1653
- class: ['vxe-input--date-festival--overlap', `overlap--${festivalLabels.length}`]
1427
+ class: ['vxe-date-input--date-festival--overlap', `overlap--${festivalLabels.length}`]
1654
1428
  }, festivalLabels.map(label => h('span', label.substring(0, 3))))
1655
1429
  : h('span', {
1656
- class: 'vxe-input--date-festival--label'
1430
+ class: 'vxe-date-input--date-festival--label'
1657
1431
  }, festivalLabels[0].substring(0, 3))
1658
1432
  ]));
1659
1433
  }
@@ -1671,7 +1445,7 @@ export default defineComponent({
1671
1445
  const matchFormat = 'yyyyMMdd';
1672
1446
  return [
1673
1447
  h('table', {
1674
- class: `vxe-input--date-${datePanelType}-view`,
1448
+ class: `vxe-date-input--date-${datePanelType}-view`,
1675
1449
  cellspacing: 0,
1676
1450
  cellpadding: 0,
1677
1451
  border: 0
@@ -1711,7 +1485,7 @@ export default defineComponent({
1711
1485
  const matchFormat = 'yyyyMMdd';
1712
1486
  return [
1713
1487
  h('table', {
1714
- class: `vxe-input--date-${datePanelType}-view`,
1488
+ class: `vxe-date-input--date-${datePanelType}-view`,
1715
1489
  cellspacing: 0,
1716
1490
  cellpadding: 0,
1717
1491
  border: 0
@@ -1753,7 +1527,7 @@ export default defineComponent({
1753
1527
  const matchFormat = 'yyyyMM';
1754
1528
  return [
1755
1529
  h('table', {
1756
- class: `vxe-input--date-${datePanelType}-view`,
1530
+ class: `vxe-date-input--date-${datePanelType}-view`,
1757
1531
  cellspacing: 0,
1758
1532
  cellpadding: 0,
1759
1533
  border: 0
@@ -1787,7 +1561,7 @@ export default defineComponent({
1787
1561
  const matchFormat = 'yyyyq';
1788
1562
  return [
1789
1563
  h('table', {
1790
- class: `vxe-input--date-${datePanelType}-view`,
1564
+ class: `vxe-date-input--date-${datePanelType}-view`,
1791
1565
  cellspacing: 0,
1792
1566
  cellpadding: 0,
1793
1567
  border: 0
@@ -1821,7 +1595,7 @@ export default defineComponent({
1821
1595
  const matchFormat = 'yyyy';
1822
1596
  return [
1823
1597
  h('table', {
1824
- class: `vxe-input--date-${datePanelType}-view`,
1598
+ class: `vxe-date-input--date-${datePanelType}-view`,
1825
1599
  cellspacing: 0,
1826
1600
  cellpadding: 0,
1827
1601
  border: 0
@@ -1868,25 +1642,25 @@ export default defineComponent({
1868
1642
  const selectDatePanelLabel = computeSelectDatePanelLabel.value;
1869
1643
  return [
1870
1644
  h('div', {
1871
- class: 'vxe-input--date-picker-header'
1645
+ class: 'vxe-date-input--date-picker-header'
1872
1646
  }, [
1873
1647
  h('div', {
1874
- class: 'vxe-input--date-picker-type-wrapper'
1648
+ class: 'vxe-date-input--date-picker-type-wrapper'
1875
1649
  }, [
1876
1650
  datePanelType === 'year'
1877
1651
  ? h('span', {
1878
- class: 'vxe-input--date-picker-label'
1652
+ class: 'vxe-date-input--date-picker-label'
1879
1653
  }, selectDatePanelLabel)
1880
1654
  : h('span', {
1881
- class: 'vxe-input--date-picker-btn',
1655
+ class: 'vxe-date-input--date-picker-btn',
1882
1656
  onClick: dateToggleTypeEvent
1883
1657
  }, selectDatePanelLabel)
1884
1658
  ]),
1885
1659
  h('div', {
1886
- class: 'vxe-input--date-picker-btn-wrapper'
1660
+ class: 'vxe-date-input--date-picker-btn-wrapper'
1887
1661
  }, [
1888
1662
  h('span', {
1889
- class: ['vxe-input--date-picker-btn vxe-input--date-picker-prev-btn', {
1663
+ class: ['vxe-date-input--date-picker-btn vxe-date-input--date-picker-prev-btn', {
1890
1664
  'is--disabled': isDisabledPrevDateBtn
1891
1665
  }],
1892
1666
  onClick: datePrevEvent
@@ -1896,7 +1670,7 @@ export default defineComponent({
1896
1670
  })
1897
1671
  ]),
1898
1672
  h('span', {
1899
- class: 'vxe-input--date-picker-btn vxe-input--date-picker-current-btn',
1673
+ class: 'vxe-date-input--date-picker-btn vxe-date-input--date-picker-current-btn',
1900
1674
  onClick: dateTodayMonthEvent
1901
1675
  }, [
1902
1676
  h('i', {
@@ -1904,7 +1678,7 @@ export default defineComponent({
1904
1678
  })
1905
1679
  ]),
1906
1680
  h('span', {
1907
- class: ['vxe-input--date-picker-btn vxe-input--date-picker-next-btn', {
1681
+ class: ['vxe-date-input--date-picker-btn vxe-date-input--date-picker-next-btn', {
1908
1682
  'is--disabled': isDisabledNextDateBtn
1909
1683
  }],
1910
1684
  onClick: dateNextEvent
@@ -1915,10 +1689,10 @@ export default defineComponent({
1915
1689
  ]),
1916
1690
  multiple && computeSupportMultiples.value
1917
1691
  ? h('span', {
1918
- class: 'vxe-input--date-picker-btn vxe-input--date-picker-confirm-btn'
1692
+ class: 'vxe-date-input--date-picker-btn vxe-date-input--date-picker-confirm-btn'
1919
1693
  }, [
1920
1694
  h('button', {
1921
- class: 'vxe-input--date-picker-confirm',
1695
+ class: 'vxe-date-input--date-picker-confirm',
1922
1696
  type: 'button',
1923
1697
  onClick: dateConfirmEvent
1924
1698
  }, getI18n('vxe.button.confirm'))
@@ -1927,7 +1701,7 @@ export default defineComponent({
1927
1701
  ])
1928
1702
  ]),
1929
1703
  h('div', {
1930
- class: 'vxe-input--date-picker-body'
1704
+ class: 'vxe-date-input--date-picker-body'
1931
1705
  }, renderDateTable())
1932
1706
  ];
1933
1707
  };
@@ -1939,23 +1713,23 @@ export default defineComponent({
1939
1713
  const secondList = computeSecondList.value;
1940
1714
  return [
1941
1715
  h('div', {
1942
- class: 'vxe-input--time-picker-header'
1716
+ class: 'vxe-date-input--time-picker-header'
1943
1717
  }, [
1944
1718
  h('span', {
1945
- class: 'vxe-input--time-picker-title'
1719
+ class: 'vxe-date-input--time-picker-title'
1946
1720
  }, dateTimeLabel),
1947
1721
  h('button', {
1948
- class: 'vxe-input--time-picker-confirm',
1722
+ class: 'vxe-date-input--time-picker-confirm',
1949
1723
  type: 'button',
1950
1724
  onClick: dateConfirmEvent
1951
1725
  }, getI18n('vxe.button.confirm'))
1952
1726
  ]),
1953
1727
  h('div', {
1954
1728
  ref: refInputTimeBody,
1955
- class: 'vxe-input--time-picker-body'
1729
+ class: 'vxe-date-input--time-picker-body'
1956
1730
  }, [
1957
1731
  h('ul', {
1958
- class: 'vxe-input--time-picker-hour-list'
1732
+ class: 'vxe-date-input--time-picker-hour-list'
1959
1733
  }, hourList.map((item, index) => {
1960
1734
  return h('li', {
1961
1735
  key: index,
@@ -1966,7 +1740,7 @@ export default defineComponent({
1966
1740
  }, item.label);
1967
1741
  })),
1968
1742
  h('ul', {
1969
- class: 'vxe-input--time-picker-minute-list'
1743
+ class: 'vxe-date-input--time-picker-minute-list'
1970
1744
  }, minuteList.map((item, index) => {
1971
1745
  return h('li', {
1972
1746
  key: index,
@@ -1977,7 +1751,7 @@ export default defineComponent({
1977
1751
  }, item.label);
1978
1752
  })),
1979
1753
  h('ul', {
1980
- class: 'vxe-input--time-picker-second-list'
1754
+ class: 'vxe-date-input--time-picker-second-list'
1981
1755
  }, secondList.map((item, index) => {
1982
1756
  return h('li', {
1983
1757
  key: index,
@@ -1999,24 +1773,24 @@ export default defineComponent({
1999
1773
  if (isDatePickerType) {
2000
1774
  if (type === 'datetime') {
2001
1775
  renders.push(h('div', {
2002
- class: 'vxe-input--panel-layout-wrapper'
1776
+ class: 'vxe-date-input--panel-layout-wrapper'
2003
1777
  }, [
2004
1778
  h('div', {
2005
- class: 'vxe-input--panel-left-wrapper'
1779
+ class: 'vxe-date-input--panel-left-wrapper'
2006
1780
  }, renderDatePanel()),
2007
1781
  h('div', {
2008
- class: 'vxe-input--panel-right-wrapper'
1782
+ class: 'vxe-date-input--panel-right-wrapper'
2009
1783
  }, renderTimePanel())
2010
1784
  ]));
2011
1785
  }
2012
1786
  else if (type === 'time') {
2013
1787
  renders.push(h('div', {
2014
- class: 'vxe-input--panel-wrapper'
1788
+ class: 'vxe-date-input--panel-wrapper'
2015
1789
  }, renderTimePanel()));
2016
1790
  }
2017
1791
  else {
2018
1792
  renders.push(h('div', {
2019
- class: 'vxe-input--panel-wrapper'
1793
+ class: 'vxe-date-input--panel-wrapper'
2020
1794
  }, renderDatePanel()));
2021
1795
  }
2022
1796
  return h(Teleport, {
@@ -2025,7 +1799,7 @@ export default defineComponent({
2025
1799
  }, [
2026
1800
  h('div', {
2027
1801
  ref: refInputPanel,
2028
- class: ['vxe-table--ignore-clear vxe-input--panel', `type--${type}`, {
1802
+ class: ['vxe-table--ignore-clear vxe-date-input--panel', `type--${type}`, {
2029
1803
  [`size--${vSize}`]: vSize,
2030
1804
  'is--transfer': transfer,
2031
1805
  'animat--leave': animatVisible,
@@ -2038,66 +1812,13 @@ export default defineComponent({
2038
1812
  }
2039
1813
  return null;
2040
1814
  };
2041
- const renderNumberIcon = () => {
2042
- const isDisabledAddNumber = computeIsDisabledAddNumber.value;
2043
- const isDisabledSubtractNumber = computeIsDisabledSubtractNumber.value;
2044
- return h('span', {
2045
- class: 'vxe-input--number-suffix'
2046
- }, [
2047
- h('span', {
2048
- class: ['vxe-input--number-prev is--prev', {
2049
- 'is--disabled': isDisabledAddNumber
2050
- }],
2051
- onMousedown: numberMousedownEvent,
2052
- onMouseup: numberStopDown,
2053
- onMouseleave: numberStopDown
2054
- }, [
2055
- h('i', {
2056
- class: ['vxe-input--number-prev-icon', getIcon().INPUT_PREV_NUM]
2057
- })
2058
- ]),
2059
- h('span', {
2060
- class: ['vxe-input--number-next is--next', {
2061
- 'is--disabled': isDisabledSubtractNumber
2062
- }],
2063
- onMousedown: numberMousedownEvent,
2064
- onMouseup: numberStopDown,
2065
- onMouseleave: numberStopDown
2066
- }, [
2067
- h('i', {
2068
- class: ['vxe-input--number-next-icon', getIcon().INPUT_NEXT_NUM]
2069
- })
2070
- ])
2071
- ]);
2072
- };
2073
1815
  const renderDatePickerIcon = () => {
2074
1816
  return h('span', {
2075
- class: 'vxe-input--date-picker-suffix',
1817
+ class: 'vxe-date-input--date-picker-suffix',
2076
1818
  onClick: datePickerOpenEvent
2077
1819
  }, [
2078
1820
  h('i', {
2079
- class: ['vxe-input--date-picker-icon', getIcon().INPUT_DATE]
2080
- })
2081
- ]);
2082
- };
2083
- const renderSearchIcon = () => {
2084
- return h('span', {
2085
- class: 'vxe-input--search-suffix',
2086
- onClick: searchEvent
2087
- }, [
2088
- h('i', {
2089
- class: ['vxe-input--search-icon', getIcon().INPUT_SEARCH]
2090
- })
2091
- ]);
2092
- };
2093
- const renderPasswordIcon = () => {
2094
- const { showPwd } = reactData;
2095
- return h('span', {
2096
- class: 'vxe-input--password-suffix',
2097
- onClick: passwordToggleEvent
2098
- }, [
2099
- h('i', {
2100
- class: ['vxe-input--password-icon', showPwd ? getIcon().INPUT_SHOW_PWD : getIcon().INPUT_PWD]
1821
+ class: ['vxe-date-input--date-picker-icon', getIcon().INPUT_DATE]
2101
1822
  })
2102
1823
  ]);
2103
1824
  };
@@ -2107,17 +1828,17 @@ export default defineComponent({
2107
1828
  const icons = [];
2108
1829
  if (prefixSlot) {
2109
1830
  icons.push(h('span', {
2110
- class: 'vxe-input--prefix-icon'
1831
+ class: 'vxe-date-input--prefix-icon'
2111
1832
  }, prefixSlot({})));
2112
1833
  }
2113
1834
  else if (prefixIcon) {
2114
1835
  icons.push(h('i', {
2115
- class: ['vxe-input--prefix-icon', prefixIcon]
1836
+ class: ['vxe-date-input--prefix-icon', prefixIcon]
2116
1837
  }));
2117
1838
  }
2118
1839
  return icons.length
2119
1840
  ? h('span', {
2120
- class: 'vxe-input--prefix',
1841
+ class: 'vxe-date-input--prefix',
2121
1842
  onClick: clickPrefixEvent
2122
1843
  }, icons)
2123
1844
  : null;
@@ -2130,22 +1851,22 @@ export default defineComponent({
2130
1851
  const icons = [];
2131
1852
  if (suffixSlot) {
2132
1853
  icons.push(h('span', {
2133
- class: 'vxe-input--suffix-icon'
1854
+ class: 'vxe-date-input--suffix-icon'
2134
1855
  }, suffixSlot({})));
2135
1856
  }
2136
1857
  else if (suffixIcon) {
2137
1858
  icons.push(h('i', {
2138
- class: ['vxe-input--suffix-icon', suffixIcon]
1859
+ class: ['vxe-date-input--suffix-icon', suffixIcon]
2139
1860
  }));
2140
1861
  }
2141
1862
  if (isClearable) {
2142
1863
  icons.push(h('i', {
2143
- class: ['vxe-input--clear-icon', getIcon().INPUT_CLEAR]
1864
+ class: ['vxe-date-input--clear-icon', getIcon().INPUT_CLEAR]
2144
1865
  }));
2145
1866
  }
2146
1867
  return icons.length
2147
1868
  ? h('span', {
2148
- class: ['vxe-input--suffix', {
1869
+ class: ['vxe-date-input--suffix', {
2149
1870
  'is--clear': isClearable && !disabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
2150
1871
  }],
2151
1872
  onClick: clickSuffixEvent
@@ -2153,29 +1874,14 @@ export default defineComponent({
2153
1874
  : null;
2154
1875
  };
2155
1876
  const renderExtraSuffixIcon = () => {
2156
- const { controls } = props;
2157
- const isNumType = computeIsNumType.value;
2158
1877
  const isDatePickerType = computeIsDatePickerType.value;
2159
- const isPawdType = computeIsPawdType.value;
2160
- const isSearchType = computeIsSearchType.value;
2161
1878
  let icons;
2162
- if (isPawdType) {
2163
- icons = renderPasswordIcon();
2164
- }
2165
- else if (isNumType) {
2166
- if (controls) {
2167
- icons = renderNumberIcon();
2168
- }
2169
- }
2170
- else if (isDatePickerType) {
1879
+ if (isDatePickerType) {
2171
1880
  icons = renderDatePickerIcon();
2172
1881
  }
2173
- else if (isSearchType) {
2174
- icons = renderSearchIcon();
2175
- }
2176
1882
  return icons
2177
1883
  ? h('span', {
2178
- class: 'vxe-input--extra-suffix'
1884
+ class: 'vxe-date-input--extra-suffix'
2179
1885
  }, [icons])
2180
1886
  : null;
2181
1887
  };
@@ -2237,7 +1943,6 @@ export default defineComponent({
2237
1943
  globalEvents.on($xeInput, 'blur', handleGlobalBlurEvent);
2238
1944
  });
2239
1945
  onUnmounted(() => {
2240
- numberStopDown();
2241
1946
  globalEvents.off($xeInput, 'mousewheel');
2242
1947
  globalEvents.off($xeInput, 'mousedown');
2243
1948
  globalEvents.off($xeInput, 'keydown');
@@ -2245,15 +1950,11 @@ export default defineComponent({
2245
1950
  });
2246
1951
  initValue();
2247
1952
  const renderVN = () => {
2248
- const { className, controls, type, align, showWordCount, countMethod, name, disabled, readonly, autocomplete } = props;
1953
+ const { className, controls, type, align, name, disabled, readonly, autocomplete } = props;
2249
1954
  const { inputValue, visiblePanel, isActivated } = reactData;
2250
1955
  const vSize = computeSize.value;
2251
- const isCountError = computeIsCountError.value;
2252
- const inputCount = computeInputCount.value;
2253
1956
  const isDatePickerType = computeIsDatePickerType.value;
2254
1957
  const inpReadonly = computeInpReadonly.value;
2255
- const inpMaxlength = computeInpMaxlength.value;
2256
- const inputType = computeInputType.value;
2257
1958
  const inpPlaceholder = computeInpPlaceholder.value;
2258
1959
  const childs = [];
2259
1960
  const prefix = rendePrefixIcon();
@@ -2265,18 +1966,16 @@ export default defineComponent({
2265
1966
  // 输入框
2266
1967
  childs.push(h('input', {
2267
1968
  ref: refInputTarget,
2268
- class: 'vxe-input--inner',
1969
+ class: 'vxe-date-input--inner',
2269
1970
  value: inputValue,
2270
1971
  name,
2271
- type: inputType,
1972
+ type: 'text',
2272
1973
  placeholder: inpPlaceholder,
2273
- maxlength: inpMaxlength,
2274
1974
  readonly: inpReadonly,
2275
1975
  disabled,
2276
1976
  autocomplete,
2277
1977
  onKeydown: keydownEvent,
2278
1978
  onKeyup: keyupEvent,
2279
- onWheel: wheelEvent,
2280
1979
  onClick: clickEvent,
2281
1980
  onInput: inputEvent,
2282
1981
  onChange: changeEvent,
@@ -2293,19 +1992,9 @@ export default defineComponent({
2293
1992
  if (isDatePickerType) {
2294
1993
  childs.push(renderPanel());
2295
1994
  }
2296
- let isWordCount = false;
2297
- // 统计字数
2298
- if (showWordCount && ['text', 'search'].includes(type)) {
2299
- isWordCount = true;
2300
- childs.push(h('span', {
2301
- class: ['vxe-input--count', {
2302
- 'is--error': isCountError
2303
- }]
2304
- }, countMethod ? `${countMethod({ value: inputValue })}` : `${inputCount}${inpMaxlength ? `/${inpMaxlength}` : ''}`));
2305
- }
2306
1995
  return h('div', {
2307
1996
  ref: refElem,
2308
- class: ['vxe-input', `type--${type}`, className, {
1997
+ class: ['vxe-date-input', `type--${type}`, className, {
2309
1998
  [`size--${vSize}`]: vSize,
2310
1999
  [`is--${align}`]: align,
2311
2000
  'is--controls': controls,
@@ -2313,7 +2002,6 @@ export default defineComponent({
2313
2002
  'is--suffix': !!suffix,
2314
2003
  'is--readonly': readonly,
2315
2004
  'is--visivle': visiblePanel,
2316
- 'is--count': isWordCount,
2317
2005
  'is--disabled': disabled,
2318
2006
  'is--active': isActivated
2319
2007
  }]