@douyinfe/semi-foundation 2.71.0-beta.0 → 2.71.1-alpha

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.
@@ -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,16 @@
1
+ export default function getYearAndMonth(year: {
2
+ left: number;
3
+ right: number;
4
+ }, month: {
5
+ left: number;
6
+ right: number;
7
+ }): {
8
+ year: {
9
+ left: number;
10
+ right: number;
11
+ };
12
+ month: {
13
+ left: number;
14
+ right: number;
15
+ };
16
+ };
@@ -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
- export { isAfter, isBefore, isBetween, isWithinInterval, isSameDay, isTimestamp, isUnixTimestamp, isValidDate, getDefaultFormatToken, getYears, getMonthsInYear, getFullDateOffset };
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 }; }
@@ -2,7 +2,7 @@ declare const cssClasses: {
2
2
  PREFIX: string;
3
3
  };
4
4
  declare const strings: {
5
- BOUNDARY_SET: ("end" | "start")[];
5
+ BOUNDARY_SET: ("start" | "end")[];
6
6
  POSITION_SET: string[];
7
7
  MODE_SET: string[];
8
8
  MODE_MAP: {
@@ -45,6 +45,10 @@ 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
+ }
48
52
  this.calcPosition();
49
53
  };
50
54
  this.delayShow = () => {
@@ -83,6 +83,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
83
83
  export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
84
84
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
85
85
  export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
86
- export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
86
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
87
87
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
88
88
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
@@ -0,0 +1,16 @@
1
+ export default function getYearAndMonth(year: {
2
+ left: number;
3
+ right: number;
4
+ }, month: {
5
+ left: number;
6
+ right: number;
7
+ }): {
8
+ year: {
9
+ left: number;
10
+ right: number;
11
+ };
12
+ month: {
13
+ left: number;
14
+ right: number;
15
+ };
16
+ };
@@ -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
- export { isAfter, isBefore, isBetween, isWithinInterval, isSameDay, isTimestamp, isUnixTimestamp, isValidDate, getDefaultFormatToken, getYears, getMonthsInYear, getFullDateOffset };
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
- export { isAfter, isBefore, isBetween, isWithinInterval, isSameDay, isTimestamp, isUnixTimestamp, isValidDate, getDefaultFormatToken, getYears, getMonthsInYear, getFullDateOffset };
13
+ import getYearAndMonth from './getYearAndMonth';
14
+ export { isAfter, isBefore, isBetween, isWithinInterval, isSameDay, isTimestamp, isUnixTimestamp, isValidDate, getDefaultFormatToken, getYears, getMonthsInYear, getFullDateOffset, getYearAndMonth };
@@ -2,7 +2,7 @@ declare const cssClasses: {
2
2
  PREFIX: string;
3
3
  };
4
4
  declare const strings: {
5
- BOUNDARY_SET: ("end" | "start")[];
5
+ BOUNDARY_SET: ("start" | "end")[];
6
6
  POSITION_SET: string[];
7
7
  MODE_SET: string[];
8
8
  MODE_MAP: {
@@ -38,6 +38,10 @@ 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
+ }
41
45
  this.calcPosition();
42
46
  };
43
47
  this.delayShow = () => {
@@ -83,6 +83,6 @@ export declare function getValueOrKey(data: any, keyMaps?: KeyMapProps): any;
83
83
  export declare function normalizeValue(value: any, withObject: boolean, keyMaps?: KeyMapProps): any;
84
84
  export declare function updateKeys(keySet: Set<string> | string[], keyEntities: KeyEntities): string[];
85
85
  export declare function calcDisabledKeys(keyEntities: KeyEntities, keyMaps?: KeyMapProps): Set<string>;
86
- export declare function calcDropRelativePosition(event: any, treeNode: any): 1 | -1 | 0;
86
+ export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
87
87
  export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
88
88
  export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.71.0-beta.0",
3
+ "version": "2.71.1-alpha",
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.71.0-beta.0",
11
- "@douyinfe/semi-json-viewer-core": "2.71.0-beta.0",
10
+ "@douyinfe/semi-animation": "2.71.0",
11
+ "@douyinfe/semi-json-viewer-core": "2.71.1-alpha",
12
12
  "@mdx-js/mdx": "^3.0.1",
13
13
  "async-validator": "^3.5.0",
14
14
  "classnames": "^2.2.6",
@@ -29,7 +29,7 @@
29
29
  "*.scss",
30
30
  "*.css"
31
31
  ],
32
- "gitHead": "3c0018d8659afcae9b39e764859725768363772d",
32
+ "gitHead": "245b2462e1d2824d9254d0a79b318d4c5eb55d37",
33
33
  "devDependencies": {
34
34
  "@babel/plugin-transform-runtime": "^7.15.8",
35
35
  "@babel/preset-env": "^7.15.8",
@@ -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,6 +284,10 @@ 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
+ }
287
291
  this.calcPosition();
288
292
  };
289
293