@king-design/intact 3.6.0-beta.0 → 3.6.1
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/button/demos/basic.md +0 -1
- package/components/cascader/index.spec.ts +7 -6
- package/components/copy/index.spec.ts +9 -14
- package/components/datepicker/basepicker.ts +26 -314
- package/components/datepicker/calendar.ts +3 -1
- package/components/datepicker/calendar.vdt +5 -2
- package/components/datepicker/dayjs.ts +2 -16
- package/components/datepicker/demos/multiple.md +5 -0
- package/components/datepicker/demos/yearMonth.md +2 -8
- package/components/datepicker/helpers.ts +5 -7
- package/components/datepicker/index.md +1 -2
- package/components/datepicker/index.spec.ts +596 -157
- package/components/datepicker/index.ts +16 -33
- package/components/datepicker/index.vdt +41 -35
- package/components/datepicker/shortcuts.ts +1 -1
- package/components/datepicker/styles.ts +27 -18
- package/components/datepicker/useConfirm.ts +82 -0
- package/components/datepicker/useDisabled.ts +29 -31
- package/components/datepicker/useFormats.ts +8 -4
- package/components/datepicker/useHighlight.ts +81 -0
- package/components/datepicker/useKeyboards.ts +2 -1
- package/components/datepicker/useMergeRange.ts +12 -12
- package/components/datepicker/useMonths.ts +6 -3
- package/components/datepicker/usePanel.ts +19 -19
- package/components/datepicker/useShowDate.ts +21 -41
- package/components/datepicker/useStatus.ts +34 -15
- package/components/datepicker/useValue.ts +43 -72
- package/components/datepicker/useValueBase.ts +312 -0
- package/components/datepicker/useWeeks.ts +1 -1
- package/components/datepicker/useYears.ts +7 -3
- 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/form/form.ts +4 -0
- package/components/form/index.md +2 -1
- package/components/form/index.spec.ts +2 -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/demos/horizontal.md +7 -1
- package/components/menu/index.spec.ts +19 -0
- package/components/menu/styles.ts +2 -1
- package/components/scrollSelect/useMouseEvents.ts +5 -4
- package/components/select/base.ts +3 -2
- package/components/select/base.vdt +2 -1
- package/components/select/demos/creatable.md +2 -2
- package/components/select/index.md +1 -1
- package/components/select/index.spec.ts +142 -36
- package/components/select/menu.ts +1 -1
- package/components/select/option.ts +2 -1
- package/components/select/select.ts +1 -0
- package/components/select/styles.ts +3 -1
- package/components/select/useCard.ts +22 -4
- package/components/select/useInput.ts +5 -9
- package/components/spinner/index.spec.ts +18 -0
- package/components/spinner/useValue.ts +2 -1
- package/components/table/index.spec.ts +69 -1
- package/components/table/useStickyHeader.ts +1 -1
- package/components/timepicker/index.spec.ts +145 -27
- package/components/timepicker/panelPicker.ts +10 -4
- package/components/timepicker/panelPicker.vdt +3 -5
- package/components/timepicker/styles.ts +1 -0
- 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/index.spec.ts +1 -1
- package/es/components/cascader/index.spec.js +18 -19
- package/es/components/copy/index.spec.js +14 -31
- package/es/components/datepicker/basepicker.d.ts +6 -27
- package/es/components/datepicker/basepicker.js +23 -268
- package/es/components/datepicker/calendar.d.ts +4 -2
- package/es/components/datepicker/dayjs.d.ts +2 -13
- package/es/components/datepicker/helpers.d.ts +3 -2
- package/es/components/datepicker/helpers.js +2 -3
- package/es/components/datepicker/index.d.ts +21 -29
- package/es/components/datepicker/index.js +22 -32
- package/es/components/datepicker/index.spec.js +1277 -484
- package/es/components/datepicker/index.vdt.js +39 -38
- package/es/components/datepicker/shortcuts.d.ts +1 -1
- package/es/components/datepicker/styles.d.ts +7 -2
- package/es/components/datepicker/styles.js +10 -15
- package/es/components/datepicker/useConfirm.d.ts +6 -0
- package/es/components/datepicker/useConfirm.js +65 -0
- package/es/components/datepicker/useDisabled.d.ts +5 -3
- package/es/components/datepicker/useDisabled.js +22 -27
- package/es/components/datepicker/useFormats.d.ts +2 -2
- package/es/components/datepicker/useFormats.js +6 -2
- 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 +1 -1
- package/es/components/datepicker/useMergeRange.js +11 -16
- 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/useShowDate.d.ts +1 -1
- package/es/components/datepicker/useShowDate.js +15 -40
- package/es/components/datepicker/useStatus.js +33 -16
- package/es/components/datepicker/useValue.d.ts +11 -6
- package/es/components/datepicker/useValue.js +49 -69
- package/es/components/datepicker/useValueBase.d.ts +28 -0
- package/es/components/datepicker/useValueBase.js +280 -0
- package/es/components/datepicker/useYears.js +6 -3
- package/es/components/dropdown/dropdown.d.ts +1 -0
- package/es/components/dropdown/dropdown.js +7 -4
- package/es/components/form/form.d.ts +1 -0
- package/es/components/form/form.js +7 -0
- package/es/components/form/index.spec.js +10 -8
- 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/menu/index.spec.js +28 -0
- package/es/components/menu/styles.js +2 -2
- package/es/components/scrollSelect/useMouseEvents.js +5 -4
- package/es/components/select/base.d.ts +1 -1
- package/es/components/select/base.js +3 -2
- package/es/components/select/base.vdt.js +4 -3
- package/es/components/select/index.spec.js +346 -218
- package/es/components/select/menu.js +1 -1
- package/es/components/select/option.js +2 -1
- package/es/components/select/select.js +2 -1
- package/es/components/select/styles.d.ts +79 -0
- package/es/components/select/styles.js +1 -0
- package/es/components/select/useCard.d.ts +4 -3
- package/es/components/select/useCard.js +15 -4
- package/es/components/select/useInput.d.ts +1 -1
- package/es/components/select/useInput.js +4 -4
- package/es/components/spinner/index.spec.js +82 -44
- package/es/components/spinner/useValue.js +2 -1
- 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 +21 -16
- package/es/components/timepicker/panelPicker.js +7 -4
- package/es/components/timepicker/panelPicker.vdt.js +5 -9
- package/es/components/timepicker/selectPicker.d.ts +4 -3
- package/es/components/timepicker/styles.js +1 -1
- 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 +6 -3
- package/es/components/timepicker/useDisabled.js +13 -4
- package/es/components/timepicker/useFormats.d.ts +1 -1
- package/es/components/timepicker/useValue.d.ts +13 -8
- package/es/components/timepicker/useValue.js +14 -15
- package/es/components/tour/index.spec.js +1 -1
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/site/data/components/button/demos/basic/react.js +0 -2
- package/es/site/data/components/datepicker/demos/multiple/index.d.ts +1 -0
- package/es/site/data/components/datepicker/demos/multiple/index.js +2 -1
- package/es/site/data/components/datepicker/demos/multiple/react.d.ts +1 -0
- package/es/site/data/components/datepicker/demos/multiple/react.js +13 -2
- package/es/site/data/components/datepicker/demos/yearMonth/index.d.ts +0 -2
- package/es/site/data/components/datepicker/demos/yearMonth/index.js +1 -3
- package/es/site/data/components/datepicker/demos/yearMonth/react.d.ts +0 -2
- package/es/site/data/components/datepicker/demos/yearMonth/react.js +1 -21
- package/es/site/data/components/menu/demos/horizontal/react.js +5 -1
- package/es/site/data/components/select/demos/creatable/react.js +2 -2
- package/es/site/data/components/select/demos/searchable/index.js +1 -1
- package/es/site/data/components/select/demos/searchable/react.js +1 -1
- package/es/site/data/components/tour/demos/customText/index.d.ts +19 -6
- package/es/site/data/components/tour/demos/customText/index.js +18 -17
- package/es/site/data/components/tour/demos/customText/react.d.ts +20 -6
- package/es/site/data/components/tour/demos/customText/react.js +31 -27
- package/es/test/demos.js +1 -1
- package/index.ts +2 -2
- package/package.json +2 -2
- package/components/datepicker/demos/nowrap.md +0 -35
- package/components/datepicker/usePosition.ts +0 -169
- package/es/components/datepicker/usePosition.d.ts +0 -10
- package/es/components/datepicker/usePosition.js +0 -166
- package/es/site/data/components/datepicker/demos/nowrap/index.d.ts +0 -10
- package/es/site/data/components/datepicker/demos/nowrap/index.js +0 -19
- package/es/site/data/components/datepicker/demos/nowrap/react.d.ts +0 -10
- package/es/site/data/components/datepicker/demos/nowrap/react.js +0 -49
- package/es/site/data/components/tour/demos/customButtons/index.d.ts +0 -33
- package/es/site/data/components/tour/demos/customButtons/index.js +0 -55
- package/es/site/data/components/tour/demos/customButtons/react.d.ts +0 -33
- package/es/site/data/components/tour/demos/customButtons/react.js +0 -99
|
@@ -14,7 +14,7 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
14
14
|
_this = _React$Component.call.apply(_React$Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
15
15
|
_this.state = {
|
|
16
16
|
day: null,
|
|
17
|
-
days: [
|
|
17
|
+
days: []
|
|
18
18
|
};
|
|
19
19
|
return _this;
|
|
20
20
|
}
|
|
@@ -5,16 +5,29 @@ export default class extends Component {
|
|
|
5
5
|
static defaults(): {
|
|
6
6
|
currentStep: number;
|
|
7
7
|
showTour: boolean;
|
|
8
|
-
|
|
9
|
-
prevText: string;
|
|
10
|
-
doneText: string;
|
|
11
|
-
tourData: {
|
|
8
|
+
tourData: ({
|
|
12
9
|
target: string;
|
|
13
10
|
title: string;
|
|
14
11
|
content: string;
|
|
15
12
|
position: string;
|
|
16
|
-
|
|
13
|
+
nextText: string;
|
|
14
|
+
prevText?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
target: string;
|
|
17
|
+
title: string;
|
|
18
|
+
content: string;
|
|
19
|
+
position: string;
|
|
20
|
+
nextText: string;
|
|
21
|
+
prevText: string;
|
|
22
|
+
} | {
|
|
23
|
+
target: string;
|
|
24
|
+
title: string;
|
|
25
|
+
content: string;
|
|
26
|
+
position: string;
|
|
27
|
+
prevText: string;
|
|
28
|
+
nextText?: undefined;
|
|
29
|
+
})[];
|
|
17
30
|
};
|
|
18
31
|
startTour(): void;
|
|
19
|
-
|
|
32
|
+
close(): void;
|
|
20
33
|
}
|
|
@@ -13,24 +13,25 @@ var default_1 = /*#__PURE__*/function (_Component) {
|
|
|
13
13
|
return {
|
|
14
14
|
currentStep: 0,
|
|
15
15
|
showTour: false,
|
|
16
|
-
nextText: '前进',
|
|
17
|
-
prevText: '返回',
|
|
18
|
-
doneText: '完成设置',
|
|
19
16
|
tourData: [{
|
|
20
|
-
target: '#
|
|
21
|
-
title: '
|
|
22
|
-
content: '
|
|
23
|
-
position: 'bottom'
|
|
17
|
+
target: '#welcome-btn',
|
|
18
|
+
title: '欢迎使用!',
|
|
19
|
+
content: '欢迎来到我们的应用,让我们开始引导之旅吧!',
|
|
20
|
+
position: 'bottom',
|
|
21
|
+
nextText: '开始探索'
|
|
24
22
|
}, {
|
|
25
|
-
target: '#
|
|
26
|
-
title: '
|
|
27
|
-
content: '
|
|
28
|
-
position: 'bottom'
|
|
23
|
+
target: '#feature-btn',
|
|
24
|
+
title: '功能介绍',
|
|
25
|
+
content: '这里是主要功能区域,您可以在这里进行各种操作。',
|
|
26
|
+
position: 'bottom',
|
|
27
|
+
nextText: '前进',
|
|
28
|
+
prevText: '回到开始'
|
|
29
29
|
}, {
|
|
30
|
-
target: '#
|
|
31
|
-
title: '
|
|
32
|
-
content: '
|
|
33
|
-
position: '
|
|
30
|
+
target: '#finish-btn',
|
|
31
|
+
title: '设置完成',
|
|
32
|
+
content: '恭喜!您已经完成了所有设置,现在可以开始使用了。',
|
|
33
|
+
position: 'top',
|
|
34
|
+
prevText: '返回上一步'
|
|
34
35
|
}]
|
|
35
36
|
};
|
|
36
37
|
};
|
|
@@ -41,7 +42,7 @@ var default_1 = /*#__PURE__*/function (_Component) {
|
|
|
41
42
|
currentStep: 0
|
|
42
43
|
});
|
|
43
44
|
};
|
|
44
|
-
_proto.
|
|
45
|
+
_proto.close = function close() {
|
|
45
46
|
this.set({
|
|
46
47
|
showTour: false
|
|
47
48
|
});
|
|
@@ -51,4 +52,4 @@ var default_1 = /*#__PURE__*/function (_Component) {
|
|
|
51
52
|
default_1.template = template;
|
|
52
53
|
export { default_1 as default };
|
|
53
54
|
__decorate([bind], default_1.prototype, "startTour", null);
|
|
54
|
-
__decorate([bind], default_1.prototype, "
|
|
55
|
+
__decorate([bind], default_1.prototype, "close", null);
|
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import './index.styl';
|
|
2
3
|
export default class Demo extends React.Component {
|
|
3
4
|
state: {
|
|
4
5
|
currentStep: number;
|
|
5
6
|
showTour: boolean;
|
|
6
|
-
|
|
7
|
-
prevText: string;
|
|
8
|
-
doneText: string;
|
|
9
|
-
tourData: {
|
|
7
|
+
tourData: ({
|
|
10
8
|
target: string;
|
|
11
9
|
title: string;
|
|
12
10
|
content: string;
|
|
13
11
|
position: string;
|
|
14
|
-
|
|
12
|
+
nextText: string;
|
|
13
|
+
prevText?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
target: string;
|
|
16
|
+
title: string;
|
|
17
|
+
content: string;
|
|
18
|
+
position: string;
|
|
19
|
+
nextText: string;
|
|
20
|
+
prevText: string;
|
|
21
|
+
} | {
|
|
22
|
+
target: string;
|
|
23
|
+
title: string;
|
|
24
|
+
content: string;
|
|
25
|
+
position: string;
|
|
26
|
+
prevText: string;
|
|
27
|
+
nextText?: undefined;
|
|
28
|
+
})[];
|
|
15
29
|
};
|
|
16
30
|
startTour(): void;
|
|
17
|
-
|
|
31
|
+
close(): void;
|
|
18
32
|
render(): React.JSX.Element;
|
|
19
33
|
}
|
|
@@ -3,6 +3,7 @@ import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/con
|
|
|
3
3
|
import { __decorate } from "tslib";
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Tour, Button } from '@king-design/react';
|
|
6
|
+
import './index.styl';
|
|
6
7
|
import { bind } from '@king-design/react';
|
|
7
8
|
var Demo = /*#__PURE__*/function (_React$Component) {
|
|
8
9
|
_inheritsLoose(Demo, _React$Component);
|
|
@@ -16,24 +17,25 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
16
17
|
_this.state = {
|
|
17
18
|
currentStep: 0,
|
|
18
19
|
showTour: false,
|
|
19
|
-
nextText: '前进',
|
|
20
|
-
prevText: '返回',
|
|
21
|
-
doneText: '完成设置',
|
|
22
20
|
tourData: [{
|
|
23
|
-
target: '#
|
|
24
|
-
title: '
|
|
25
|
-
content: '
|
|
26
|
-
position: 'bottom'
|
|
21
|
+
target: '#welcome-btn',
|
|
22
|
+
title: '欢迎使用!',
|
|
23
|
+
content: '欢迎来到我们的应用,让我们开始引导之旅吧!',
|
|
24
|
+
position: 'bottom',
|
|
25
|
+
nextText: '开始探索'
|
|
27
26
|
}, {
|
|
28
|
-
target: '#
|
|
29
|
-
title: '
|
|
30
|
-
content: '
|
|
31
|
-
position: 'bottom'
|
|
27
|
+
target: '#feature-btn',
|
|
28
|
+
title: '功能介绍',
|
|
29
|
+
content: '这里是主要功能区域,您可以在这里进行各种操作。',
|
|
30
|
+
position: 'bottom',
|
|
31
|
+
nextText: '前进',
|
|
32
|
+
prevText: '回到开始'
|
|
32
33
|
}, {
|
|
33
|
-
target: '#
|
|
34
|
-
title: '
|
|
35
|
-
content: '
|
|
36
|
-
position: '
|
|
34
|
+
target: '#finish-btn',
|
|
35
|
+
title: '设置完成',
|
|
36
|
+
content: '恭喜!您已经完成了所有设置,现在可以开始使用了。',
|
|
37
|
+
position: 'top',
|
|
38
|
+
prevText: '返回上一步'
|
|
37
39
|
}]
|
|
38
40
|
};
|
|
39
41
|
return _this;
|
|
@@ -45,7 +47,7 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
45
47
|
currentStep: 0
|
|
46
48
|
});
|
|
47
49
|
};
|
|
48
|
-
_proto.
|
|
50
|
+
_proto.close = function close() {
|
|
49
51
|
this.setState({
|
|
50
52
|
showTour: false
|
|
51
53
|
});
|
|
@@ -55,18 +57,18 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
55
57
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
|
|
56
58
|
className: "example-container"
|
|
57
59
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
58
|
-
id: "
|
|
59
|
-
}, "\
|
|
60
|
-
id: "
|
|
60
|
+
id: "welcome-btn"
|
|
61
|
+
}, "\u6B22\u8FCE\u9875\u9762"), /*#__PURE__*/React.createElement(Button, {
|
|
62
|
+
id: "feature-btn",
|
|
61
63
|
style: {
|
|
62
64
|
"marginLeft": "20px"
|
|
63
65
|
}
|
|
64
|
-
}, "\
|
|
65
|
-
id: "
|
|
66
|
+
}, "\u529F\u80FD\u4ECB\u7ECD"), /*#__PURE__*/React.createElement(Button, {
|
|
67
|
+
id: "finish-btn",
|
|
66
68
|
style: {
|
|
67
69
|
"marginLeft": "20px"
|
|
68
70
|
}
|
|
69
|
-
}, "\
|
|
71
|
+
}, "\u5B8C\u6210\u8BBE\u7F6E")), /*#__PURE__*/React.createElement(Tour, {
|
|
70
72
|
value: this.state.currentStep,
|
|
71
73
|
onChangeValue: function onChangeValue(currentStep) {
|
|
72
74
|
return _this2.setState({
|
|
@@ -75,21 +77,23 @@ var Demo = /*#__PURE__*/function (_React$Component) {
|
|
|
75
77
|
},
|
|
76
78
|
visible: this.state.showTour,
|
|
77
79
|
data: this.state.tourData,
|
|
78
|
-
doneText:
|
|
79
|
-
onFinish: this.
|
|
80
|
+
doneText: "\u5B8C\u6210",
|
|
81
|
+
onFinish: this.close
|
|
80
82
|
}), /*#__PURE__*/React.createElement("div", {
|
|
81
83
|
style: {
|
|
82
84
|
"marginTop": "20px"
|
|
83
85
|
}
|
|
84
86
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
85
|
-
|
|
87
|
+
type: "primary",
|
|
88
|
+
onClick: this.startTour
|
|
89
|
+
}, "\u5F00\u59CB\u81EA\u5B9A\u4E49\u6309\u94AE\u5F15\u5BFC"), /*#__PURE__*/React.createElement("span", {
|
|
86
90
|
style: {
|
|
87
91
|
"marginLeft": "10px"
|
|
88
92
|
}
|
|
89
|
-
}, "\
|
|
93
|
+
}, "\u5F53\u524D\u6B65\u9AA4: ", this.state.currentStep >= 0 ? this.state.currentStep + 1 : '未启动')));
|
|
90
94
|
};
|
|
91
95
|
return Demo;
|
|
92
96
|
}(React.Component);
|
|
93
97
|
export { Demo as default };
|
|
94
98
|
__decorate([bind], Demo.prototype, "startTour", null);
|
|
95
|
-
__decorate([bind], Demo.prototype, "
|
|
99
|
+
__decorate([bind], Demo.prototype, "close", null);
|
package/es/test/demos.js
CHANGED
|
@@ -2,7 +2,7 @@ import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
3
|
import { mount, testDemos, unmount, nextFrame } from './utils';
|
|
4
4
|
var req = require.context('~/components/', true, /^((?!(affix|code)).)*\/demos\/.*index\.ts$/);
|
|
5
|
-
// const req = require.context('~/components/', true, /
|
|
5
|
+
// const req = require.context('~/components/', true, /button\/demos\/.*index\.ts$/);
|
|
6
6
|
// const vueReq = require.context('~/components/', true, /^((?!(affix|code)).)*\/demos\/.*index\.vue$/);
|
|
7
7
|
describe('Demos', function () {
|
|
8
8
|
afterEach(function () {
|
package/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @king-design v3.6.
|
|
2
|
+
* @king-design v3.6.1
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Kingsoft Cloud
|
|
5
5
|
* Released under the MIT License
|
|
@@ -71,6 +71,6 @@ export * from './components/view';
|
|
|
71
71
|
export * from './components/virtualList';
|
|
72
72
|
export * from './components/wave';
|
|
73
73
|
|
|
74
|
-
export const version = '3.6.
|
|
74
|
+
export const version = '3.6.1';
|
|
75
75
|
|
|
76
76
|
/* generate end */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-design/intact",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"description": "A component library written in Intact for Intact, Vue, React and Angular",
|
|
5
5
|
"main": "es/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
"@emotion/css": "^11.5.0",
|
|
181
181
|
"dayjs": "^1.10.7",
|
|
182
182
|
"enquire.js": "^2.1.6",
|
|
183
|
-
"intact": "^3.0.
|
|
183
|
+
"intact": "^3.0.44",
|
|
184
184
|
"monaco-editor": "^0.26.1",
|
|
185
185
|
"mxgraphx": "^4.0.7",
|
|
186
186
|
"resize-observer-polyfill": "^1.5.1",
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 单行显示
|
|
3
|
-
order: 7
|
|
4
|
-
---
|
|
5
|
-
`nowrap`属性可以控制是否换行显示,`isMerge`属性可以控制不换行显示时是否交叉自动合并
|
|
6
|
-
|
|
7
|
-
```vdt
|
|
8
|
-
import {Datepicker} from 'kpc';
|
|
9
|
-
|
|
10
|
-
<div>
|
|
11
|
-
<Datepicker multiple nowrap range v-model="dateRange" />
|
|
12
|
-
You selected: {JSON.stringify(this.get('dateRange'))}
|
|
13
|
-
<br /><br />
|
|
14
|
-
<Datepicker multiple nowrap isMerge range v-model="mergeDateRange" />
|
|
15
|
-
You selected: {JSON.stringify(this.get('mergeDateRange'))}
|
|
16
|
-
<br /><br />
|
|
17
|
-
</div>
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
interface Props {
|
|
22
|
-
dateRange?: [string, string][]
|
|
23
|
-
mergeDateRange?: [string, string][]
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default class extends Component<Props> {
|
|
27
|
-
static template = template;
|
|
28
|
-
static defaults() {
|
|
29
|
-
return {
|
|
30
|
-
dateRange: [],
|
|
31
|
-
mergeDateRange: [],
|
|
32
|
-
} as Props;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
```
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import {useInstance} from 'intact';
|
|
2
|
-
import type {Datepicker} from './';
|
|
3
|
-
import { useState } from '../../hooks/useState';
|
|
4
|
-
import {last} from '../utils';
|
|
5
|
-
|
|
6
|
-
export function usePosition() {
|
|
7
|
-
const instance = useInstance() as Datepicker;
|
|
8
|
-
const position = useState<'start' | 'end'>('start');
|
|
9
|
-
|
|
10
|
-
// 根据类型获取默认字符长度
|
|
11
|
-
function getDefaultCharLength() {
|
|
12
|
-
const {type} = instance.get();
|
|
13
|
-
switch (type) {
|
|
14
|
-
case 'datetime':
|
|
15
|
-
return 16 ; // "2025-07-10 00:00:00"
|
|
16
|
-
case 'date':
|
|
17
|
-
return 10; // "2025-07-09"
|
|
18
|
-
default:
|
|
19
|
-
return 10;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const charLength = useState<number>(getDefaultCharLength()); // 当前活动部分的字符长度
|
|
24
|
-
const startTextLength = useState<number>(getDefaultCharLength()); // 开始文本的长度,用于计算结束文本位置
|
|
25
|
-
|
|
26
|
-
// 监听类型变化,更新默认字符长度
|
|
27
|
-
instance.watch('type', () => {
|
|
28
|
-
const defaultLength = getDefaultCharLength();
|
|
29
|
-
charLength.set(defaultLength);
|
|
30
|
-
startTextLength.set(defaultLength);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
function handleInputClick(e: MouseEvent) {
|
|
34
|
-
const { range, type } = instance.get();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!range) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// 对于日期时间范围选择器,如果当前没有值或值不完整,总是设置为开始时间
|
|
41
|
-
if (type === 'datetime') {
|
|
42
|
-
const currentValue = instance.value.value.value;
|
|
43
|
-
const lastValue = last(currentValue);
|
|
44
|
-
// 如果没有值或者当前范围值不完整(只有开始时间没有结束时间),强制设置为开始时间
|
|
45
|
-
if (!lastValue || !Array.isArray(lastValue) || lastValue.length < 2 || !lastValue[1]) {
|
|
46
|
-
position.set('start');
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// 获取事件目标元素
|
|
52
|
-
let target = e.currentTarget as HTMLElement;
|
|
53
|
-
// 如果目标元素不是 .k-select-main,则查找父元素
|
|
54
|
-
if (!target.classList.contains(`.k-select-main`)) {
|
|
55
|
-
target = target.closest(`.k-select-main`) as HTMLElement;
|
|
56
|
-
if (!target) return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const hiddenInput = target.querySelector('input[type="hidden"]') as HTMLInputElement;
|
|
60
|
-
const { width: totalVisualWidth } = target.getBoundingClientRect();
|
|
61
|
-
let midPoint;
|
|
62
|
-
if (hiddenInput && hiddenInput.value && hiddenInput.value.includes(',')) {
|
|
63
|
-
// 分割字符串获取开始和结束日期的文本
|
|
64
|
-
const [startText, endText] = hiddenInput.value.split(',');
|
|
65
|
-
// 确保两部分都存在,避免计算错误
|
|
66
|
-
if (startText && endText) {
|
|
67
|
-
const totalCharLength = startText.length + endText.length;
|
|
68
|
-
// 计算开始日期文本长度所占的比例
|
|
69
|
-
const startRatio = startText.length / totalCharLength;
|
|
70
|
-
|
|
71
|
-
// 估算每个字符的宽度(与样式中保持一致)
|
|
72
|
-
const charWidthPx = 8;
|
|
73
|
-
|
|
74
|
-
// 计算实际文本占用的宽度
|
|
75
|
-
const startTextWidth = startText.length * charWidthPx;
|
|
76
|
-
const endTextWidth = endText.length * charWidthPx;
|
|
77
|
-
const separatorWidth = 3 * charWidthPx; // " ~ " 大约3个字符宽度
|
|
78
|
-
const totalTextWidth = startTextWidth + separatorWidth + endTextWidth;
|
|
79
|
-
|
|
80
|
-
// 如果文本宽度超过input宽度,使用比例分割
|
|
81
|
-
if (totalTextWidth >= totalVisualWidth) {
|
|
82
|
-
midPoint = totalVisualWidth * startRatio;
|
|
83
|
-
} else {
|
|
84
|
-
// 如果文本宽度小于input宽度,使用实际文本宽度计算分割点
|
|
85
|
-
midPoint = startTextWidth + separatorWidth / 2;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// 更新开始文本长度状态,限制为默认长度以保证结束时间高亮位置正确
|
|
89
|
-
startTextLength.set(Math.min(startText.length, getDefaultCharLength()));
|
|
90
|
-
|
|
91
|
-
} else {
|
|
92
|
-
// 如果值格式不正确(例如 "2025-07-09,"),则退回使用几何中心点
|
|
93
|
-
const defaultLength = getDefaultCharLength();
|
|
94
|
-
charLength.set(defaultLength);
|
|
95
|
-
startTextLength.set(defaultLength);
|
|
96
|
-
midPoint = totalVisualWidth / 2;
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
// 如果没有找到 hiddenInput 或其值不是范围,则退回原始的几何中心点
|
|
100
|
-
const defaultLength = getDefaultCharLength();
|
|
101
|
-
charLength.set(defaultLength);
|
|
102
|
-
startTextLength.set(defaultLength);
|
|
103
|
-
midPoint = totalVisualWidth / 2;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// 计算相对于 target 的 offsetX
|
|
107
|
-
const rect = target.getBoundingClientRect();
|
|
108
|
-
const offsetX = e.clientX - rect.left;
|
|
109
|
-
// 根据点击位置判断是点击了左半边(开始)还是右半边(结束)
|
|
110
|
-
if (offsetX < midPoint) {
|
|
111
|
-
position.set('start');
|
|
112
|
-
// 更新为开始部分的字符长度,限制为默认长度
|
|
113
|
-
if (hiddenInput && hiddenInput.value && hiddenInput.value.includes(',')) {
|
|
114
|
-
const [startText] = hiddenInput.value.split(',');
|
|
115
|
-
charLength.set(Math.min(startText.length, getDefaultCharLength()));
|
|
116
|
-
}
|
|
117
|
-
} else {
|
|
118
|
-
position.set('end');
|
|
119
|
-
// 更新为结束部分的字符长度,限制为默认长度
|
|
120
|
-
if (hiddenInput && hiddenInput.value && hiddenInput.value.includes(',')) {
|
|
121
|
-
const [, endText] = hiddenInput.value.split(',');
|
|
122
|
-
charLength.set(Math.min(endText.length, getDefaultCharLength()));
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// 重置位置到指定值
|
|
128
|
-
function resetPosition(pos: 'start' | 'end' = 'start') {
|
|
129
|
-
if (position.value === pos) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
position.set(pos);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// 切换位置
|
|
136
|
-
function togglePosition() {
|
|
137
|
-
const currentPosition = position.value;
|
|
138
|
-
if (currentPosition === 'start') {
|
|
139
|
-
position.set('end');
|
|
140
|
-
} else {
|
|
141
|
-
position.set('start');
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// 在组件初始化时设置事件监听
|
|
146
|
-
function setupEventListeners() {
|
|
147
|
-
// instance.on('resetPosition', resetPosition);
|
|
148
|
-
instance.on('togglePosition', togglePosition);
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function resetToStart() {
|
|
153
|
-
const {range, type} = instance.get();
|
|
154
|
-
if (range && type === 'date') {
|
|
155
|
-
position.set('start');
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return {
|
|
160
|
-
position,
|
|
161
|
-
charLength,
|
|
162
|
-
startTextLength,
|
|
163
|
-
handleInputClick,
|
|
164
|
-
resetPosition,
|
|
165
|
-
togglePosition,
|
|
166
|
-
setupEventListeners,
|
|
167
|
-
resetToStart
|
|
168
|
-
};
|
|
169
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export declare function usePosition(): {
|
|
2
|
-
position: import("../../hooks/useState").State<"end" | "start">;
|
|
3
|
-
charLength: import("../../hooks/useState").State<number>;
|
|
4
|
-
startTextLength: import("../../hooks/useState").State<number>;
|
|
5
|
-
handleInputClick: (e: MouseEvent) => void;
|
|
6
|
-
resetPosition: (pos?: 'start' | 'end') => void;
|
|
7
|
-
togglePosition: () => void;
|
|
8
|
-
setupEventListeners: () => void;
|
|
9
|
-
resetToStart: () => void;
|
|
10
|
-
};
|