@king-design/intact 3.5.2 → 3.6.0
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/components/.DS_Store +0 -0
- package/components/button/index.md +1 -0
- package/components/cascader/index.spec.ts +7 -6
- package/components/datepicker/basepicker.ts +26 -267
- package/components/datepicker/calendar.ts +8 -2
- package/components/datepicker/calendar.vdt +23 -6
- package/components/datepicker/dayjs.ts +8 -2
- package/components/datepicker/demos/multiple.md +1 -1
- package/components/datepicker/demos/yearMonth.md +1 -1
- package/components/datepicker/helpers.ts +10 -12
- package/components/datepicker/index.md +2 -2
- package/components/datepicker/index.spec.ts +619 -190
- package/components/datepicker/index.ts +22 -21
- package/components/datepicker/index.vdt +47 -42
- package/components/datepicker/shortcuts.ts +1 -1
- package/components/datepicker/styles.ts +112 -4
- package/components/datepicker/useConfirm.ts +82 -0
- package/components/datepicker/useDisabled.ts +31 -33
- package/components/datepicker/useFormats.ts +10 -4
- package/components/datepicker/useHighlight.ts +81 -0
- package/components/datepicker/useKeyboards.ts +2 -1
- package/components/datepicker/useMergeRange.ts +54 -0
- package/components/datepicker/useMonths.ts +6 -3
- package/components/datepicker/usePanel.ts +19 -19
- package/components/datepicker/useQuarters.ts +47 -0
- package/components/datepicker/useShowDate.ts +14 -3
- package/components/datepicker/useStatus.ts +34 -15
- package/components/datepicker/useValue.ts +41 -39
- package/components/datepicker/useValueBase.ts +309 -0
- package/components/datepicker/useWeeks.ts +58 -0
- package/components/datepicker/useYears.ts +7 -3
- package/components/descriptions/.DS_Store +0 -0
- package/components/dialog/useFixBody.ts +7 -64
- package/components/dropdown/dropdown.ts +5 -4
- package/components/dropdown/index.md +1 -0
- package/components/dropdown/item.ts +1 -1
- package/components/dropdown/useKeyboard.ts +0 -1
- package/components/ellipsis/styles.ts +4 -0
- package/components/form/styles.ts +1 -0
- package/components/input/index.spec.ts +42 -0
- package/components/input/index.ts +8 -0
- package/components/input/index.vdt +3 -4
- package/components/input/useAutoWidth.ts +19 -1
- package/components/menu/.DS_Store +0 -0
- package/components/menu/demos/.DS_Store +0 -0
- package/components/scrollSelect/index.spec.ts +3 -3
- package/components/scrollSelect/useMouseEvents.ts +24 -10
- package/components/select/base.ts +3 -2
- package/components/select/base.vdt +3 -1
- package/components/select/demos/creatable.md +13 -0
- package/components/select/index.md +1 -0
- package/components/select/index.spec.ts +225 -6
- package/components/select/option.ts +10 -1
- package/components/select/select.ts +3 -0
- package/components/select/styles.ts +3 -1
- package/components/select/useFilterable.ts +1 -1
- package/components/select/useInput.ts +7 -9
- package/components/select/useSearchable.ts +2 -2
- package/components/table/.DS_Store +0 -0
- package/components/table/index.spec.ts +69 -1
- package/components/table/useStickyHeader.ts +1 -1
- package/components/timepicker/demos/step.md +1 -1
- package/components/timepicker/index.spec.ts +145 -27
- package/components/timepicker/panelPicker.ts +10 -4
- package/components/timepicker/panelPicker.vdt +5 -3
- package/components/timepicker/useConfirm.ts +33 -0
- package/components/timepicker/useDefaultValue.ts +30 -0
- package/components/timepicker/useDisabled.ts +17 -4
- package/components/timepicker/useFormats.ts +1 -1
- package/components/timepicker/useValue.ts +22 -19
- package/components/tour/.DS_Store +0 -0
- package/components/tour/demos/basic.md +73 -0
- package/components/tour/demos/beforeChange.md +109 -0
- package/components/tour/demos/closable.md +70 -0
- package/components/tour/demos/custom.md +98 -0
- package/components/tour/demos/customText.md +94 -0
- package/components/tour/demos/declarative.md +72 -0
- package/components/tour/demos/events.md +101 -0
- package/components/tour/demos/maskClosable.md +76 -0
- package/components/tour/demos/notarget.md +59 -0
- package/components/tour/index.md +48 -0
- package/components/tour/index.spec.ts +259 -0
- package/components/tour/index.ts +2 -0
- package/components/tour/step.ts +55 -0
- package/components/tour/step.vdt +75 -0
- package/components/tour/styles.ts +283 -0
- package/components/tour/tour.ts +107 -0
- package/components/tour/tour.vdt +83 -0
- package/components/tour/useArrow.ts +46 -0
- package/components/tour/useFixBody.ts +22 -0
- package/components/tour/useHighlight.ts +36 -0
- package/components/tour/useMaskClosable.ts +26 -0
- package/components/tour/useNavigation.ts +46 -0
- package/components/tour/usePosition.ts +91 -0
- package/components/tour/useSteps.ts +80 -0
- package/components/virtualList/.DS_Store +0 -0
- package/components/virtualList/demos/.DS_Store +0 -0
- package/es/components/cascader/index.spec.js +18 -19
- package/es/components/datepicker/basepicker.d.ts +6 -25
- package/es/components/datepicker/basepicker.js +22 -234
- package/es/components/datepicker/calendar.d.ts +36 -6
- package/es/components/datepicker/calendar.js +4 -0
- package/es/components/datepicker/calendar.vdt.js +21 -5
- package/es/components/datepicker/dayjs.d.ts +2 -2
- package/es/components/datepicker/dayjs.js +6 -0
- package/es/components/datepicker/helpers.d.ts +8 -7
- package/es/components/datepicker/helpers.js +2 -3
- package/es/components/datepicker/index.d.ts +26 -19
- package/es/components/datepicker/index.js +21 -13
- package/es/components/datepicker/index.spec.js +1389 -633
- package/es/components/datepicker/index.vdt.js +43 -46
- package/es/components/datepicker/shortcuts.d.ts +1 -1
- package/es/components/datepicker/styles.d.ts +22 -0
- package/es/components/datepicker/styles.js +26 -4
- package/es/components/datepicker/useConfirm.d.ts +6 -0
- package/es/components/datepicker/useConfirm.js +65 -0
- package/es/components/datepicker/useDisabled.d.ts +7 -5
- package/es/components/datepicker/useDisabled.js +22 -27
- package/es/components/datepicker/useFormats.d.ts +2 -2
- package/es/components/datepicker/useFormats.js +9 -3
- package/es/components/datepicker/useHighlight.d.ts +14 -0
- package/es/components/datepicker/useHighlight.js +60 -0
- package/es/components/datepicker/useKeyboards.js +2 -1
- package/es/components/datepicker/useMergeRange.d.ts +5 -0
- package/es/components/datepicker/useMergeRange.js +45 -0
- package/es/components/datepicker/useMonths.js +5 -3
- package/es/components/datepicker/usePanel.d.ts +1 -10
- package/es/components/datepicker/usePanel.js +19 -32
- package/es/components/datepicker/useQuarters.d.ts +15 -0
- package/es/components/datepicker/useQuarters.js +36 -0
- package/es/components/datepicker/useShowDate.js +10 -2
- package/es/components/datepicker/useStatus.d.ts +1 -1
- package/es/components/datepicker/useStatus.js +33 -16
- package/es/components/datepicker/useValue.d.ts +12 -6
- package/es/components/datepicker/useValue.js +49 -45
- package/es/components/datepicker/useValueBase.d.ts +28 -0
- package/es/components/datepicker/useValueBase.js +277 -0
- package/es/components/datepicker/useWeeks.d.ts +19 -0
- package/es/components/datepicker/useWeeks.js +48 -0
- package/es/components/datepicker/useYears.js +6 -3
- package/es/components/dialog/useFixBody.js +6 -58
- package/es/components/dropdown/dropdown.d.ts +1 -0
- package/es/components/dropdown/dropdown.js +7 -4
- package/es/components/ellipsis/styles.js +1 -1
- package/es/components/form/styles.js +1 -1
- package/es/components/input/index.d.ts +2 -0
- package/es/components/input/index.js +6 -0
- package/es/components/input/index.spec.js +45 -0
- package/es/components/input/index.vdt.js +4 -3
- package/es/components/input/useAutoWidth.d.ts +2 -0
- package/es/components/input/useAutoWidth.js +19 -1
- package/es/components/scrollSelect/index.spec.js +4 -6
- package/es/components/scrollSelect/useMouseEvents.js +22 -9
- package/es/components/select/base.d.ts +1 -1
- package/es/components/select/base.js +3 -2
- package/es/components/select/base.vdt.js +5 -2
- package/es/components/select/index.spec.js +329 -82
- package/es/components/select/option.d.ts +1 -0
- package/es/components/select/option.js +10 -2
- package/es/components/select/select.d.ts +1 -0
- package/es/components/select/select.js +4 -2
- package/es/components/select/styles.d.ts +79 -0
- package/es/components/select/styles.js +1 -0
- package/es/components/select/useFilterable.js +2 -1
- package/es/components/select/useInput.d.ts +1 -1
- package/es/components/select/useInput.js +7 -4
- package/es/components/select/useSearchable.js +1 -0
- package/es/components/table/index.spec.js +84 -6
- package/es/components/table/useStickyHeader.js +1 -1
- package/es/components/timepicker/index.spec.js +298 -128
- package/es/components/timepicker/panelPicker.d.ts +23 -17
- package/es/components/timepicker/panelPicker.js +7 -4
- package/es/components/timepicker/panelPicker.vdt.js +8 -4
- package/es/components/timepicker/selectPicker.d.ts +5 -4
- package/es/components/timepicker/useConfirm.d.ts +6 -0
- package/es/components/timepicker/useConfirm.js +19 -0
- package/es/components/timepicker/useDefaultValue.d.ts +4 -0
- package/es/components/timepicker/useDefaultValue.js +27 -0
- package/es/components/timepicker/useDisabled.d.ts +7 -4
- package/es/components/timepicker/useDisabled.js +13 -4
- package/es/components/timepicker/useFormats.d.ts +1 -1
- package/es/components/timepicker/useValue.d.ts +14 -8
- package/es/components/timepicker/useValue.js +14 -15
- package/es/components/tour/index.d.ts +2 -0
- package/es/components/tour/index.js +2 -0
- package/es/components/tour/index.spec.d.ts +1 -0
- package/es/components/tour/index.spec.js +356 -0
- package/es/components/tour/step.d.ts +23 -0
- package/es/components/tour/step.js +46 -0
- package/es/components/tour/step.vdt.js +74 -0
- package/es/components/tour/styles.d.ts +7 -0
- package/es/components/tour/styles.js +84 -0
- package/es/components/tour/tour.d.ts +73 -0
- package/es/components/tour/tour.js +70 -0
- package/es/components/tour/tour.vdt.js +66 -0
- package/es/components/tour/useArrow.d.ts +4 -0
- package/es/components/tour/useArrow.js +40 -0
- package/es/components/tour/useFixBody.d.ts +4 -0
- package/es/components/tour/useFixBody.js +17 -0
- package/es/components/tour/useHighlight.d.ts +4 -0
- package/es/components/tour/useHighlight.js +31 -0
- package/es/components/tour/useMaskClosable.d.ts +1 -0
- package/es/components/tour/useMaskClosable.js +25 -0
- package/es/components/tour/useNavigation.d.ts +5 -0
- package/es/components/tour/useNavigation.js +103 -0
- package/es/components/tour/usePosition.d.ts +6 -0
- package/es/components/tour/usePosition.js +93 -0
- package/es/components/tour/useSteps.d.ts +6 -0
- package/es/components/tour/useSteps.js +68 -0
- package/es/hooks/useFixBody.d.ts +11 -0
- package/es/hooks/useFixBody.js +72 -0
- package/es/index.d.ts +3 -2
- package/es/index.js +3 -2
- package/es/site/data/components/datepicker/demos/multiple/react.js +2 -2
- package/es/site/data/components/select/demos/creatable/index.d.ts +1 -0
- package/es/site/data/components/select/demos/creatable/index.js +2 -1
- package/es/site/data/components/select/demos/creatable/react.d.ts +1 -0
- package/es/site/data/components/select/demos/creatable/react.js +31 -2
- package/es/site/data/components/tour/demos/basic/index.d.ts +17 -0
- package/es/site/data/components/tour/demos/basic/index.js +46 -0
- package/es/site/data/components/tour/demos/basic/react.d.ts +16 -0
- package/es/site/data/components/tour/demos/basic/react.js +82 -0
- package/es/site/data/components/tour/demos/beforeChange/index.d.ts +20 -0
- package/es/site/data/components/tour/demos/beforeChange/index.js +69 -0
- package/es/site/data/components/tour/demos/beforeChange/react.d.ts +19 -0
- package/es/site/data/components/tour/demos/beforeChange/react.js +129 -0
- package/es/site/data/components/tour/demos/closable/index.d.ts +18 -0
- package/es/site/data/components/tour/demos/closable/index.js +42 -0
- package/es/site/data/components/tour/demos/closable/react.d.ts +17 -0
- package/es/site/data/components/tour/demos/closable/react.js +85 -0
- package/es/site/data/components/tour/demos/custom/index.d.ts +11 -0
- package/es/site/data/components/tour/demos/custom/index.js +35 -0
- package/es/site/data/components/tour/demos/custom/react.d.ts +11 -0
- package/es/site/data/components/tour/demos/custom/react.js +108 -0
- package/es/site/data/components/tour/demos/customText/index.d.ts +33 -0
- package/es/site/data/components/tour/demos/customText/index.js +55 -0
- package/es/site/data/components/tour/demos/customText/react.d.ts +33 -0
- package/es/site/data/components/tour/demos/customText/react.js +99 -0
- package/es/site/data/components/tour/demos/declarative/index.d.ts +11 -0
- package/es/site/data/components/tour/demos/declarative/index.js +36 -0
- package/es/site/data/components/tour/demos/declarative/react.d.ts +10 -0
- package/es/site/data/components/tour/demos/declarative/react.js +80 -0
- package/es/site/data/components/tour/demos/events/index.d.ts +18 -0
- package/es/site/data/components/tour/demos/events/index.js +58 -0
- package/es/site/data/components/tour/demos/events/react.d.ts +18 -0
- package/es/site/data/components/tour/demos/events/react.js +101 -0
- package/es/site/data/components/tour/demos/maskClosable/index.d.ts +18 -0
- package/es/site/data/components/tour/demos/maskClosable/index.js +47 -0
- package/es/site/data/components/tour/demos/maskClosable/react.d.ts +17 -0
- package/es/site/data/components/tour/demos/maskClosable/react.js +95 -0
- package/es/site/data/components/tour/demos/notarget/index.d.ts +11 -0
- package/es/site/data/components/tour/demos/notarget/index.js +35 -0
- package/es/site/data/components/tour/demos/notarget/react.d.ts +10 -0
- package/es/site/data/components/tour/demos/notarget/react.js +61 -0
- package/es/site/data/components/tour/index.d.ts +57 -0
- package/es/site/data/components/tour/index.js +32 -0
- package/hooks/useFixBody.ts +87 -0
- package/index.ts +3 -2
- package/package.json +2 -2
- package/styles/.DS_Store +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useInstance, RefObject, onMounted, nextTick } from 'intact';
|
|
2
|
+
import type { Tour } from './tour';
|
|
3
|
+
import { Options as PositionOptions, position, Feedback } from '../position';
|
|
4
|
+
|
|
5
|
+
const CENTER_POSITION_OPTIONS: PositionOptions = {
|
|
6
|
+
my: 'center center',
|
|
7
|
+
at: 'center center',
|
|
8
|
+
collision: 'none'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export function usePosition(
|
|
12
|
+
stepRef: RefObject<HTMLDivElement>,
|
|
13
|
+
getTargetElement: (index?: number) => HTMLElement | null
|
|
14
|
+
) {
|
|
15
|
+
const instance = useInstance() as Tour;
|
|
16
|
+
|
|
17
|
+
instance.watch('value', (value) => {
|
|
18
|
+
if (value !== undefined && value >= 0) {
|
|
19
|
+
nextTick(() => updatePosition());
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
instance.watch('visible', (visible) => {
|
|
24
|
+
if (visible) {
|
|
25
|
+
updatePosition();
|
|
26
|
+
}
|
|
27
|
+
}, {presented: true});
|
|
28
|
+
|
|
29
|
+
onMounted(() => {
|
|
30
|
+
updatePosition();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// get position options
|
|
34
|
+
function getPositionOptions(index?: number): PositionOptions {
|
|
35
|
+
const currentIndex = index !== undefined ? index : (instance.get('value') || 0);
|
|
36
|
+
let positionConfig: PositionOptions | string | undefined;
|
|
37
|
+
|
|
38
|
+
const { data } = instance.get();
|
|
39
|
+
if (data && data[currentIndex]) {
|
|
40
|
+
positionConfig = data[currentIndex].position;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!positionConfig && instance.steps.steps[currentIndex]) {
|
|
44
|
+
positionConfig = instance.steps.steps[currentIndex].props?.position;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (!positionConfig) {
|
|
48
|
+
positionConfig = 'bottom';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof positionConfig === 'string') {
|
|
52
|
+
switch (positionConfig) {
|
|
53
|
+
case 'left':
|
|
54
|
+
return {my: 'right-20 center', at: 'left center', collision: 'flipfit'};
|
|
55
|
+
case 'bottom':
|
|
56
|
+
return {my: 'center top+20', at: 'center bottom', collision: 'flipfit'};
|
|
57
|
+
case 'right':
|
|
58
|
+
return {my: 'left+20 center', at: 'right center', collision: 'flipfit'};
|
|
59
|
+
case 'top':
|
|
60
|
+
default:
|
|
61
|
+
return {my: 'center bottom-20', at: 'center top', collision: 'flipfit'};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return positionConfig;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// update position
|
|
69
|
+
function updatePosition() {
|
|
70
|
+
const stepElement = stepRef.value;
|
|
71
|
+
if (!stepElement) return;
|
|
72
|
+
|
|
73
|
+
const targetElement = getTargetElement();
|
|
74
|
+
|
|
75
|
+
const positionOptions = targetElement ? getPositionOptions() : CENTER_POSITION_OPTIONS;
|
|
76
|
+
const ofElement = targetElement || window;
|
|
77
|
+
|
|
78
|
+
position(stepElement, {
|
|
79
|
+
...positionOptions,
|
|
80
|
+
of: ofElement,
|
|
81
|
+
using: (feedback, pos) => {
|
|
82
|
+
instance.trigger('positioned', feedback);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
getPositionOptions,
|
|
89
|
+
updatePosition
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useInstance, onMounted } from 'intact';
|
|
2
|
+
import type { Tour } from './tour';
|
|
3
|
+
import type { TourStepProps } from './step';
|
|
4
|
+
import { TourStep } from './step';
|
|
5
|
+
import { isComponentVNode } from '../utils';
|
|
6
|
+
|
|
7
|
+
export function useSteps() {
|
|
8
|
+
const instance = useInstance() as Tour;
|
|
9
|
+
const steps: any[] = [];
|
|
10
|
+
const targetElements = new Map<number, HTMLElement | null>();
|
|
11
|
+
|
|
12
|
+
instance.on('$receive:children' as any, collectSteps);
|
|
13
|
+
|
|
14
|
+
instance.watch('data', () => {
|
|
15
|
+
targetElements.clear();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 收集子组件步骤
|
|
20
|
+
*/
|
|
21
|
+
function collectSteps(children: any) {
|
|
22
|
+
steps.length = 0;
|
|
23
|
+
if (!children) return;
|
|
24
|
+
|
|
25
|
+
const childrenArray = Array.isArray(children) ? children : [children];
|
|
26
|
+
childrenArray.forEach(child => {
|
|
27
|
+
if (child && isComponentVNode(child, TourStep)) {
|
|
28
|
+
steps.push(child);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getTotalSteps(): number {
|
|
34
|
+
const { data, children } = instance.get();
|
|
35
|
+
if (children) {
|
|
36
|
+
return steps.length;
|
|
37
|
+
}
|
|
38
|
+
return (data || []).length;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// get current step target element
|
|
42
|
+
function getTargetElement(index?: number): HTMLElement | null {
|
|
43
|
+
const currentIndex = index !== undefined ? index : (instance.get('value') || 0);
|
|
44
|
+
if (targetElements.has(currentIndex)) {
|
|
45
|
+
return targetElements.get(currentIndex) || null;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let target: string | HTMLElement | undefined;
|
|
49
|
+
|
|
50
|
+
// get target from data
|
|
51
|
+
const data = instance.get('data');
|
|
52
|
+
if (data && data[currentIndex]) {
|
|
53
|
+
target = data[currentIndex].target;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// get target from children
|
|
57
|
+
if (!target && steps[currentIndex]) {
|
|
58
|
+
target = steps[currentIndex].props?.target;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!target) return null;
|
|
62
|
+
|
|
63
|
+
let element: HTMLElement | null = null;
|
|
64
|
+
if (typeof target === 'string') {
|
|
65
|
+
element = document.querySelector(target);
|
|
66
|
+
} else {
|
|
67
|
+
element = target;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
targetElements.set(currentIndex, element);
|
|
71
|
+
return element;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return {
|
|
75
|
+
steps,
|
|
76
|
+
collectSteps,
|
|
77
|
+
getTotalSteps,
|
|
78
|
+
getTargetElement
|
|
79
|
+
};
|
|
80
|
+
}
|
|
Binary file
|
|
Binary file
|
|
@@ -160,7 +160,7 @@ describe('Cascader', function () {
|
|
|
160
160
|
}, _callee5);
|
|
161
161
|
})));
|
|
162
162
|
it('filter', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
163
|
-
var _mount5, instance, element, input,
|
|
163
|
+
var _mount5, instance, element, input, dropdown1, _getElements2, _dropdown1, _dropdown2, _dropdown3;
|
|
164
164
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
165
165
|
while (1) switch (_context6.prev = _context6.next) {
|
|
166
166
|
case 0:
|
|
@@ -170,53 +170,52 @@ describe('Cascader', function () {
|
|
|
170
170
|
_context6.next = 5;
|
|
171
171
|
return wait();
|
|
172
172
|
case 5:
|
|
173
|
+
// FIXME: maybe we should show no-data layer
|
|
173
174
|
// should show layer when input empty string
|
|
174
|
-
input.value = ' ';
|
|
175
|
+
// input.value = ' ';
|
|
176
|
+
// dispatchEvent(input, 'input');
|
|
177
|
+
// await wait();
|
|
178
|
+
// const dropdown = getElement('.k-cascader-menu')!;
|
|
179
|
+
// expect(dropdown.innerHTML).to.matchSnapshot();
|
|
180
|
+
// expect(dropdown.innerText).to.eql('北京\n湖南');
|
|
181
|
+
input.value = '长沙';
|
|
175
182
|
dispatchEvent(input, 'input');
|
|
176
183
|
_context6.next = 9;
|
|
177
184
|
return wait();
|
|
178
185
|
case 9:
|
|
179
|
-
dropdown = getElement('.k-cascader-menu');
|
|
180
|
-
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
181
|
-
expect(dropdown.innerText).to.eql('北京\n湖南');
|
|
182
|
-
input.value = '长沙';
|
|
183
|
-
dispatchEvent(input, 'input');
|
|
184
|
-
_context6.next = 16;
|
|
185
|
-
return wait();
|
|
186
|
-
case 16:
|
|
187
186
|
dropdown1 = getElement('.k-cascader-filter');
|
|
188
187
|
expect(dropdown1.innerHTML).to.matchSnapshot();
|
|
189
188
|
expect(dropdown1.innerText).to.eql('湖南 / 长沙市 / 岳麓区');
|
|
190
189
|
// should show no-data layer
|
|
191
190
|
input.value = 'xxx';
|
|
192
191
|
dispatchEvent(input, 'input');
|
|
193
|
-
_context6.next =
|
|
192
|
+
_context6.next = 16;
|
|
194
193
|
return wait();
|
|
195
|
-
case
|
|
194
|
+
case 16:
|
|
196
195
|
expect(dropdown1.innerHTML).to.matchSnapshot();
|
|
197
196
|
expect(dropdown1.innerText).to.eql('无匹配数据');
|
|
198
197
|
input.value = '岳阳';
|
|
199
198
|
dispatchEvent(input, 'input');
|
|
200
|
-
_context6.next =
|
|
199
|
+
_context6.next = 22;
|
|
201
200
|
return wait();
|
|
202
|
-
case
|
|
201
|
+
case 22:
|
|
203
202
|
expect(dropdown1.innerHTML).to.matchSnapshot();
|
|
204
203
|
expect(dropdown1.childElementCount).to.eql(2);
|
|
205
204
|
dropdown1.querySelector('.k-dropdown-item').click();
|
|
206
|
-
_context6.next =
|
|
205
|
+
_context6.next = 27;
|
|
207
206
|
return wait();
|
|
208
|
-
case
|
|
207
|
+
case 27:
|
|
209
208
|
expect(instance.get('value')).to.eql(['hunan', 'yueyang', 'yueyanglou']);
|
|
210
209
|
// show again to test the position
|
|
211
210
|
input.click();
|
|
212
|
-
_context6.next =
|
|
211
|
+
_context6.next = 31;
|
|
213
212
|
return wait();
|
|
214
|
-
case
|
|
213
|
+
case 31:
|
|
215
214
|
_getElements2 = getElements('.k-cascader-menu'), _dropdown1 = _getElements2[0], _dropdown2 = _getElements2[1], _dropdown3 = _getElements2[2];
|
|
216
215
|
expect(_dropdown1.style.top).not.eql('0px');
|
|
217
216
|
expect(_dropdown2.style.top).not.eql('0px');
|
|
218
217
|
expect(_dropdown3.style.top).not.eql('0px');
|
|
219
|
-
case
|
|
218
|
+
case 35:
|
|
220
219
|
case "end":
|
|
221
220
|
return _context6.stop();
|
|
222
221
|
}
|
|
@@ -2,20 +2,12 @@
|
|
|
2
2
|
* The base hook for handling value of Datepicker and Timepicker
|
|
3
3
|
*/
|
|
4
4
|
import { TypeDefs } from 'intact';
|
|
5
|
-
import {
|
|
6
|
-
import { Dayjs, OpUnitType } from './dayjs';
|
|
5
|
+
import { Dayjs } from './dayjs';
|
|
7
6
|
import type { useFormats } from './useFormats';
|
|
8
|
-
import
|
|
9
|
-
import { PanelFlags, usePanel } from './usePanel';
|
|
7
|
+
import { usePanel } from './usePanel';
|
|
10
8
|
import { BaseSelect, BaseSelectProps, BaseSelectEvents, BaseSelectBlocks } from '../select/base';
|
|
11
9
|
import type { Events } from '../types';
|
|
12
|
-
|
|
13
|
-
export type StateValueItem = Dayjs | StateValueRange;
|
|
14
|
-
export type StateValue = StateValueItem[];
|
|
15
|
-
export type StringValue = string | string[] | [string, string] | [string, string][];
|
|
16
|
-
export type DayjsValueRange = [Dayjs, Dayjs];
|
|
17
|
-
export type DayjsValueItem = Dayjs | DayjsValueRange;
|
|
18
|
-
export type DayjsValue = DayjsValueItem[];
|
|
10
|
+
import type { useValueBase, StateValueRange, Value } from './useValueBase';
|
|
19
11
|
export interface BasePickerProps<V extends Value = Value, Multipe extends boolean = boolean, Range extends boolean = boolean> extends BaseSelectProps<V | [V, V], Multipe> {
|
|
20
12
|
value?: Multipe extends true ? Range extends true ? [
|
|
21
13
|
V,
|
|
@@ -33,27 +25,16 @@ export interface BasePickerProps<V extends Value = Value, Multipe extends boolea
|
|
|
33
25
|
disabledDate?: (v: Dayjs) => boolean;
|
|
34
26
|
}
|
|
35
27
|
export interface BasePickerEvents extends BaseSelectEvents {
|
|
36
|
-
selecting: [StateValueRange];
|
|
28
|
+
selecting: [StateValueRange, boolean];
|
|
37
29
|
}
|
|
38
30
|
export interface BasePickerBlocks<V extends Value = Value, R extends boolean = boolean> extends BaseSelectBlocks<R extends true ? [Value, Value] : Value> {
|
|
39
31
|
}
|
|
40
|
-
export type Value = string | Date | number | Dayjs;
|
|
41
32
|
export declare abstract class BasePicker<T extends BasePickerProps = BasePickerProps, E extends BasePickerEvents = BasePickerEvents, B extends BasePickerBlocks<any> = BasePickerBlocks<any>> extends BaseSelect<T, E, B> {
|
|
42
33
|
static typeDefs: Required<TypeDefs<BasePickerProps<Value, boolean, boolean>>>;
|
|
43
34
|
static defaults: () => Partial<BasePickerProps<any, boolean, boolean>>;
|
|
44
35
|
static events: Events<BasePickerEvents>;
|
|
45
|
-
abstract value: ReturnType<typeof
|
|
36
|
+
abstract value: ReturnType<typeof useValueBase>;
|
|
46
37
|
abstract formats: ReturnType<typeof useFormats>;
|
|
47
38
|
abstract panel: ReturnType<typeof usePanel>;
|
|
48
|
-
resetKeywords(
|
|
39
|
+
resetKeywords(silent?: boolean): void;
|
|
49
40
|
}
|
|
50
|
-
export declare function useValue({ createDateByValueFormat, createDateByShowFormat, getShowString, getValueString, }: ReturnType<typeof useFormats>, { isDisabled, minDate }: ReturnType<typeof useDisabled>, panel: ReturnType<typeof usePanel>, shouldUpdateValue: (v: StateValueItem) => boolean, updateValueOnInput: (v: DayjsValueItem) => void, getEqualType: () => OpUnitType, updateStateValue: (v: DayjsValue, value: State<StateValue>) => void): {
|
|
51
|
-
value: State<StateValue>;
|
|
52
|
-
format: () => string | string[];
|
|
53
|
-
onConfirm: () => void;
|
|
54
|
-
onChangeTime: (date: Dayjs, flag: PanelFlags) => void;
|
|
55
|
-
getTimeValue: (flag: PanelFlags) => Dayjs | null | undefined;
|
|
56
|
-
setValue: (v: StateValueItem, fromInput: boolean) => void;
|
|
57
|
-
convertToDayjs: (v: BasePickerProps<Value>['value']) => DayjsValue;
|
|
58
|
-
getDayjsValue: () => DayjsValue;
|
|
59
|
-
};
|
|
@@ -1,18 +1,8 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
|
-
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
4
|
-
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
|
|
5
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
|
|
6
|
-
import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/splice";
|
|
7
3
|
import { __decorate } from "tslib";
|
|
8
|
-
/**
|
|
9
|
-
* The base hook for handling value of Datepicker and Timepicker
|
|
10
|
-
*/
|
|
11
|
-
import { useInstance } from 'intact';
|
|
12
|
-
import { useState, watchState } from '../../hooks/useState';
|
|
13
4
|
import dayjs from './dayjs';
|
|
14
|
-
import {
|
|
15
|
-
import { isEqualArray, last, bind } from '../utils';
|
|
5
|
+
import { last, bind } from '../utils';
|
|
16
6
|
import { BaseSelect } from '../select/base';
|
|
17
7
|
var typeDefs = _extends({}, BaseSelect.typeDefs, {
|
|
18
8
|
value: [String, Array, Date, Number, dayjs],
|
|
@@ -38,232 +28,30 @@ export var BasePicker = /*#__PURE__*/function (_BaseSelect) {
|
|
|
38
28
|
return _BaseSelect.apply(this, arguments) || this;
|
|
39
29
|
}
|
|
40
30
|
var _proto = BasePicker.prototype;
|
|
41
|
-
_proto.resetKeywords = function resetKeywords(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
var value = last(
|
|
48
|
-
keywords
|
|
31
|
+
_proto.resetKeywords = function resetKeywords(silent) {
|
|
32
|
+
if (silent === void 0) {
|
|
33
|
+
silent = false;
|
|
34
|
+
}
|
|
35
|
+
// const {multiple} = this.get();
|
|
36
|
+
// const dayjsValue = this.value.getDayjsValue();
|
|
37
|
+
var value = last(this.value.value.value);
|
|
38
|
+
var keywords = this.input.keywords;
|
|
39
|
+
var _keywords = '';
|
|
40
|
+
if (value && !this.value.allValuesUpdatedInMultipleMode()) {
|
|
41
|
+
_keywords = this.value.formatSingleValue(value);
|
|
42
|
+
}
|
|
43
|
+
if (!silent) {
|
|
44
|
+
keywords.set(_keywords);
|
|
45
|
+
} else {
|
|
46
|
+
// update keywords will update value, because it is been watched in useValueBase
|
|
47
|
+
// silent in this case to update keywords to show it in input
|
|
48
|
+
keywords.value = _keywords;
|
|
49
|
+
this.forceUpdate();
|
|
50
|
+
}
|
|
49
51
|
};
|
|
50
52
|
return BasePicker;
|
|
51
53
|
}(BaseSelect);
|
|
52
54
|
BasePicker.typeDefs = typeDefs;
|
|
53
55
|
BasePicker.defaults = defaults;
|
|
54
56
|
BasePicker.events = events;
|
|
55
|
-
__decorate([bind], BasePicker.prototype, "resetKeywords", null);
|
|
56
|
-
export function useValue(_ref, _ref2, panel, shouldUpdateValue, updateValueOnInput, getEqualType, updateStateValue) {
|
|
57
|
-
var createDateByValueFormat = _ref.createDateByValueFormat,
|
|
58
|
-
createDateByShowFormat = _ref.createDateByShowFormat,
|
|
59
|
-
getShowString = _ref.getShowString,
|
|
60
|
-
getValueString = _ref.getValueString;
|
|
61
|
-
var isDisabled = _ref2.isDisabled,
|
|
62
|
-
minDate = _ref2.minDate;
|
|
63
|
-
// Normalize the value to multipe values, no matter it's multipe or not
|
|
64
|
-
var value = useState([]);
|
|
65
|
-
var instance = useInstance();
|
|
66
|
-
var dayjsValue = [];
|
|
67
|
-
instance.watch('value', function (newValue, oldValue) {
|
|
68
|
-
if (isEqualArray(newValue, oldValue)) return;
|
|
69
|
-
dayjsValue = convertToDayjs(newValue);
|
|
70
|
-
updateStateValue(dayjsValue, value);
|
|
71
|
-
// should update keywords
|
|
72
|
-
instance.resetKeywords(instance.input.keywords);
|
|
73
|
-
});
|
|
74
|
-
watchState(instance.input.keywords, function (v) {
|
|
75
|
-
var _instance$get = instance.get(),
|
|
76
|
-
range = _instance$get.range,
|
|
77
|
-
multiple = _instance$get.multiple;
|
|
78
|
-
if (!multiple && v === '') return instance.set('value', null);
|
|
79
|
-
if (range) {
|
|
80
|
-
var _context;
|
|
81
|
-
var _v$split$map = _mapInstanceProperty(_context = v.split(/\s*~\s*/)).call(_context, function (s) {
|
|
82
|
-
return _trimInstanceProperty(s).call(s);
|
|
83
|
-
}),
|
|
84
|
-
start = _v$split$map[0],
|
|
85
|
-
end = _v$split$map[1];
|
|
86
|
-
if (start && end) {
|
|
87
|
-
var startDate = createDateByShowFormat(start);
|
|
88
|
-
if (!isValidDate(startDate)) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
var endDate = createDateByShowFormat(end);
|
|
92
|
-
if (!isValidDate(endDate)) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (endDate.isAfter(startDate)) {
|
|
96
|
-
updateValueOnInput([startDate, endDate]);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
var date = createDateByShowFormat(v);
|
|
101
|
-
if (isValidDate(date)) {
|
|
102
|
-
updateValueOnInput(date);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
function convertToDayjs(v) {
|
|
107
|
-
if (!v || Array.isArray(v) && !v.length) return [];
|
|
108
|
-
var _instance$get2 = instance.get(),
|
|
109
|
-
multiple = _instance$get2.multiple;
|
|
110
|
-
if (!multiple) {
|
|
111
|
-
v = [v];
|
|
112
|
-
}
|
|
113
|
-
return _mapInstanceProperty(v).call(v, function (value) {
|
|
114
|
-
if (Array.isArray(value)) {
|
|
115
|
-
// range
|
|
116
|
-
return _mapInstanceProperty(value).call(value, createDateByValueFormat);
|
|
117
|
-
}
|
|
118
|
-
return createDateByValueFormat(value);
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
function convertToValueString(v) {
|
|
122
|
-
var results = _mapInstanceProperty(v).call(v, function (value) {
|
|
123
|
-
if (Array.isArray(value)) {
|
|
124
|
-
return _mapInstanceProperty(value).call(value, getValueString);
|
|
125
|
-
}
|
|
126
|
-
return getValueString(value);
|
|
127
|
-
});
|
|
128
|
-
if (!instance.get('multiple')) {
|
|
129
|
-
return results[0] || null;
|
|
130
|
-
}
|
|
131
|
-
return results;
|
|
132
|
-
}
|
|
133
|
-
function format() {
|
|
134
|
-
var results = _mapInstanceProperty(dayjsValue).call(dayjsValue, function (value) {
|
|
135
|
-
if (Array.isArray(value)) {
|
|
136
|
-
return _mapInstanceProperty(value).call(value, getShowString).join(' ~ ');
|
|
137
|
-
}
|
|
138
|
-
return getShowString(value);
|
|
139
|
-
});
|
|
140
|
-
if (!instance.get('multiple')) {
|
|
141
|
-
return results[0];
|
|
142
|
-
}
|
|
143
|
-
return results;
|
|
144
|
-
}
|
|
145
|
-
function setSingleDate(v, fromInput) {
|
|
146
|
-
var _instance$get3 = instance.get(),
|
|
147
|
-
range = _instance$get3.range;
|
|
148
|
-
value.set([v]);
|
|
149
|
-
if (fromInput || shouldUpdateValue(v)) {
|
|
150
|
-
updateValue();
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
function addMultipeDate(v, fromInput) {
|
|
154
|
-
var _instance$get4 = instance.get(),
|
|
155
|
-
range = _instance$get4.range;
|
|
156
|
-
var _value = value.value;
|
|
157
|
-
_value = !_value ? [] : _sliceInstanceProperty(_value).call(_value);
|
|
158
|
-
if (range && v.length === 2) {
|
|
159
|
-
// pop the last value firstly, if it only has the start date
|
|
160
|
-
var lastValue = last(_value);
|
|
161
|
-
if (lastValue && lastValue.length < 2) {
|
|
162
|
-
_value.pop();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
var _shouldUpdateValue = true;
|
|
166
|
-
if (fromInput || shouldUpdateValue(v)) {
|
|
167
|
-
// if select the date/year/month, then toggle the value.
|
|
168
|
-
// if from input, treat the value as the final value
|
|
169
|
-
var index = findValueIndex(_value, v, getEqualType());
|
|
170
|
-
if (index > -1) {
|
|
171
|
-
_spliceInstanceProperty(_value).call(_value, index, 1);
|
|
172
|
-
} else {
|
|
173
|
-
_value.push(v);
|
|
174
|
-
}
|
|
175
|
-
} else {
|
|
176
|
-
// select the datetime, only push the value,
|
|
177
|
-
// and unique the array on click confrim button
|
|
178
|
-
_value.push(v);
|
|
179
|
-
_shouldUpdateValue = false;
|
|
180
|
-
}
|
|
181
|
-
value.set(_value);
|
|
182
|
-
if (_shouldUpdateValue) {
|
|
183
|
-
updateValue();
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
function setValue(v, fromInput) {
|
|
187
|
-
var multiple = instance.get('multiple');
|
|
188
|
-
if (multiple) {
|
|
189
|
-
addMultipeDate(v, fromInput);
|
|
190
|
-
} else {
|
|
191
|
-
setSingleDate(v, fromInput);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
function updateValue() {
|
|
195
|
-
var _value = value.value;
|
|
196
|
-
var valueStr = convertToValueString(_value);
|
|
197
|
-
instance.set('value', valueStr);
|
|
198
|
-
instance.resetKeywords(instance.input.keywords);
|
|
199
|
-
}
|
|
200
|
-
function onConfirm() {
|
|
201
|
-
// unique
|
|
202
|
-
if (!instance.get('multiple')) {
|
|
203
|
-
instance.hide();
|
|
204
|
-
} else {
|
|
205
|
-
unique();
|
|
206
|
-
panel.reset();
|
|
207
|
-
}
|
|
208
|
-
updateValue();
|
|
209
|
-
}
|
|
210
|
-
function unique() {
|
|
211
|
-
var _value = value.value;
|
|
212
|
-
var map = {};
|
|
213
|
-
var results = [];
|
|
214
|
-
_value.forEach(function (value) {
|
|
215
|
-
var key;
|
|
216
|
-
if (Array.isArray(value)) {
|
|
217
|
-
key = _mapInstanceProperty(value).call(value, getValueString).join(' ~ ');
|
|
218
|
-
} else {
|
|
219
|
-
key = getValueString(value);
|
|
220
|
-
}
|
|
221
|
-
if (!map[key]) {
|
|
222
|
-
map[key] = true;
|
|
223
|
-
results.push(value);
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
value.set(results);
|
|
227
|
-
}
|
|
228
|
-
function isValidDate(date) {
|
|
229
|
-
return date.isValid() && !isDisabled(date, getEqualType());
|
|
230
|
-
}
|
|
231
|
-
function onChangeTime(date, flag) {
|
|
232
|
-
var _context2;
|
|
233
|
-
var _instance$get5 = instance.get(),
|
|
234
|
-
range = _instance$get5.range;
|
|
235
|
-
var values = _sliceInstanceProperty(_context2 = value.value).call(_context2);
|
|
236
|
-
var lastIndex = values.length - 1;
|
|
237
|
-
var _value = date;
|
|
238
|
-
if (range) {
|
|
239
|
-
var _context3;
|
|
240
|
-
_value = _sliceInstanceProperty(_context3 = values[lastIndex]).call(_context3);
|
|
241
|
-
_value[flag] = date;
|
|
242
|
-
instance.trigger('selecting', _value);
|
|
243
|
-
}
|
|
244
|
-
values[lastIndex] = _value;
|
|
245
|
-
value.set(values);
|
|
246
|
-
}
|
|
247
|
-
function getTimeValue(flag) {
|
|
248
|
-
var _value = value.value;
|
|
249
|
-
if (!_value.length) return null;
|
|
250
|
-
var _instance$get6 = instance.get(),
|
|
251
|
-
range = _instance$get6.range,
|
|
252
|
-
min = _instance$get6.min;
|
|
253
|
-
var lastValue = last(_value);
|
|
254
|
-
return range ? lastValue[flag] : lastValue;
|
|
255
|
-
}
|
|
256
|
-
function getDayjsValue() {
|
|
257
|
-
return dayjsValue;
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
value: value,
|
|
261
|
-
format: format,
|
|
262
|
-
onConfirm: onConfirm,
|
|
263
|
-
onChangeTime: onChangeTime,
|
|
264
|
-
getTimeValue: getTimeValue,
|
|
265
|
-
setValue: setValue,
|
|
266
|
-
convertToDayjs: convertToDayjs,
|
|
267
|
-
getDayjsValue: getDayjsValue
|
|
268
|
-
};
|
|
269
|
-
}
|
|
57
|
+
__decorate([bind], BasePicker.prototype, "resetKeywords", null);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Component } from 'intact';
|
|
2
2
|
import { Dayjs } from 'dayjs';
|
|
3
3
|
import type { Datepicker } from './index';
|
|
4
|
-
import { StateValue } from './
|
|
4
|
+
import type { StateValue } from './useValueBase';
|
|
5
5
|
import { PanelFlags } from './usePanel';
|
|
6
|
+
import { Position } from './useHighlight';
|
|
6
7
|
export interface DatepickerCalendarProps {
|
|
7
8
|
value: StateValue;
|
|
8
|
-
type?: 'date' | 'year' | 'month';
|
|
9
|
+
type?: 'date' | 'year' | 'month' | 'week' | 'quarter';
|
|
9
10
|
flag: PanelFlags;
|
|
11
|
+
highlightPosition: Position;
|
|
10
12
|
}
|
|
11
13
|
export interface DatepickerCalendarEvents {
|
|
12
14
|
change: [Dayjs, PanelFlags];
|
|
@@ -14,7 +16,7 @@ export interface DatepickerCalendarEvents {
|
|
|
14
16
|
export declare class DatepickerCalendar extends Component<DatepickerCalendarProps, DatepickerCalendarEvents> {
|
|
15
17
|
static template: string | import("intact").Template<any>;
|
|
16
18
|
static defaults: () => Partial<DatepickerCalendarProps>;
|
|
17
|
-
type: import("../../hooks/useState").State<Required<"date" | "month" | "year" | undefined>>;
|
|
19
|
+
type: import("../../hooks/useState").State<Required<"date" | "month" | "week" | "year" | "quarter" | undefined>>;
|
|
18
20
|
datepicker: Datepicker;
|
|
19
21
|
showDate: {
|
|
20
22
|
date: import("../../hooks/useState").State<Dayjs>;
|
|
@@ -30,9 +32,9 @@ export declare class DatepickerCalendar extends Component<DatepickerCalendarProp
|
|
|
30
32
|
prevTenYears: () => void;
|
|
31
33
|
};
|
|
32
34
|
status: {
|
|
33
|
-
isActive: (date: Dayjs, type: "date" | "month" | "year" | undefined) => boolean;
|
|
34
|
-
isInRange: (date: Dayjs, type: "date" | "month" | "year" | undefined) => boolean;
|
|
35
|
-
isDisabled: (value: Dayjs, type?:
|
|
35
|
+
isActive: (date: Dayjs, type: "date" | "month" | "week" | "year" | "quarter" | undefined) => boolean;
|
|
36
|
+
isInRange: (date: Dayjs, type: "date" | "month" | "week" | "year" | "quarter" | undefined) => boolean;
|
|
37
|
+
isDisabled: (value: Dayjs, type?: "h" | "s" | "y" | "date" | "month" | "week" | "millisecond" | "second" | "minute" | "hour" | "day" | "year" | "milliseconds" | "seconds" | "minutes" | "hours" | "days" | "months" | "years" | "dates" | "d" | "D" | "M" | "m" | "ms" | "weeks" | "w" | "quarter" | "quarters" | "Q") => boolean;
|
|
36
38
|
};
|
|
37
39
|
days: {
|
|
38
40
|
getDays: (now: Dayjs) => {
|
|
@@ -74,6 +76,34 @@ export declare class DatepickerCalendar extends Component<DatepickerCalendarProp
|
|
|
74
76
|
}[];
|
|
75
77
|
onClick: (date: Dayjs) => void;
|
|
76
78
|
};
|
|
79
|
+
weeks: {
|
|
80
|
+
getWeeks: (now: Dayjs) => {
|
|
81
|
+
week: number;
|
|
82
|
+
days: {
|
|
83
|
+
isExceed: boolean;
|
|
84
|
+
label: number;
|
|
85
|
+
value: Dayjs;
|
|
86
|
+
isActive: boolean;
|
|
87
|
+
isToday: boolean;
|
|
88
|
+
isDisabled: boolean;
|
|
89
|
+
isHover: boolean;
|
|
90
|
+
isInRange: boolean;
|
|
91
|
+
}[];
|
|
92
|
+
}[];
|
|
93
|
+
onClick: (day: Dayjs) => void;
|
|
94
|
+
};
|
|
95
|
+
quarters: {
|
|
96
|
+
getQuarters: (now: Dayjs) => {
|
|
97
|
+
isActive: boolean;
|
|
98
|
+
isToday: boolean;
|
|
99
|
+
isDisabled: boolean;
|
|
100
|
+
isHover: boolean;
|
|
101
|
+
isInRange: boolean;
|
|
102
|
+
label: string;
|
|
103
|
+
value: Dayjs;
|
|
104
|
+
}[];
|
|
105
|
+
onClick: (date: Dayjs) => void;
|
|
106
|
+
};
|
|
77
107
|
private config;
|
|
78
108
|
triggerChange(value: Dayjs): void;
|
|
79
109
|
}
|
|
@@ -11,6 +11,8 @@ import { useShowDate } from './useShowDate';
|
|
|
11
11
|
import { bind } from '../utils';
|
|
12
12
|
import { useYears } from './useYears';
|
|
13
13
|
import { useMonths } from './useMonths';
|
|
14
|
+
import { useWeeks } from './useWeeks';
|
|
15
|
+
import { useQuarters } from './useQuarters';
|
|
14
16
|
import { useStatus } from './useStatus';
|
|
15
17
|
import { useConfigContext } from '../config';
|
|
16
18
|
var defaults = function defaults() {
|
|
@@ -34,6 +36,8 @@ export var DatepickerCalendar = /*#__PURE__*/function (_Component) {
|
|
|
34
36
|
_this.days = useDays(_this.showDate.date, _this.status, _this.datepicker.focusDate.focusDate);
|
|
35
37
|
_this.years = useYears(_this.showDate.date, _this.status, _this.datepicker.focusDate.focusDate);
|
|
36
38
|
_this.months = useMonths(_this.showDate.date, _this.status, _this.datepicker.focusDate.focusDate);
|
|
39
|
+
_this.weeks = useWeeks(_this.showDate.date, _this.status, _this.datepicker.focusDate.focusDate);
|
|
40
|
+
_this.quarters = useQuarters(_this.showDate.date, _this.status, _this.datepicker.focusDate.focusDate);
|
|
37
41
|
_this.config = useConfigContext();
|
|
38
42
|
return _this;
|
|
39
43
|
}
|