@king-design/react 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/cascader/index.spec.js +18 -19
- package/components/datepicker/basepicker.d.ts +6 -25
- package/components/datepicker/basepicker.js +22 -234
- package/components/datepicker/calendar.d.ts +36 -6
- package/components/datepicker/calendar.js +4 -0
- package/components/datepicker/calendar.vdt.js +21 -5
- package/components/datepicker/dayjs.d.ts +2 -2
- package/components/datepicker/dayjs.js +6 -0
- package/components/datepicker/helpers.d.ts +8 -7
- package/components/datepicker/helpers.js +2 -3
- package/components/datepicker/index.d.ts +26 -19
- package/components/datepicker/index.js +21 -13
- package/components/datepicker/index.spec.js +1389 -633
- package/components/datepicker/index.vdt.js +43 -46
- package/components/datepicker/shortcuts.d.ts +1 -1
- package/components/datepicker/styles.d.ts +22 -0
- package/components/datepicker/styles.js +26 -4
- package/components/datepicker/useConfirm.d.ts +6 -0
- package/components/datepicker/useConfirm.js +65 -0
- package/components/datepicker/useDisabled.d.ts +7 -5
- package/components/datepicker/useDisabled.js +22 -27
- package/components/datepicker/useFormats.d.ts +2 -2
- package/components/datepicker/useFormats.js +9 -3
- package/components/datepicker/useHighlight.d.ts +14 -0
- package/components/datepicker/useHighlight.js +60 -0
- package/components/datepicker/useKeyboards.js +2 -1
- package/components/datepicker/useMergeRange.d.ts +5 -0
- package/components/datepicker/useMergeRange.js +45 -0
- package/components/datepicker/useMonths.js +5 -3
- package/components/datepicker/usePanel.d.ts +1 -10
- package/components/datepicker/usePanel.js +19 -32
- package/components/datepicker/useQuarters.d.ts +15 -0
- package/components/datepicker/useQuarters.js +36 -0
- package/components/datepicker/useShowDate.js +10 -2
- package/components/datepicker/useStatus.d.ts +1 -1
- package/components/datepicker/useStatus.js +33 -16
- package/components/datepicker/useValue.d.ts +12 -6
- package/components/datepicker/useValue.js +49 -45
- package/components/datepicker/useValueBase.d.ts +28 -0
- package/components/datepicker/useValueBase.js +277 -0
- package/components/datepicker/useWeeks.d.ts +19 -0
- package/components/datepicker/useWeeks.js +48 -0
- package/components/datepicker/useYears.js +6 -3
- package/components/dialog/useFixBody.js +6 -58
- package/components/dropdown/dropdown.d.ts +1 -0
- package/components/dropdown/dropdown.js +7 -4
- package/components/ellipsis/styles.js +1 -1
- package/components/form/styles.js +1 -1
- package/components/input/index.d.ts +2 -0
- package/components/input/index.js +6 -0
- package/components/input/index.spec.js +45 -0
- package/components/input/index.vdt.js +4 -3
- package/components/input/useAutoWidth.d.ts +2 -0
- package/components/input/useAutoWidth.js +19 -1
- package/components/scrollSelect/index.spec.js +4 -6
- package/components/scrollSelect/useMouseEvents.js +22 -9
- package/components/select/base.d.ts +1 -1
- package/components/select/base.js +3 -2
- package/components/select/base.vdt.js +5 -2
- package/components/select/index.spec.js +329 -82
- package/components/select/option.d.ts +1 -0
- package/components/select/option.js +10 -2
- package/components/select/select.d.ts +1 -0
- package/components/select/select.js +4 -2
- package/components/select/styles.d.ts +79 -0
- package/components/select/styles.js +1 -0
- package/components/select/useFilterable.js +2 -1
- package/components/select/useInput.d.ts +1 -1
- package/components/select/useInput.js +7 -4
- package/components/select/useSearchable.js +1 -0
- package/components/table/index.spec.js +84 -6
- package/components/table/useStickyHeader.js +1 -1
- package/components/timepicker/index.spec.js +298 -128
- package/components/timepicker/panelPicker.d.ts +23 -17
- package/components/timepicker/panelPicker.js +7 -4
- package/components/timepicker/panelPicker.vdt.js +8 -4
- package/components/timepicker/selectPicker.d.ts +5 -4
- package/components/timepicker/useConfirm.d.ts +6 -0
- package/components/timepicker/useConfirm.js +19 -0
- package/components/timepicker/useDefaultValue.d.ts +4 -0
- package/components/timepicker/useDefaultValue.js +27 -0
- package/components/timepicker/useDisabled.d.ts +7 -4
- package/components/timepicker/useDisabled.js +13 -4
- package/components/timepicker/useFormats.d.ts +1 -1
- package/components/timepicker/useValue.d.ts +14 -8
- package/components/timepicker/useValue.js +14 -15
- package/components/tour/index.d.ts +2 -0
- package/components/tour/index.js +2 -0
- package/components/tour/index.spec.d.ts +1 -0
- package/components/tour/index.spec.js +356 -0
- package/components/tour/step.d.ts +23 -0
- package/components/tour/step.js +46 -0
- package/components/tour/step.vdt.js +74 -0
- package/components/tour/styles.d.ts +7 -0
- package/components/tour/styles.js +84 -0
- package/components/tour/tour.d.ts +73 -0
- package/components/tour/tour.js +70 -0
- package/components/tour/tour.vdt.js +66 -0
- package/components/tour/useArrow.d.ts +4 -0
- package/components/tour/useArrow.js +40 -0
- package/components/tour/useFixBody.d.ts +4 -0
- package/components/tour/useFixBody.js +17 -0
- package/components/tour/useHighlight.d.ts +4 -0
- package/components/tour/useHighlight.js +31 -0
- package/components/tour/useMaskClosable.d.ts +1 -0
- package/components/tour/useMaskClosable.js +25 -0
- package/components/tour/useNavigation.d.ts +5 -0
- package/components/tour/useNavigation.js +103 -0
- package/components/tour/usePosition.d.ts +6 -0
- package/components/tour/usePosition.js +93 -0
- package/components/tour/useSteps.d.ts +6 -0
- package/components/tour/useSteps.js +68 -0
- package/hooks/useFixBody.d.ts +11 -0
- package/hooks/useFixBody.js +72 -0
- package/index.d.ts +3 -2
- package/index.js +3 -2
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TypeDefs } from 'intact-react';
|
|
2
2
|
import dayjs from './dayjs';
|
|
3
|
-
import { State } from '../../hooks/useState';
|
|
4
3
|
import { Shortcut } from './shortcuts';
|
|
5
|
-
import { BasePicker, BasePickerProps, BasePickerEvents, BasePickerBlocks
|
|
4
|
+
import { BasePicker, BasePickerProps, BasePickerEvents, BasePickerBlocks } from './basepicker';
|
|
5
|
+
import { Value } from './useValueBase';
|
|
6
6
|
export * as shortcuts from './shortcuts';
|
|
7
7
|
export { dayjs };
|
|
8
8
|
export interface DatepickerProps<V extends Value = Value, M extends boolean = boolean, R extends boolean = boolean> extends BasePickerProps<V extends string ? V : V | string, M, R> {
|
|
9
|
-
type?: 'date' | 'datetime' | 'year' | 'month';
|
|
9
|
+
type?: 'date' | 'datetime' | 'year' | 'month' | 'week' | 'quarter';
|
|
10
10
|
shortcuts?: Shortcut[];
|
|
11
11
|
}
|
|
12
12
|
export interface DatepickerEvents extends BasePickerEvents {
|
|
@@ -26,39 +26,46 @@ export declare class Datepicker<V extends Value = Value, M extends boolean = fal
|
|
|
26
26
|
getValueString: (value: dayjs.Dayjs) => string;
|
|
27
27
|
};
|
|
28
28
|
disabled: {
|
|
29
|
-
isDisabled: (value: dayjs.Dayjs, type?:
|
|
30
|
-
isDisabledTime: (value: dayjs.Dayjs
|
|
29
|
+
isDisabled: (value: dayjs.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;
|
|
30
|
+
isDisabledTime: (value: dayjs.Dayjs) => boolean;
|
|
31
31
|
isDisabledConfirm: () => boolean;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
isDisabledValue: (value: import("./useValueBase").StateValueItem) => boolean;
|
|
33
|
+
maxDate: import("../../hooks/useState").State<dayjs.Dayjs | null>;
|
|
34
|
+
minDate: import("../../hooks/useState").State<dayjs.Dayjs | null>;
|
|
34
35
|
};
|
|
35
36
|
panel: {
|
|
36
|
-
startPanel: State<import("./usePanel").PanelTypes>;
|
|
37
|
-
endPanel: State<import("./usePanel").PanelTypes>;
|
|
38
|
-
changePanel: (type: import("./usePanel").PanelTypes, flag?: import("./usePanel").PanelFlags) => void;
|
|
39
|
-
getPanel: (flag: import("./usePanel").PanelFlags) => State<import("./usePanel").PanelTypes>;
|
|
40
|
-
reset: () => void;
|
|
41
37
|
startRef: import('intact-react').RefObject<import("./calendar").DatepickerCalendar>;
|
|
42
38
|
endRef: import('intact-react').RefObject<import("./calendar").DatepickerCalendar>;
|
|
43
39
|
};
|
|
44
40
|
focusDate: {
|
|
45
|
-
focusDate: State<dayjs.Dayjs | null>;
|
|
41
|
+
focusDate: import("../../hooks/useState").State<dayjs.Dayjs | null>;
|
|
46
42
|
reset: () => void;
|
|
47
43
|
};
|
|
48
44
|
value: {
|
|
49
45
|
format: () => string | string[];
|
|
50
|
-
|
|
46
|
+
formatSingleValue: (value: import("./useValueBase").StateValueItem) => string;
|
|
51
47
|
onChangeTime: (date: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => void;
|
|
52
48
|
getTimeValue: (flag: import("./usePanel").PanelFlags) => dayjs.Dayjs | null | undefined;
|
|
53
|
-
convertToDayjs: (v: Value | [Value, Value] | Value[] | [Value, Value][] | null | undefined) => import("./
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
convertToDayjs: (v: Value | [Value, Value] | Value[] | [Value, Value][] | null | undefined) => import("./useValueBase").DayjsValue;
|
|
50
|
+
unique: () => void;
|
|
51
|
+
setMoment: () => void;
|
|
52
|
+
updateValue: () => void;
|
|
53
|
+
value: import("../../hooks/useState").State<import("./useValueBase").StateValue>;
|
|
54
|
+
setValue: (v: import("./useValueBase").StateValueItem, fromInput: boolean) => void;
|
|
57
55
|
onChangeDate: (v: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => void;
|
|
56
|
+
getDayjsValue: () => import("./useValueBase").DayjsValue;
|
|
57
|
+
allValuesUpdatedInMultipleMode: () => boolean | undefined;
|
|
58
|
+
};
|
|
59
|
+
highlight: {
|
|
60
|
+
position: import("../../hooks/useState").State<import("./useHighlight").Position>;
|
|
61
|
+
handleInputClick: () => void;
|
|
62
|
+
togglePosition: () => void;
|
|
63
|
+
highlightWidth: import("../../hooks/useState").State<number>;
|
|
64
|
+
highlightLeft: import("../../hooks/useState").State<number>;
|
|
58
65
|
};
|
|
66
|
+
private confirm;
|
|
59
67
|
init(): void;
|
|
60
68
|
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import('intact-react').Children[];
|
|
61
69
|
protected getLabel(): string | string[];
|
|
62
|
-
protected clear(e: MouseEvent): void;
|
|
63
70
|
private setByShortcut;
|
|
64
71
|
}
|
|
@@ -15,17 +15,22 @@ import { useFormats } from './useFormats';
|
|
|
15
15
|
import { usePanel } from './usePanel';
|
|
16
16
|
import { useFocusDate } from './useFocusDate';
|
|
17
17
|
import { useKeyboards } from './useKeyboards';
|
|
18
|
+
import { useHighlight } from './useHighlight';
|
|
19
|
+
// import {useMergeRange} from './useMergeRange';
|
|
18
20
|
import { BasePicker } from './basepicker';
|
|
21
|
+
import { useConfirm } from './useConfirm';
|
|
19
22
|
import * as _shortcuts from './shortcuts';
|
|
20
23
|
export { _shortcuts as shortcuts };
|
|
21
24
|
export { dayjs };
|
|
22
25
|
var typeDefs = _extends({}, BasePicker.typeDefs, {
|
|
23
|
-
type: ['date', 'datetime', 'year', 'month'],
|
|
26
|
+
type: ['date', 'datetime', 'year', 'month', 'week', 'quarter'],
|
|
24
27
|
shortcuts: Array
|
|
28
|
+
// isMerge: Boolean
|
|
25
29
|
});
|
|
26
30
|
var defaults = function defaults() {
|
|
27
31
|
return _extends({}, BasePicker.defaults(), {
|
|
28
32
|
type: 'date'
|
|
33
|
+
// isMerge: false
|
|
29
34
|
});
|
|
30
35
|
};
|
|
31
36
|
export var Datepicker = /*#__PURE__*/function (_BasePicker) {
|
|
@@ -38,10 +43,17 @@ export var Datepicker = /*#__PURE__*/function (_BasePicker) {
|
|
|
38
43
|
}
|
|
39
44
|
_this = _BasePicker.call.apply(_BasePicker, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
40
45
|
_this.formats = useFormats();
|
|
41
|
-
_this.disabled = useDisabled(_this.formats)
|
|
46
|
+
_this.disabled = useDisabled(_this.formats, function () {
|
|
47
|
+
return _this.highlight.position;
|
|
48
|
+
});
|
|
42
49
|
_this.panel = usePanel();
|
|
43
50
|
_this.focusDate = useFocusDate();
|
|
44
|
-
_this.value = useValue(_this.formats, _this.disabled, _this.panel)
|
|
51
|
+
_this.value = useValue(_this.formats, _this.disabled, _this.panel, function () {
|
|
52
|
+
return _this.highlight.position;
|
|
53
|
+
});
|
|
54
|
+
_this.highlight = useHighlight(_this.value.value, _this.formats.getShowString, _this.input.keywords);
|
|
55
|
+
// public mergeRange = useMergeRange(this.formats);
|
|
56
|
+
_this.confirm = useConfirm(_this.highlight, _this.value, _this.formats.getValueString);
|
|
45
57
|
return _this;
|
|
46
58
|
}
|
|
47
59
|
var _proto = Datepicker.prototype;
|
|
@@ -60,9 +72,13 @@ export var Datepicker = /*#__PURE__*/function (_BasePicker) {
|
|
|
60
72
|
case 'datetime':
|
|
61
73
|
return range ? _$('开始时间 ~ 结束时间') : _$('请选择日期和时间');
|
|
62
74
|
case 'year':
|
|
63
|
-
return _$('请选择年份');
|
|
75
|
+
return range ? _$('开始年份 ~ 结束年份') : _$('请选择年份');
|
|
64
76
|
case 'month':
|
|
65
|
-
return _$('请选择月份');
|
|
77
|
+
return range ? _$('开始月份 ~ 结束月份') : _$('请选择月份');
|
|
78
|
+
case 'week':
|
|
79
|
+
return range ? _$('开始周 ~ 结束周') : _$('请选择周');
|
|
80
|
+
case 'quarter':
|
|
81
|
+
return range ? _$('开始季度 ~ 结束季度') : _$('请选择季度');
|
|
66
82
|
default:
|
|
67
83
|
return range ? _$('开始日期 ~ 结束日期') : _$('请选择日期');
|
|
68
84
|
}
|
|
@@ -70,13 +86,6 @@ export var Datepicker = /*#__PURE__*/function (_BasePicker) {
|
|
|
70
86
|
_proto.getLabel = function getLabel() {
|
|
71
87
|
return this.value.format();
|
|
72
88
|
};
|
|
73
|
-
_proto.clear = function clear(e) {
|
|
74
|
-
_BasePicker.prototype.clear.call(this, e);
|
|
75
|
-
if (this.get('type') === 'datetime') {
|
|
76
|
-
// reset the state to let user re-select
|
|
77
|
-
this.panel.reset();
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
89
|
_proto.setByShortcut = function setByShortcut(shortcut) {
|
|
81
90
|
var _this$value = this.value,
|
|
82
91
|
setValue = _this$value.setValue,
|
|
@@ -93,5 +102,4 @@ export var Datepicker = /*#__PURE__*/function (_BasePicker) {
|
|
|
93
102
|
Datepicker.template = template;
|
|
94
103
|
Datepicker.typeDefs = typeDefs;
|
|
95
104
|
Datepicker.defaults = defaults;
|
|
96
|
-
__decorate([bind], Datepicker.prototype, "clear", null);
|
|
97
105
|
__decorate([bind], Datepicker.prototype, "setByShortcut", null);
|