vxe-pc-ui 3.6.25 → 3.6.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/button/src/button.js +42 -27
- package/es/color-picker/src/color-picker.js +10 -0
- package/es/date-panel/src/date-panel.js +31 -17
- package/es/date-panel/src/util.js +26 -3
- package/es/date-picker/src/date-picker.js +51 -21
- package/es/date-range-picker/src/date-range-picker.js +15 -11
- package/es/icon/style.css +1 -1
- package/es/pulldown/src/pulldown.js +10 -0
- package/es/select/src/select.js +10 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table-select/src/table-select.js +10 -0
- package/es/tree-select/src/tree-select.js +10 -0
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +14 -11
- package/es/ui/src/log.js +1 -1
- package/lib/button/src/button.js +42 -29
- package/lib/button/src/button.min.js +1 -1
- package/lib/color-picker/src/color-picker.js +10 -0
- package/lib/color-picker/src/color-picker.min.js +1 -1
- package/lib/date-panel/src/date-panel.js +40 -18
- package/lib/date-panel/src/date-panel.min.js +1 -1
- package/lib/date-panel/src/util.js +29 -3
- package/lib/date-panel/src/util.min.js +1 -1
- package/lib/date-picker/src/date-picker.js +60 -22
- package/lib/date-picker/src/date-picker.min.js +1 -1
- package/lib/date-range-picker/src/date-range-picker.js +14 -10
- package/lib/date-range-picker/src/date-range-picker.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +248 -95
- package/lib/index.umd.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +10 -0
- package/lib/pulldown/src/pulldown.min.js +1 -1
- package/lib/select/src/select.js +10 -0
- package/lib/select/src/select.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table-select/src/table-select.js +10 -0
- package/lib/table-select/src/table-select.min.js +1 -1
- package/lib/tree-select/src/tree-select.js +10 -0
- package/lib/tree-select/src/tree-select.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/dom.js +14 -11
- package/lib/ui/src/dom.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/button/src/button.ts +47 -27
- package/packages/color-picker/src/color-picker.ts +11 -0
- package/packages/date-panel/src/date-panel.ts +29 -17
- package/packages/date-panel/src/util.ts +29 -3
- package/packages/date-picker/src/date-picker.ts +50 -21
- package/packages/date-range-picker/src/date-range-picker.ts +16 -11
- package/packages/pulldown/src/pulldown.ts +11 -0
- package/packages/select/src/select.ts +11 -0
- package/packages/table-select/src/table-select.ts +11 -0
- package/packages/tree-select/src/tree-select.ts +11 -0
- package/packages/ui/src/dom.ts +14 -11
- package/types/components/date-panel.d.ts +2 -0
- package/types/components/date-picker.d.ts +2 -0
- package/types/components/date-range-picker.d.ts +2 -0
- package/types/components/table.d.ts +24 -16
- /package/es/icon/{iconfont.1750149565834.ttf → iconfont.1750386595058.ttf} +0 -0
- /package/es/icon/{iconfont.1750149565834.woff → iconfont.1750386595058.woff} +0 -0
- /package/es/icon/{iconfont.1750149565834.woff2 → iconfont.1750386595058.woff2} +0 -0
- /package/es/{iconfont.1750149565834.ttf → iconfont.1750386595058.ttf} +0 -0
- /package/es/{iconfont.1750149565834.woff → iconfont.1750386595058.woff} +0 -0
- /package/es/{iconfont.1750149565834.woff2 → iconfont.1750386595058.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1750149565834.ttf → iconfont.1750386595058.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1750149565834.woff → iconfont.1750386595058.woff} +0 -0
- /package/lib/icon/style/{iconfont.1750149565834.woff2 → iconfont.1750386595058.woff2} +0 -0
- /package/lib/{iconfont.1750149565834.ttf → iconfont.1750386595058.ttf} +0 -0
- /package/lib/{iconfont.1750149565834.woff → iconfont.1750386595058.woff} +0 -0
- /package/lib/{iconfont.1750149565834.woff2 → iconfont.1750386595058.woff2} +0 -0
package/es/button/src/button.js
CHANGED
|
@@ -276,7 +276,7 @@ export default {
|
|
|
276
276
|
}
|
|
277
277
|
internalData.showTime = setTimeout(() => {
|
|
278
278
|
if (panelElem.dataset.active === 'Y') {
|
|
279
|
-
|
|
279
|
+
$xeButton.mouseenterDropdownEvent();
|
|
280
280
|
}
|
|
281
281
|
else {
|
|
282
282
|
reactData.isAniVisible = false;
|
|
@@ -312,7 +312,7 @@ export default {
|
|
|
312
312
|
reactData.isAniVisible = false;
|
|
313
313
|
reactData.visiblePanel = false;
|
|
314
314
|
}
|
|
315
|
-
return
|
|
315
|
+
return $xeButton.$nextTick();
|
|
316
316
|
},
|
|
317
317
|
focus() {
|
|
318
318
|
const $xeButton = this;
|
|
@@ -328,7 +328,7 @@ export default {
|
|
|
328
328
|
if (btnElem) {
|
|
329
329
|
btnElem.blur();
|
|
330
330
|
}
|
|
331
|
-
return
|
|
331
|
+
return $xeButton.$nextTick();
|
|
332
332
|
},
|
|
333
333
|
//
|
|
334
334
|
// privateMethods
|
|
@@ -365,11 +365,12 @@ export default {
|
|
|
365
365
|
},
|
|
366
366
|
clickEvent(evnt) {
|
|
367
367
|
const $xeButton = this;
|
|
368
|
+
const props = $xeButton;
|
|
368
369
|
const $xeButtonGroup = $xeButton.$xeButtonGroup;
|
|
369
370
|
if ($xeButtonGroup) {
|
|
370
|
-
$xeButtonGroup.handleClick({ name:
|
|
371
|
+
$xeButtonGroup.handleClick({ name: props.name }, evnt);
|
|
371
372
|
}
|
|
372
|
-
|
|
373
|
+
$xeButton.dispatchEvent('click', { $event: evnt }, evnt);
|
|
373
374
|
},
|
|
374
375
|
downBtnClickEvent(params, option) {
|
|
375
376
|
const $xeButton = this;
|
|
@@ -387,7 +388,7 @@ export default {
|
|
|
387
388
|
const $xeButton = this;
|
|
388
389
|
const reactData = $xeButton.reactData;
|
|
389
390
|
const dropdownElem = evnt.currentTarget;
|
|
390
|
-
const panelElem =
|
|
391
|
+
const panelElem = $xeButton.$refs.refBtnPanel;
|
|
391
392
|
const { flag, targetElem } = getEventTargetNode(evnt, dropdownElem, 'vxe-button');
|
|
392
393
|
if (flag) {
|
|
393
394
|
if (panelElem) {
|
|
@@ -399,24 +400,24 @@ export default {
|
|
|
399
400
|
reactData.isAniVisible = false;
|
|
400
401
|
}
|
|
401
402
|
}, 350);
|
|
402
|
-
|
|
403
|
+
$xeButton.dispatchEvent('dropdown-click', { name: targetElem.getAttribute('name'), option: null, $event: evnt }, evnt);
|
|
403
404
|
}
|
|
404
405
|
},
|
|
405
406
|
mouseenterDropdownEvent() {
|
|
406
407
|
const $xeButton = this;
|
|
407
408
|
const reactData = $xeButton.reactData;
|
|
408
|
-
const panelElem =
|
|
409
|
+
const panelElem = $xeButton.$refs.refBtnPanel;
|
|
409
410
|
if (panelElem) {
|
|
410
411
|
panelElem.dataset.active = 'Y';
|
|
411
412
|
reactData.isAniVisible = true;
|
|
412
413
|
setTimeout(() => {
|
|
413
414
|
if (panelElem.dataset.active === 'Y') {
|
|
414
415
|
reactData.visiblePanel = true;
|
|
415
|
-
|
|
416
|
-
|
|
416
|
+
$xeButton.updateZindex();
|
|
417
|
+
$xeButton.updatePlacement();
|
|
417
418
|
setTimeout(() => {
|
|
418
419
|
if (reactData.visiblePanel) {
|
|
419
|
-
|
|
420
|
+
$xeButton.updatePlacement();
|
|
420
421
|
}
|
|
421
422
|
}, 50);
|
|
422
423
|
}
|
|
@@ -429,19 +430,22 @@ export default {
|
|
|
429
430
|
const { loading } = props;
|
|
430
431
|
const btnDisabled = $xeButton.computeBtnDisabled;
|
|
431
432
|
if (!(btnDisabled || loading)) {
|
|
432
|
-
|
|
433
|
-
|
|
433
|
+
$xeButton.openPanel();
|
|
434
|
+
$xeButton.mouseenterEvent(evnt);
|
|
434
435
|
}
|
|
435
436
|
},
|
|
436
437
|
mouseleaveTargetEvent(evnt) {
|
|
437
|
-
this
|
|
438
|
-
|
|
438
|
+
const $xeButton = this;
|
|
439
|
+
$xeButton.hidePanel();
|
|
440
|
+
$xeButton.mouseleaveEvent(evnt);
|
|
439
441
|
},
|
|
440
442
|
mouseenterEvent(evnt) {
|
|
441
|
-
|
|
443
|
+
const $xeButton = this;
|
|
444
|
+
$xeButton.dispatchEvent('mouseenter', {}, evnt);
|
|
442
445
|
},
|
|
443
446
|
mouseleaveEvent(evnt) {
|
|
444
|
-
|
|
447
|
+
const $xeButton = this;
|
|
448
|
+
$xeButton.dispatchEvent('mouseleave', {}, evnt);
|
|
445
449
|
},
|
|
446
450
|
clickTargetEvent(evnt) {
|
|
447
451
|
const $xeButton = this;
|
|
@@ -453,40 +457,49 @@ export default {
|
|
|
453
457
|
const { trigger } = props;
|
|
454
458
|
if (trigger === 'click') {
|
|
455
459
|
if (reactData.visiblePanel) {
|
|
456
|
-
|
|
460
|
+
$xeButton.hidePanel();
|
|
457
461
|
}
|
|
458
462
|
else {
|
|
459
|
-
|
|
463
|
+
$xeButton.openPanel();
|
|
460
464
|
}
|
|
461
465
|
}
|
|
462
|
-
|
|
466
|
+
$xeButton.clickEvent(evnt);
|
|
463
467
|
}
|
|
464
468
|
},
|
|
465
469
|
mouseleaveDropdownEvent() {
|
|
466
|
-
this
|
|
470
|
+
const $xeButton = this;
|
|
471
|
+
$xeButton.hidePanel();
|
|
467
472
|
},
|
|
468
473
|
handleGlobalMousewheelEvent(evnt) {
|
|
469
474
|
const $xeButton = this;
|
|
470
475
|
const reactData = $xeButton.reactData;
|
|
471
|
-
const panelElem =
|
|
476
|
+
const panelElem = $xeButton.$refs.refBtnPanel;
|
|
472
477
|
if (reactData.visiblePanel && !getEventTargetNode(evnt, panelElem).flag) {
|
|
473
|
-
|
|
478
|
+
$xeButton.hidePanel();
|
|
474
479
|
}
|
|
475
480
|
},
|
|
476
481
|
handleGlobalMousedownEvent(evnt) {
|
|
477
482
|
const $xeButton = this;
|
|
478
483
|
const reactData = $xeButton.reactData;
|
|
479
|
-
const btnDisabled =
|
|
484
|
+
const btnDisabled = $xeButton.computeBtnDisabled;
|
|
480
485
|
const { visiblePanel } = reactData;
|
|
481
486
|
if (!btnDisabled) {
|
|
482
|
-
const el =
|
|
483
|
-
const panelElem =
|
|
487
|
+
const el = $xeButton.$refs.refElem;
|
|
488
|
+
const panelElem = $xeButton.$refs.refBtnPanel;
|
|
484
489
|
reactData.isActivated = getEventTargetNode(evnt, el).flag || getEventTargetNode(evnt, panelElem).flag;
|
|
485
490
|
if (visiblePanel && !reactData.isActivated) {
|
|
486
|
-
|
|
491
|
+
$xeButton.hidePanel();
|
|
487
492
|
}
|
|
488
493
|
}
|
|
489
494
|
},
|
|
495
|
+
handleGlobalResizeEvent() {
|
|
496
|
+
const $xeButton = this;
|
|
497
|
+
const reactData = $xeButton.reactData;
|
|
498
|
+
const { visiblePanel } = reactData;
|
|
499
|
+
if (visiblePanel) {
|
|
500
|
+
$xeButton.updatePlacement();
|
|
501
|
+
}
|
|
502
|
+
},
|
|
490
503
|
//
|
|
491
504
|
// Render
|
|
492
505
|
//
|
|
@@ -752,6 +765,7 @@ export default {
|
|
|
752
765
|
}
|
|
753
766
|
globalEvents.on($xeButton, 'mousewheel', $xeButton.handleGlobalMousewheelEvent);
|
|
754
767
|
globalEvents.on($xeButton, 'mousedown', $xeButton.handleGlobalMousedownEvent);
|
|
768
|
+
globalEvents.on($xeButton, 'resize', $xeButton.handleGlobalResizeEvent);
|
|
755
769
|
},
|
|
756
770
|
beforeDestroy() {
|
|
757
771
|
const $xeButton = this;
|
|
@@ -764,6 +778,7 @@ export default {
|
|
|
764
778
|
const $xeButton = this;
|
|
765
779
|
globalEvents.off($xeButton, 'mousewheel');
|
|
766
780
|
globalEvents.off($xeButton, 'mousedown');
|
|
781
|
+
globalEvents.off($xeButton, 'resize');
|
|
767
782
|
},
|
|
768
783
|
render(h) {
|
|
769
784
|
return this.renderVN(h);
|
|
@@ -653,6 +653,14 @@ export default {
|
|
|
653
653
|
const $xeColorPicker = this;
|
|
654
654
|
$xeColorPicker.hideOptionPanel();
|
|
655
655
|
},
|
|
656
|
+
handleGlobalResizeEvent() {
|
|
657
|
+
const $xeColorPicker = this;
|
|
658
|
+
const reactData = $xeColorPicker.reactData;
|
|
659
|
+
const { visiblePanel } = reactData;
|
|
660
|
+
if (visiblePanel) {
|
|
661
|
+
$xeColorPicker.updatePlacement();
|
|
662
|
+
}
|
|
663
|
+
},
|
|
656
664
|
//
|
|
657
665
|
// Render
|
|
658
666
|
//
|
|
@@ -1063,6 +1071,7 @@ export default {
|
|
|
1063
1071
|
globalEvents.on($xeColorPicker, 'mousewheel', $xeColorPicker.handleGlobalMousewheelEvent);
|
|
1064
1072
|
globalEvents.on($xeColorPicker, 'mousedown', $xeColorPicker.handleGlobalMousedownEvent);
|
|
1065
1073
|
globalEvents.on($xeColorPicker, 'blur', $xeColorPicker.handleGlobalBlurEvent);
|
|
1074
|
+
globalEvents.on($xeColorPicker, 'resize', $xeColorPicker.handleGlobalResizeEvent);
|
|
1066
1075
|
},
|
|
1067
1076
|
beforeDestroy() {
|
|
1068
1077
|
const $xeColorPicker = this;
|
|
@@ -1073,6 +1082,7 @@ export default {
|
|
|
1073
1082
|
globalEvents.off($xeColorPicker, 'mousewheel');
|
|
1074
1083
|
globalEvents.off($xeColorPicker, 'mousedown');
|
|
1075
1084
|
globalEvents.off($xeColorPicker, 'blur');
|
|
1085
|
+
globalEvents.off($xeColorPicker, 'resize');
|
|
1076
1086
|
},
|
|
1077
1087
|
render(h) {
|
|
1078
1088
|
return this.renderVN(h);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineVxeComponent } from '../../ui/src/comp';
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
3
|
import { getConfig, getI18n, createEvent, globalMixins, renderEmptyElement } from '../../ui';
|
|
4
|
-
import { toStringTimeDate, getDateQuarter, parseDateValue, parseDateObj } from './util';
|
|
4
|
+
import { toStringTimeDate, getDateQuarter, parseDateValue, parseDateObj, handleValueFormat, hasDateValueType, hasTimestampValueType } from './util';
|
|
5
5
|
export default {
|
|
6
6
|
name: 'VxeDatePanel',
|
|
7
7
|
mixins: [
|
|
@@ -45,6 +45,7 @@ export default {
|
|
|
45
45
|
},
|
|
46
46
|
labelFormat: String,
|
|
47
47
|
valueFormat: String,
|
|
48
|
+
timeFormat: String,
|
|
48
49
|
festivalMethod: {
|
|
49
50
|
type: Function,
|
|
50
51
|
default: () => getConfig().datePanel.festivalMethod
|
|
@@ -156,16 +157,7 @@ export default {
|
|
|
156
157
|
const $xeDatePanel = this;
|
|
157
158
|
const props = $xeDatePanel;
|
|
158
159
|
const { type, valueFormat } = props;
|
|
159
|
-
|
|
160
|
-
return valueFormat;
|
|
161
|
-
}
|
|
162
|
-
if (type === 'time') {
|
|
163
|
-
return 'HH:mm:ss';
|
|
164
|
-
}
|
|
165
|
-
if (type === 'datetime') {
|
|
166
|
-
return 'yyyy-MM-dd HH:mm:ss';
|
|
167
|
-
}
|
|
168
|
-
return 'yyyy-MM-dd';
|
|
160
|
+
return handleValueFormat(type, valueFormat);
|
|
169
161
|
},
|
|
170
162
|
computeDateValue() {
|
|
171
163
|
const $xeDatePanel = this;
|
|
@@ -493,13 +485,17 @@ export default {
|
|
|
493
485
|
},
|
|
494
486
|
computeHasTimeMinute() {
|
|
495
487
|
const $xeDatePanel = this;
|
|
488
|
+
const props = $xeDatePanel;
|
|
489
|
+
const { timeFormat } = props;
|
|
496
490
|
const dateValueFormat = $xeDatePanel.computeDateValueFormat;
|
|
497
|
-
return !/HH/.test(dateValueFormat) || /mm/.test(dateValueFormat);
|
|
491
|
+
return !/HH/.test(timeFormat || dateValueFormat) || /mm/.test(timeFormat || dateValueFormat);
|
|
498
492
|
},
|
|
499
493
|
computeHasTimeSecond() {
|
|
500
494
|
const $xeDatePanel = this;
|
|
495
|
+
const props = $xeDatePanel;
|
|
496
|
+
const { timeFormat } = props;
|
|
501
497
|
const dateValueFormat = $xeDatePanel.computeDateValueFormat;
|
|
502
|
-
return !/HH/.test(dateValueFormat) || /ss/.test(dateValueFormat);
|
|
498
|
+
return !/HH/.test(timeFormat || dateValueFormat) || /ss/.test(timeFormat || dateValueFormat);
|
|
503
499
|
},
|
|
504
500
|
computeSecondList() {
|
|
505
501
|
const $xeDatePanel = this;
|
|
@@ -606,11 +602,29 @@ export default {
|
|
|
606
602
|
const $xeDatePanel = this;
|
|
607
603
|
const props = $xeDatePanel;
|
|
608
604
|
const reactData = $xeDatePanel.reactData;
|
|
609
|
-
const { value: modelValue } = props;
|
|
605
|
+
const { type, value: modelValue, valueFormat } = props;
|
|
606
|
+
const dateValueFormat = $xeDatePanel.computeDateValueFormat;
|
|
610
607
|
reactData.inputValue = value;
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
608
|
+
if (hasTimestampValueType(valueFormat)) {
|
|
609
|
+
const dateVal = parseDateValue(value, type, { valueFormat: dateValueFormat });
|
|
610
|
+
const timeNum = dateVal ? dateVal.getTime() : null;
|
|
611
|
+
$xeDatePanel.emitModel(timeNum);
|
|
612
|
+
if (modelValue !== timeNum) {
|
|
613
|
+
$xeDatePanel.dispatchEvent('change', { value: timeNum }, evnt);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
else if (hasDateValueType(valueFormat)) {
|
|
617
|
+
const dateVal = parseDateValue(value, type, { valueFormat: dateValueFormat });
|
|
618
|
+
$xeDatePanel.emitModel(dateVal);
|
|
619
|
+
if (modelValue && dateVal ? XEUtils.toStringDate(modelValue).getTime() !== dateVal.getTime() : modelValue !== dateVal) {
|
|
620
|
+
$xeDatePanel.dispatchEvent('change', { value: dateVal }, evnt);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
$xeDatePanel.emitModel(value);
|
|
625
|
+
if (XEUtils.toValueString(modelValue) !== value) {
|
|
626
|
+
$xeDatePanel.dispatchEvent('change', { value }, evnt);
|
|
627
|
+
}
|
|
614
628
|
}
|
|
615
629
|
},
|
|
616
630
|
hidePanel() {
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils';
|
|
2
|
+
export function hasTimestampValueType(valueFormat) {
|
|
3
|
+
return valueFormat === 'timestamp';
|
|
4
|
+
}
|
|
5
|
+
export function hasDateValueType(valueFormat) {
|
|
6
|
+
return valueFormat === 'date';
|
|
7
|
+
}
|
|
8
|
+
export function handleValueFormat(type, valueFormat) {
|
|
9
|
+
if (valueFormat) {
|
|
10
|
+
if (!(hasDateValueType(valueFormat) || hasTimestampValueType(valueFormat))) {
|
|
11
|
+
return valueFormat;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
if (type === 'time') {
|
|
15
|
+
return 'HH:mm:ss';
|
|
16
|
+
}
|
|
17
|
+
if (type === 'datetime') {
|
|
18
|
+
return 'yyyy-MM-dd HH:mm:ss';
|
|
19
|
+
}
|
|
20
|
+
return 'yyyy-MM-dd';
|
|
21
|
+
}
|
|
2
22
|
export function toStringTimeDate(str) {
|
|
23
|
+
const rest = new Date(2e3, 0, 1);
|
|
3
24
|
if (str) {
|
|
4
|
-
const rest = new Date();
|
|
5
25
|
let h = 0;
|
|
6
26
|
let m = 0;
|
|
7
27
|
let s = 0;
|
|
28
|
+
if (XEUtils.isNumber(str) || /^[0-9]{11,15}$/.test(`${str}`)) {
|
|
29
|
+
str = new Date(Number(str));
|
|
30
|
+
}
|
|
8
31
|
if (XEUtils.isDate(str)) {
|
|
9
32
|
h = str.getHours();
|
|
10
33
|
m = str.getMinutes();
|
|
@@ -24,7 +47,7 @@ export function toStringTimeDate(str) {
|
|
|
24
47
|
rest.setSeconds(s);
|
|
25
48
|
return rest;
|
|
26
49
|
}
|
|
27
|
-
return
|
|
50
|
+
return rest;
|
|
28
51
|
}
|
|
29
52
|
export function getDateQuarter(date) {
|
|
30
53
|
const month = date.getMonth();
|
|
@@ -45,7 +68,7 @@ export const parseDateValue = (val, type, options) => {
|
|
|
45
68
|
if (type === 'time') {
|
|
46
69
|
return toStringTimeDate(val);
|
|
47
70
|
}
|
|
48
|
-
if (XEUtils.isNumber(val) || /^[0-9]{
|
|
71
|
+
if (XEUtils.isNumber(val) || /^[0-9]{10,15}$/.test(`${val}`)) {
|
|
49
72
|
return new Date(Number(val));
|
|
50
73
|
}
|
|
51
74
|
if (XEUtils.isString(val)) {
|
|
@@ -4,7 +4,7 @@ import { getConfig, getIcon, getI18n, commands, createEvent, globalEvents, globa
|
|
|
4
4
|
import { getFuncText, getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils';
|
|
5
5
|
import { updatePanelPlacement, getEventTargetNode } from '../../ui/src/dom';
|
|
6
6
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
7
|
-
import { parseDateObj, getDateByCode } from '../../date-panel/src/util';
|
|
7
|
+
import { parseDateObj, parseDateValue, getDateByCode, handleValueFormat, hasDateValueType, hasTimestampValueType } from '../../date-panel/src/util';
|
|
8
8
|
import { errLog } from '../../ui/src/log';
|
|
9
9
|
import VxeDatePanelComponent from '../../date-panel/src/date-panel';
|
|
10
10
|
import VxeButtonComponent from '../../button/src/button';
|
|
@@ -75,6 +75,7 @@ export default {
|
|
|
75
75
|
},
|
|
76
76
|
labelFormat: String,
|
|
77
77
|
valueFormat: String,
|
|
78
|
+
timeFormat: String,
|
|
78
79
|
editable: {
|
|
79
80
|
type: Boolean,
|
|
80
81
|
default: true
|
|
@@ -277,16 +278,7 @@ export default {
|
|
|
277
278
|
const $xeDatePicker = this;
|
|
278
279
|
const props = $xeDatePicker;
|
|
279
280
|
const { type, valueFormat } = props;
|
|
280
|
-
|
|
281
|
-
return valueFormat;
|
|
282
|
-
}
|
|
283
|
-
if (type === 'time') {
|
|
284
|
-
return 'HH:mm:ss';
|
|
285
|
-
}
|
|
286
|
-
if (type === 'datetime') {
|
|
287
|
-
return 'yyyy-MM-dd HH:mm:ss';
|
|
288
|
-
}
|
|
289
|
-
return 'yyyy-MM-dd';
|
|
281
|
+
return handleValueFormat(type, valueFormat);
|
|
290
282
|
},
|
|
291
283
|
computeFirstDayOfWeek() {
|
|
292
284
|
const $xeDatePicker = this;
|
|
@@ -359,14 +351,40 @@ export default {
|
|
|
359
351
|
const reactData = $xeDatePicker.reactData;
|
|
360
352
|
const $xeForm = $xeDatePicker.$xeForm;
|
|
361
353
|
const formItemInfo = $xeDatePicker.formItemInfo;
|
|
362
|
-
const { value: modelValue } = props;
|
|
354
|
+
const { type, value: modelValue, valueFormat } = props;
|
|
355
|
+
const dateValueFormat = $xeDatePicker.computeDateValueFormat;
|
|
363
356
|
reactData.inputValue = value;
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
if (
|
|
369
|
-
$
|
|
357
|
+
if (hasTimestampValueType(valueFormat)) {
|
|
358
|
+
const dateVal = parseDateValue(value, type, { valueFormat: dateValueFormat });
|
|
359
|
+
const timeNum = dateVal ? dateVal.getTime() : null;
|
|
360
|
+
$xeDatePicker.emitModel(timeNum);
|
|
361
|
+
if (modelValue !== timeNum) {
|
|
362
|
+
$xeDatePicker.dispatchEvent('change', { value: timeNum }, evnt);
|
|
363
|
+
// 自动更新校验状态
|
|
364
|
+
if ($xeForm && formItemInfo) {
|
|
365
|
+
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, timeNum);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
else if (hasDateValueType(valueFormat)) {
|
|
370
|
+
const dateVal = parseDateValue(value, type, { valueFormat: dateValueFormat });
|
|
371
|
+
$xeDatePicker.emitModel(dateVal);
|
|
372
|
+
if (modelValue && dateVal ? XEUtils.toStringDate(modelValue).getTime() !== dateVal.getTime() : modelValue !== dateVal) {
|
|
373
|
+
$xeDatePicker.dispatchEvent('change', { value: dateVal }, evnt);
|
|
374
|
+
// 自动更新校验状态
|
|
375
|
+
if ($xeForm && formItemInfo) {
|
|
376
|
+
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, dateVal);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
$xeDatePicker.emitModel(value);
|
|
382
|
+
if (XEUtils.toValueString(modelValue) !== value) {
|
|
383
|
+
$xeDatePicker.dispatchEvent('change', { value }, evnt);
|
|
384
|
+
// 自动更新校验状态
|
|
385
|
+
if ($xeForm && formItemInfo) {
|
|
386
|
+
$xeForm.triggerItemEvent(evnt, formItemInfo.itemConfig.field, value);
|
|
387
|
+
}
|
|
370
388
|
}
|
|
371
389
|
}
|
|
372
390
|
},
|
|
@@ -448,9 +466,10 @@ export default {
|
|
|
448
466
|
}
|
|
449
467
|
if (!reactData.visiblePanel) {
|
|
450
468
|
reactData.isActivated = false;
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
469
|
+
// 未打开面板时才校验
|
|
470
|
+
if ($datePanel) {
|
|
471
|
+
$datePanel.checkValue(reactData.inputLabel);
|
|
472
|
+
}
|
|
454
473
|
}
|
|
455
474
|
$xeDatePicker.dispatchEvent('blur', { value }, evnt);
|
|
456
475
|
// 自动更新校验状态
|
|
@@ -542,6 +561,14 @@ export default {
|
|
|
542
561
|
}
|
|
543
562
|
}
|
|
544
563
|
},
|
|
564
|
+
handleGlobalResizeEvent() {
|
|
565
|
+
const $xeDatePicker = this;
|
|
566
|
+
const reactData = $xeDatePicker.reactData;
|
|
567
|
+
const { visiblePanel } = reactData;
|
|
568
|
+
if (visiblePanel) {
|
|
569
|
+
$xeDatePicker.updatePlacement();
|
|
570
|
+
}
|
|
571
|
+
},
|
|
545
572
|
// 弹出面板
|
|
546
573
|
updateZindex() {
|
|
547
574
|
const $xeDatePicker = this;
|
|
@@ -821,6 +848,7 @@ export default {
|
|
|
821
848
|
startDay: props.startDay,
|
|
822
849
|
labelFormat: props.labelFormat,
|
|
823
850
|
valueFormat: props.valueFormat,
|
|
851
|
+
timeFormat: props.timeFormat,
|
|
824
852
|
festivalMethod: props.festivalMethod,
|
|
825
853
|
disabledMethod: props.disabledMethod,
|
|
826
854
|
selectDay: props.selectDay
|
|
@@ -1053,6 +1081,7 @@ export default {
|
|
|
1053
1081
|
globalEvents.on($xeDatePicker, 'mousewheel', $xeDatePicker.handleGlobalMousewheelEvent);
|
|
1054
1082
|
globalEvents.on($xeDatePicker, 'mousedown', $xeDatePicker.handleGlobalMousedownEvent);
|
|
1055
1083
|
globalEvents.on($xeDatePicker, 'blur', $xeDatePicker.handleGlobalBlurEvent);
|
|
1084
|
+
globalEvents.on($xeDatePicker, 'resize', $xeDatePicker.handleGlobalResizeEvent);
|
|
1056
1085
|
},
|
|
1057
1086
|
beforeDestroy() {
|
|
1058
1087
|
const $xeDatePicker = this;
|
|
@@ -1063,6 +1092,7 @@ export default {
|
|
|
1063
1092
|
globalEvents.off($xeDatePicker, 'mousewheel');
|
|
1064
1093
|
globalEvents.off($xeDatePicker, 'mousedown');
|
|
1065
1094
|
globalEvents.off($xeDatePicker, 'blur');
|
|
1095
|
+
globalEvents.off($xeDatePicker, 'resize');
|
|
1066
1096
|
},
|
|
1067
1097
|
render(h) {
|
|
1068
1098
|
return this.renderVN(h);
|
|
@@ -3,7 +3,7 @@ import XEUtils from 'xe-utils';
|
|
|
3
3
|
import { getConfig, getIcon, getI18n, commands, globalEvents, createEvent, globalMixins, renderEmptyElement } from '../../ui';
|
|
4
4
|
import { getFuncText, getLastZIndex, nextZIndex, isEnableConf } from '../../ui/src/utils';
|
|
5
5
|
import { updatePanelPlacement, getEventTargetNode } from '../../ui/src/dom';
|
|
6
|
-
import { parseDateString, parseDateObj, getRangeDateByCode } from '../../date-panel/src/util';
|
|
6
|
+
import { parseDateString, parseDateObj, getRangeDateByCode, handleValueFormat } from '../../date-panel/src/util';
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn';
|
|
8
8
|
import { errLog } from '../../ui/src/log';
|
|
9
9
|
import VxeDatePanelComponent from '../../date-panel/src/date-panel';
|
|
@@ -63,6 +63,7 @@ export default {
|
|
|
63
63
|
},
|
|
64
64
|
labelFormat: String,
|
|
65
65
|
valueFormat: String,
|
|
66
|
+
timeFormat: String,
|
|
66
67
|
editable: {
|
|
67
68
|
type: Boolean,
|
|
68
69
|
default: true
|
|
@@ -266,16 +267,7 @@ export default {
|
|
|
266
267
|
const $xeDateRangePicker = this;
|
|
267
268
|
const props = $xeDateRangePicker;
|
|
268
269
|
const { type, valueFormat } = props;
|
|
269
|
-
|
|
270
|
-
return valueFormat;
|
|
271
|
-
}
|
|
272
|
-
if (type === 'time') {
|
|
273
|
-
return 'HH:mm:ss';
|
|
274
|
-
}
|
|
275
|
-
if (type === 'datetime') {
|
|
276
|
-
return 'yyyy-MM-dd HH:mm:ss';
|
|
277
|
-
}
|
|
278
|
-
return 'yyyy-MM-dd';
|
|
270
|
+
return handleValueFormat(type, valueFormat);
|
|
279
271
|
},
|
|
280
272
|
computeFirstDayOfWeek() {
|
|
281
273
|
const $xeDateRangePicker = this;
|
|
@@ -676,6 +668,14 @@ export default {
|
|
|
676
668
|
$xeDateRangePicker.hidePanel();
|
|
677
669
|
}
|
|
678
670
|
},
|
|
671
|
+
handleGlobalResizeEvent() {
|
|
672
|
+
const $xeDateRangePicker = this;
|
|
673
|
+
const reactData = $xeDateRangePicker.reactData;
|
|
674
|
+
const { visiblePanel } = reactData;
|
|
675
|
+
if (visiblePanel) {
|
|
676
|
+
$xeDateRangePicker.updatePlacement();
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
679
|
// 弹出面板
|
|
680
680
|
updateZindex() {
|
|
681
681
|
const $xeDateRangePicker = this;
|
|
@@ -965,6 +965,7 @@ export default {
|
|
|
965
965
|
endDate: endValue,
|
|
966
966
|
labelFormat: props.labelFormat,
|
|
967
967
|
valueFormat: props.valueFormat,
|
|
968
|
+
timeFormat: props.timeFormat,
|
|
968
969
|
festivalMethod: props.festivalMethod,
|
|
969
970
|
disabledMethod: props.disabledMethod,
|
|
970
971
|
selectDay: props.selectDay
|
|
@@ -985,6 +986,7 @@ export default {
|
|
|
985
986
|
startDate: startValue,
|
|
986
987
|
labelFormat: props.labelFormat,
|
|
987
988
|
valueFormat: props.valueFormat,
|
|
989
|
+
timeFormat: props.timeFormat,
|
|
988
990
|
festivalMethod: props.festivalMethod,
|
|
989
991
|
disabledMethod: props.disabledMethod,
|
|
990
992
|
selectDay: props.selectDay
|
|
@@ -1221,6 +1223,7 @@ export default {
|
|
|
1221
1223
|
globalEvents.on($xeDateRangePicker, 'mousewheel', $xeDateRangePicker.handleGlobalMousewheelEvent);
|
|
1222
1224
|
globalEvents.on($xeDateRangePicker, 'mousedown', $xeDateRangePicker.handleGlobalMousedownEvent);
|
|
1223
1225
|
globalEvents.on($xeDateRangePicker, 'blur', $xeDateRangePicker.handleGlobalBlurEvent);
|
|
1226
|
+
globalEvents.on($xeDateRangePicker, 'resize', $xeDateRangePicker.handleGlobalResizeEvent);
|
|
1224
1227
|
},
|
|
1225
1228
|
deactivated() {
|
|
1226
1229
|
const $xeDateRangePicker = this;
|
|
@@ -1236,6 +1239,7 @@ export default {
|
|
|
1236
1239
|
globalEvents.off($xeDateRangePicker, 'mousewheel');
|
|
1237
1240
|
globalEvents.off($xeDateRangePicker, 'mousedown');
|
|
1238
1241
|
globalEvents.off($xeDateRangePicker, 'blur');
|
|
1242
|
+
globalEvents.off($xeDateRangePicker, 'resize');
|
|
1239
1243
|
},
|
|
1240
1244
|
render(h) {
|
|
1241
1245
|
return this.renderVN(h);
|