@douyinfe/semi-foundation 2.70.0-beta.0 → 2.70.1-alpha.1-patch-tooltip

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.
@@ -53,7 +53,9 @@ export interface ChatAdapter<P = Record<string, any>, S = Record<string, any>> e
53
53
  notifyHintClick: (hint: string) => void;
54
54
  setUploadAreaVisible: (visible: boolean) => void;
55
55
  manualUpload: (e: any) => void;
56
- getDropAreaElement: () => HTMLDivElement
56
+ getDropAreaElement: () => HTMLDivElement;
57
+ getDragStatus: () => boolean;
58
+ setDragStatus: (status: boolean) => void
57
59
  }
58
60
 
59
61
 
@@ -265,7 +267,19 @@ export default class ChatFoundation <P = Record<string, any>, S = Record<string,
265
267
  }
266
268
 
267
269
  handleDragOver = (e: any) => {
270
+ const dragStatus = this._adapter.getDragStatus();
271
+ if (dragStatus) {
272
+ return;
273
+ }
268
274
  this._adapter.setUploadAreaVisible(true);
275
+ };
276
+
277
+ handleDragStart = (e: any) => {
278
+ this._adapter.setDragStatus(true);
279
+ }
280
+
281
+ handleDragEnd = (e: any) => {
282
+ this._adapter.setDragStatus(false);
269
283
  }
270
284
 
271
285
  handleContainerDragOver = (e: any) => {
@@ -285,7 +299,8 @@ export default class ChatFoundation <P = Record<string, any>, S = Record<string,
285
299
  // 鼠标移动至 container 的子元素,则不做任何操作
286
300
  // If the mouse moves to the child element of container, no operation will be performed.
287
301
  const dropAreaElement = this._adapter.getDropAreaElement();
288
- if (dropAreaElement !== e.target && dropAreaElement.contains(e.target)) {
302
+ const enterTarget = e.relatedTarget;
303
+ if (dropAreaElement.contains(enterTarget)) {
289
304
  return;
290
305
  }
291
306
  /**
@@ -46,6 +46,8 @@ export interface ChatAdapter<P = Record<string, any>, S = Record<string, any>> e
46
46
  setUploadAreaVisible: (visible: boolean) => void;
47
47
  manualUpload: (e: any) => void;
48
48
  getDropAreaElement: () => HTMLDivElement;
49
+ getDragStatus: () => boolean;
50
+ setDragStatus: (status: boolean) => void;
49
51
  }
50
52
  export default class ChatFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ChatAdapter<P, S>, P, S> {
51
53
  animation: any;
@@ -69,6 +71,8 @@ export default class ChatFoundation<P = Record<string, any>, S = Record<string,
69
71
  dislikeMessage: (message: Message) => void;
70
72
  resetMessage: (message: Message) => void;
71
73
  handleDragOver: (e: any) => void;
74
+ handleDragStart: (e: any) => void;
75
+ handleDragEnd: (e: any) => void;
72
76
  handleContainerDragOver: (e: any) => void;
73
77
  handleContainerDrop: (e: any) => void;
74
78
  handleContainerDragLeave: (e: any) => void;
@@ -235,8 +235,18 @@ class ChatFoundation extends _foundation.default {
235
235
  onMessageReset === null || onMessageReset === void 0 ? void 0 : onMessageReset(message);
236
236
  };
237
237
  this.handleDragOver = e => {
238
+ const dragStatus = this._adapter.getDragStatus();
239
+ if (dragStatus) {
240
+ return;
241
+ }
238
242
  this._adapter.setUploadAreaVisible(true);
239
243
  };
244
+ this.handleDragStart = e => {
245
+ this._adapter.setDragStatus(true);
246
+ };
247
+ this.handleDragEnd = e => {
248
+ this._adapter.setDragStatus(false);
249
+ };
240
250
  this.handleContainerDragOver = e => {
241
251
  (0, _a11y.handlePrevent)(e);
242
252
  };
@@ -253,7 +263,8 @@ class ChatFoundation extends _foundation.default {
253
263
  // 鼠标移动至 container 的子元素,则不做任何操作
254
264
  // If the mouse moves to the child element of container, no operation will be performed.
255
265
  const dropAreaElement = this._adapter.getDropAreaElement();
256
- if (dropAreaElement !== e.target && dropAreaElement.contains(e.target)) {
266
+ const enterTarget = e.relatedTarget;
267
+ if (dropAreaElement.contains(enterTarget)) {
257
268
  return;
258
269
  }
259
270
  /**
@@ -8,7 +8,7 @@ export interface LottieAdapter<P = Record<string, any>, S = Record<string, any>>
8
8
  export interface LottieBaseProps {
9
9
  width?: string;
10
10
  height?: string;
11
- params: ArgsType<typeof lottie.loadAnimation>[0];
11
+ params: Partial<ArgsType<typeof lottie.loadAnimation>[0]>;
12
12
  getAnimationInstance?: (instance: AnimationItem | null) => void;
13
13
  getLottie?: (lottiePKG: typeof lottie) => void;
14
14
  }
@@ -140,7 +140,8 @@
140
140
  cursor: pointer;
141
141
  }
142
142
  .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort:hover {
143
- background: var(--semi-color-fill-0);
143
+ background-image: linear-gradient(0deg, var(--semi-color-fill-0), var(--semi-color-fill-0));
144
+ background-color: var(--semi-color-bg-0);
144
145
  }
145
146
  .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort:hover.semi-table-cell-fixed-left::before, .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort:hover.semi-table-cell-fixed-right::before {
146
147
  background-color: transparent;
@@ -145,7 +145,8 @@ $module: #{$prefix}-table;
145
145
  &.#{$module}-row-head-clickSort {
146
146
  cursor: pointer;
147
147
  &:hover {
148
- background: $color-table_th-clickSort-bg-hover;
148
+ background-image: linear-gradient(0deg, $color-table_th-clickSort-bg-hover, $color-table_th-clickSort-bg-hover);
149
+ background-color: $color-table_cell-bg-hover;
149
150
 
150
151
  &.#{$module}-cell-fixed {
151
152
  &-left,
@@ -412,7 +412,8 @@ class Tooltip extends _foundation.default {
412
412
  }
413
413
  _togglePortalVisible(isVisible) {
414
414
  const nowVisible = this.getState('visible');
415
- if (nowVisible !== isVisible) {
415
+ const isInsert = this.getState("isInsert");
416
+ if (nowVisible !== isVisible || isInsert !== isVisible) {
416
417
  this._adapter.togglePortalVisible(isVisible, () => {
417
418
  if (isVisible) {
418
419
  this._adapter.setInitialFocus();
@@ -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;
@@ -18,7 +18,7 @@ declare const strings: {
18
18
  DRAG_AREA_ILLEGAL: string;
19
19
  TRIGGER_AUTO: "auto";
20
20
  TRIGGER_CUSTOM: "custom";
21
- UPLOAD_TRIGGER: ("auto" | "custom")[];
21
+ UPLOAD_TRIGGER: ("custom" | "auto")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
@@ -46,6 +46,8 @@ export interface ChatAdapter<P = Record<string, any>, S = Record<string, any>> e
46
46
  setUploadAreaVisible: (visible: boolean) => void;
47
47
  manualUpload: (e: any) => void;
48
48
  getDropAreaElement: () => HTMLDivElement;
49
+ getDragStatus: () => boolean;
50
+ setDragStatus: (status: boolean) => void;
49
51
  }
50
52
  export default class ChatFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<ChatAdapter<P, S>, P, S> {
51
53
  animation: any;
@@ -69,6 +71,8 @@ export default class ChatFoundation<P = Record<string, any>, S = Record<string,
69
71
  dislikeMessage: (message: Message) => void;
70
72
  resetMessage: (message: Message) => void;
71
73
  handleDragOver: (e: any) => void;
74
+ handleDragStart: (e: any) => void;
75
+ handleDragEnd: (e: any) => void;
72
76
  handleContainerDragOver: (e: any) => void;
73
77
  handleContainerDrop: (e: any) => void;
74
78
  handleContainerDragLeave: (e: any) => void;
@@ -228,8 +228,18 @@ export default class ChatFoundation extends BaseFoundation {
228
228
  onMessageReset === null || onMessageReset === void 0 ? void 0 : onMessageReset(message);
229
229
  };
230
230
  this.handleDragOver = e => {
231
+ const dragStatus = this._adapter.getDragStatus();
232
+ if (dragStatus) {
233
+ return;
234
+ }
231
235
  this._adapter.setUploadAreaVisible(true);
232
236
  };
237
+ this.handleDragStart = e => {
238
+ this._adapter.setDragStatus(true);
239
+ };
240
+ this.handleDragEnd = e => {
241
+ this._adapter.setDragStatus(false);
242
+ };
233
243
  this.handleContainerDragOver = e => {
234
244
  handlePrevent(e);
235
245
  };
@@ -246,7 +256,8 @@ export default class ChatFoundation extends BaseFoundation {
246
256
  // 鼠标移动至 container 的子元素,则不做任何操作
247
257
  // If the mouse moves to the child element of container, no operation will be performed.
248
258
  const dropAreaElement = this._adapter.getDropAreaElement();
249
- if (dropAreaElement !== e.target && dropAreaElement.contains(e.target)) {
259
+ const enterTarget = e.relatedTarget;
260
+ if (dropAreaElement.contains(enterTarget)) {
250
261
  return;
251
262
  }
252
263
  /**
@@ -8,7 +8,7 @@ export interface LottieAdapter<P = Record<string, any>, S = Record<string, any>>
8
8
  export interface LottieBaseProps {
9
9
  width?: string;
10
10
  height?: string;
11
- params: ArgsType<typeof lottie.loadAnimation>[0];
11
+ params: Partial<ArgsType<typeof lottie.loadAnimation>[0]>;
12
12
  getAnimationInstance?: (instance: AnimationItem | null) => void;
13
13
  getLottie?: (lottiePKG: typeof lottie) => void;
14
14
  }
@@ -140,7 +140,8 @@
140
140
  cursor: pointer;
141
141
  }
142
142
  .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort:hover {
143
- background: var(--semi-color-fill-0);
143
+ background-image: linear-gradient(0deg, var(--semi-color-fill-0), var(--semi-color-fill-0));
144
+ background-color: var(--semi-color-bg-0);
144
145
  }
145
146
  .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort:hover.semi-table-cell-fixed-left::before, .semi-table-thead > .semi-table-row > .semi-table-row-head.semi-table-row-head-clickSort:hover.semi-table-cell-fixed-right::before {
146
147
  background-color: transparent;
@@ -145,7 +145,8 @@ $module: #{$prefix}-table;
145
145
  &.#{$module}-row-head-clickSort {
146
146
  cursor: pointer;
147
147
  &:hover {
148
- background: $color-table_th-clickSort-bg-hover;
148
+ background-image: linear-gradient(0deg, $color-table_th-clickSort-bg-hover, $color-table_th-clickSort-bg-hover);
149
+ background-color: $color-table_cell-bg-hover;
149
150
 
150
151
  &.#{$module}-cell-fixed {
151
152
  &-left,
@@ -405,7 +405,8 @@ export default class Tooltip extends BaseFoundation {
405
405
  }
406
406
  _togglePortalVisible(isVisible) {
407
407
  const nowVisible = this.getState('visible');
408
- if (nowVisible !== isVisible) {
408
+ const isInsert = this.getState("isInsert");
409
+ if (nowVisible !== isVisible || isInsert !== isVisible) {
409
410
  this._adapter.togglePortalVisible(isVisible, () => {
410
411
  if (isVisible) {
411
412
  this._adapter.setInitialFocus();
@@ -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;
@@ -18,7 +18,7 @@ declare const strings: {
18
18
  DRAG_AREA_ILLEGAL: string;
19
19
  TRIGGER_AUTO: "auto";
20
20
  TRIGGER_CUSTOM: "custom";
21
- UPLOAD_TRIGGER: ("auto" | "custom")[];
21
+ UPLOAD_TRIGGER: ("custom" | "auto")[];
22
22
  VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
23
23
  PROMPT_POSITION: readonly ["left", "right", "bottom"];
24
24
  };
@@ -10,7 +10,7 @@ export interface LottieAdapter<P = Record<string, any>, S = Record<string, any>>
10
10
  export interface LottieBaseProps {
11
11
  width?: string;
12
12
  height?: string;
13
- params: ArgsType<typeof lottie.loadAnimation>[0];
13
+ params: Partial<ArgsType<typeof lottie.loadAnimation>[0]>;
14
14
  getAnimationInstance?: (instance: AnimationItem|null) => void;
15
15
  getLottie?: (lottiePKG: typeof lottie) => void
16
16
 
@@ -57,4 +57,4 @@ class LottieFoundation <P = Record<string, any>, S = Record<string, any>> extend
57
57
 
58
58
  }
59
59
 
60
- export default LottieFoundation;
60
+ export default LottieFoundation;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.70.0-beta.0",
3
+ "version": "2.70.1-alpha.1-patch-tooltip",
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.0-beta.0",
10
+ "@douyinfe/semi-animation": "2.70.1-alpha.1-patch-tooltip",
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": "459b464c2f66555d851260512742de538ec0c0c1",
31
+ "gitHead": "94dff673c90c4fd4a2e4568ed25f197feaebe735",
32
32
  "devDependencies": {
33
33
  "@babel/plugin-transform-runtime": "^7.15.8",
34
34
  "@babel/preset-env": "^7.15.8",
package/table/table.scss CHANGED
@@ -145,7 +145,8 @@ $module: #{$prefix}-table;
145
145
  &.#{$module}-row-head-clickSort {
146
146
  cursor: pointer;
147
147
  &:hover {
148
- background: $color-table_th-clickSort-bg-hover;
148
+ background-image: linear-gradient(0deg, $color-table_th-clickSort-bg-hover, $color-table_th-clickSort-bg-hover);
149
+ background-color: $color-table_cell-bg-hover;
149
150
 
150
151
  &.#{$module}-cell-fixed {
151
152
  &-left,
@@ -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");
@@ -379,7 +379,8 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
379
379
 
380
380
  _togglePortalVisible(isVisible: boolean) {
381
381
  const nowVisible = this.getState('visible');
382
- if (nowVisible !== isVisible) {
382
+ const isInsert = this.getState("isInsert");
383
+ if (nowVisible !== isVisible || isInsert !== isVisible) {
383
384
  this._adapter.togglePortalVisible(isVisible, () => {
384
385
  if (isVisible) {
385
386
  this._adapter.setInitialFocus();