@douyinfe/semi-foundation 2.70.2-alpha.1 → 2.70.2
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/datePicker/_utils/getYearAndMonth.ts +12 -0
- package/datePicker/_utils/index.ts +3 -1
- package/lib/cjs/datePicker/_utils/getYearAndMonth.d.ts +16 -0
- package/lib/cjs/datePicker/_utils/getYearAndMonth.js +22 -0
- package/lib/cjs/datePicker/_utils/index.d.ts +2 -1
- package/lib/cjs/datePicker/_utils/index.js +7 -0
- package/lib/cjs/tooltip/foundation.js +0 -4
- package/lib/es/datePicker/_utils/getYearAndMonth.d.ts +16 -0
- package/lib/es/datePicker/_utils/getYearAndMonth.js +16 -0
- package/lib/es/datePicker/_utils/index.d.ts +2 -1
- package/lib/es/datePicker/_utils/index.js +2 -1
- package/lib/es/tooltip/foundation.js +0 -4
- package/package.json +3 -3
- package/tooltip/foundation.ts +1 -5
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default function getYearAndMonth(year: { left: number; right: number }, month: { left: number; right: number }) {
|
|
2
|
+
const nowYear = new Date().getFullYear();
|
|
3
|
+
const nowMonth = new Date().getMonth();
|
|
4
|
+
|
|
5
|
+
const rightMonth = month.right || (nowMonth + 2);
|
|
6
|
+
const rightYear = year.right || (rightMonth <= 12 ? nowYear : nowYear + 1);
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
year: { left: year.left || nowYear, right: rightYear },
|
|
10
|
+
month: { left: month.left || nowMonth + 1, right: rightMonth <= 12 ? rightMonth : 1 },
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -11,6 +11,7 @@ import getDefaultFormatToken from './getDefaultFormatToken';
|
|
|
11
11
|
import getYears from './getYears';
|
|
12
12
|
import getMonthsInYear from './getMonthsInYear';
|
|
13
13
|
import getFullDateOffset from './getFullDateOffset';
|
|
14
|
+
import getYearAndMonth from './getYearAndMonth';
|
|
14
15
|
|
|
15
16
|
export {
|
|
16
17
|
isAfter,
|
|
@@ -24,5 +25,6 @@ export {
|
|
|
24
25
|
getDefaultFormatToken,
|
|
25
26
|
getYears,
|
|
26
27
|
getMonthsInYear,
|
|
27
|
-
getFullDateOffset
|
|
28
|
+
getFullDateOffset,
|
|
29
|
+
getYearAndMonth
|
|
28
30
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = getYearAndMonth;
|
|
7
|
+
function getYearAndMonth(year, month) {
|
|
8
|
+
const nowYear = new Date().getFullYear();
|
|
9
|
+
const nowMonth = new Date().getMonth();
|
|
10
|
+
const rightMonth = month.right || nowMonth + 2;
|
|
11
|
+
const rightYear = year.right || (rightMonth <= 12 ? nowYear : nowYear + 1);
|
|
12
|
+
return {
|
|
13
|
+
year: {
|
|
14
|
+
left: year.left || nowYear,
|
|
15
|
+
right: rightYear
|
|
16
|
+
},
|
|
17
|
+
month: {
|
|
18
|
+
left: month.left || nowMonth + 1,
|
|
19
|
+
right: rightMonth <= 12 ? rightMonth : 1
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -10,4 +10,5 @@ import getDefaultFormatToken from './getDefaultFormatToken';
|
|
|
10
10
|
import getYears from './getYears';
|
|
11
11
|
import getMonthsInYear from './getMonthsInYear';
|
|
12
12
|
import getFullDateOffset from './getFullDateOffset';
|
|
13
|
-
|
|
13
|
+
import getYearAndMonth from './getYearAndMonth';
|
|
14
|
+
export { isAfter, isBefore, isBetween, isWithinInterval, isSameDay, isTimestamp, isUnixTimestamp, isValidDate, getDefaultFormatToken, getYears, getMonthsInYear, getFullDateOffset, getYearAndMonth };
|
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "getMonthsInYear", {
|
|
|
21
21
|
return _getMonthsInYear.default;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "getYearAndMonth", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _getYearAndMonth.default;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "getYears", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -87,4 +93,5 @@ var _getDefaultFormatToken = _interopRequireDefault(require("./getDefaultFormatT
|
|
|
87
93
|
var _getYears = _interopRequireDefault(require("./getYears"));
|
|
88
94
|
var _getMonthsInYear = _interopRequireDefault(require("./getMonthsInYear"));
|
|
89
95
|
var _getFullDateOffset = _interopRequireDefault(require("./getFullDateOffset"));
|
|
96
|
+
var _getYearAndMonth = _interopRequireDefault(require("./getYearAndMonth"));
|
|
90
97
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -45,10 +45,6 @@ class Tooltip extends _foundation.default {
|
|
|
45
45
|
this.onResize = () => {
|
|
46
46
|
// this.log('resize');
|
|
47
47
|
// rePosition when window resize
|
|
48
|
-
const visible = this.getState('visible');
|
|
49
|
-
if (!visible) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
48
|
this.calcPosition();
|
|
53
49
|
};
|
|
54
50
|
this.delayShow = () => {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function getYearAndMonth(year, month) {
|
|
2
|
+
const nowYear = new Date().getFullYear();
|
|
3
|
+
const nowMonth = new Date().getMonth();
|
|
4
|
+
const rightMonth = month.right || nowMonth + 2;
|
|
5
|
+
const rightYear = year.right || (rightMonth <= 12 ? nowYear : nowYear + 1);
|
|
6
|
+
return {
|
|
7
|
+
year: {
|
|
8
|
+
left: year.left || nowYear,
|
|
9
|
+
right: rightYear
|
|
10
|
+
},
|
|
11
|
+
month: {
|
|
12
|
+
left: month.left || nowMonth + 1,
|
|
13
|
+
right: rightMonth <= 12 ? rightMonth : 1
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -10,4 +10,5 @@ import getDefaultFormatToken from './getDefaultFormatToken';
|
|
|
10
10
|
import getYears from './getYears';
|
|
11
11
|
import getMonthsInYear from './getMonthsInYear';
|
|
12
12
|
import getFullDateOffset from './getFullDateOffset';
|
|
13
|
-
|
|
13
|
+
import getYearAndMonth from './getYearAndMonth';
|
|
14
|
+
export { isAfter, isBefore, isBetween, isWithinInterval, isSameDay, isTimestamp, isUnixTimestamp, isValidDate, getDefaultFormatToken, getYears, getMonthsInYear, getFullDateOffset, getYearAndMonth };
|
|
@@ -10,4 +10,5 @@ import getDefaultFormatToken from './getDefaultFormatToken';
|
|
|
10
10
|
import getYears from './getYears';
|
|
11
11
|
import getMonthsInYear from './getMonthsInYear';
|
|
12
12
|
import getFullDateOffset from './getFullDateOffset';
|
|
13
|
-
|
|
13
|
+
import getYearAndMonth from './getYearAndMonth';
|
|
14
|
+
export { isAfter, isBefore, isBetween, isWithinInterval, isSameDay, isTimestamp, isUnixTimestamp, isValidDate, getDefaultFormatToken, getYears, getMonthsInYear, getFullDateOffset, getYearAndMonth };
|
|
@@ -38,10 +38,6 @@ export default class Tooltip extends BaseFoundation {
|
|
|
38
38
|
this.onResize = () => {
|
|
39
39
|
// this.log('resize');
|
|
40
40
|
// rePosition when window resize
|
|
41
|
-
const visible = this.getState('visible');
|
|
42
|
-
if (!visible) {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
41
|
this.calcPosition();
|
|
46
42
|
};
|
|
47
43
|
this.delayShow = () => {
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.70.2
|
|
3
|
+
"version": "2.70.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
7
7
|
"prepublishOnly": "npm run build:lib"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@douyinfe/semi-animation": "2.70.2
|
|
10
|
+
"@douyinfe/semi-animation": "2.70.2",
|
|
11
11
|
"@mdx-js/mdx": "^3.0.1",
|
|
12
12
|
"async-validator": "^3.5.0",
|
|
13
13
|
"classnames": "^2.2.6",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"*.scss",
|
|
29
29
|
"*.css"
|
|
30
30
|
],
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "a8e64240b3a6ae65066e911580b3410725b033e1",
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
34
34
|
"@babel/preset-env": "^7.15.8",
|
package/tooltip/foundation.ts
CHANGED
|
@@ -191,7 +191,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
updateStateIfCursorOnTrigger = (trigger: HTMLElement)
|
|
194
|
+
updateStateIfCursorOnTrigger = (trigger: HTMLElement)=>{
|
|
195
195
|
if (trigger?.matches?.(":hover")) {
|
|
196
196
|
const eventNames = this._adapter.getEventName();
|
|
197
197
|
const triggerEventSet = this.getState("triggerEventSet");
|
|
@@ -284,10 +284,6 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
284
284
|
onResize = () => {
|
|
285
285
|
// this.log('resize');
|
|
286
286
|
// rePosition when window resize
|
|
287
|
-
const visible = this.getState('visible');
|
|
288
|
-
if (!visible) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
287
|
this.calcPosition();
|
|
292
288
|
};
|
|
293
289
|
|