@douyinfe/semi-foundation 2.64.0-beta.0 → 2.64.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/image/previewImageFoundation.ts +22 -17
- package/lib/cjs/base/foundation.js +1 -1
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +1 -1
- package/lib/cjs/image/previewImageFoundation.js +22 -18
- package/lib/cjs/navigation/foundation.d.ts +8 -8
- package/lib/cjs/navigation/itemFoundation.d.ts +5 -4
- package/lib/cjs/radio/radioInnerFoundation.js +1 -1
- package/lib/cjs/slider/foundation.d.ts +1 -0
- package/lib/cjs/slider/foundation.js +15 -0
- package/lib/cjs/table/utils.d.ts +1 -1
- package/lib/cjs/tooltip/foundation.js +2 -1
- package/lib/es/base/foundation.js +1 -1
- package/lib/es/checkbox/checkboxGroupFoundation.js +1 -1
- package/lib/es/image/previewImageFoundation.js +22 -18
- package/lib/es/navigation/foundation.d.ts +8 -8
- package/lib/es/navigation/itemFoundation.d.ts +5 -4
- package/lib/es/radio/radioInnerFoundation.js +1 -1
- package/lib/es/slider/foundation.d.ts +1 -0
- package/lib/es/slider/foundation.js +15 -0
- package/lib/es/table/utils.d.ts +1 -1
- package/lib/es/tooltip/foundation.js +2 -1
- package/navigation/foundation.ts +8 -8
- package/navigation/itemFoundation.ts +6 -4
- package/package.json +3 -3
- package/slider/foundation.ts +13 -0
- package/tooltip/foundation.ts +1 -1
|
@@ -209,23 +209,28 @@ export default class PreviewImageFoundation<P = Record<string, any>, S = Record<
|
|
|
209
209
|
};
|
|
210
210
|
|
|
211
211
|
if (e && imageDOM && e.target === imageDOM) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
212
|
+
let angle = rotation % 360;
|
|
213
|
+
angle < 0 && (angle = 360 + angle);
|
|
214
|
+
switch (angle) {
|
|
215
|
+
case 0:
|
|
216
|
+
newTranslateX = (e.offsetX - 0.5 * width) * (1 - newZoom / currZoom) + translate.x;
|
|
217
|
+
newTranslateY = (e.offsetY - 0.5 * height) * (1 - newZoom / currZoom) + translate.y;
|
|
218
|
+
break;
|
|
219
|
+
case 90:
|
|
220
|
+
newTranslateX = (0.5 * height - e.offsetY) * (1 - newZoom / currZoom) + translate.x;
|
|
221
|
+
newTranslateY = (e.offsetX - 0.5 * width) * (1 - newZoom / currZoom) + translate.y;
|
|
222
|
+
break;
|
|
223
|
+
case 180:
|
|
224
|
+
newTranslateX = (0.5 * width - e.offsetX) * (1 - newZoom / currZoom) + translate.x;
|
|
225
|
+
newTranslateY = (0.5 * height - e.offsetY) * (1 - newZoom / currZoom) + translate.y;
|
|
226
|
+
break;
|
|
227
|
+
case 270:
|
|
228
|
+
newTranslateX = (e.offsetY - 0.5 * height) * (1 - newZoom / currZoom) + translate.x;
|
|
229
|
+
newTranslateY = (0.5 * width - e.offsetX ) * (1 - newZoom / currZoom) + translate.y;
|
|
230
|
+
break;
|
|
231
|
+
default:
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
229
234
|
}
|
|
230
235
|
|
|
231
236
|
const newTranslate = this.getSafeTranslate(newImageBound.width, newImageBound.height, newTranslateX, newTranslateY);
|
|
@@ -93,7 +93,7 @@ class BaseFoundation {
|
|
|
93
93
|
_isControlledComponent() {
|
|
94
94
|
let key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'value';
|
|
95
95
|
const props = this.getProps();
|
|
96
|
-
const isControlComponent =
|
|
96
|
+
const isControlComponent = key in props;
|
|
97
97
|
return isControlComponent;
|
|
98
98
|
}
|
|
99
99
|
// Does the user have incoming props, eg: _isInProps (value)
|
|
@@ -40,7 +40,7 @@ class CheckboxGroupFoundation extends _foundation.default {
|
|
|
40
40
|
} else {
|
|
41
41
|
newValue = prevValue.filter((itm, idx) => itm !== evt.target.value);
|
|
42
42
|
}
|
|
43
|
-
const isControlledMode =
|
|
43
|
+
const isControlledMode = 'value' in this.getProps();
|
|
44
44
|
if (isControlledMode) {
|
|
45
45
|
// Controlled mode only needs to notify
|
|
46
46
|
this.notifyChange(newValue);
|
|
@@ -165,24 +165,28 @@ class PreviewImageFoundation extends _foundation.default {
|
|
|
165
165
|
height: imageBound.height * changeScale
|
|
166
166
|
};
|
|
167
167
|
if (e && imageDOM && e.target === imageDOM) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
168
|
+
let angle = rotation % 360;
|
|
169
|
+
angle < 0 && (angle = 360 + angle);
|
|
170
|
+
switch (angle) {
|
|
171
|
+
case 0:
|
|
172
|
+
newTranslateX = (e.offsetX - 0.5 * width) * (1 - newZoom / currZoom) + translate.x;
|
|
173
|
+
newTranslateY = (e.offsetY - 0.5 * height) * (1 - newZoom / currZoom) + translate.y;
|
|
174
|
+
break;
|
|
175
|
+
case 90:
|
|
176
|
+
newTranslateX = (0.5 * height - e.offsetY) * (1 - newZoom / currZoom) + translate.x;
|
|
177
|
+
newTranslateY = (e.offsetX - 0.5 * width) * (1 - newZoom / currZoom) + translate.y;
|
|
178
|
+
break;
|
|
179
|
+
case 180:
|
|
180
|
+
newTranslateX = (0.5 * width - e.offsetX) * (1 - newZoom / currZoom) + translate.x;
|
|
181
|
+
newTranslateY = (0.5 * height - e.offsetY) * (1 - newZoom / currZoom) + translate.y;
|
|
182
|
+
break;
|
|
183
|
+
case 270:
|
|
184
|
+
newTranslateX = (e.offsetY - 0.5 * height) * (1 - newZoom / currZoom) + translate.x;
|
|
185
|
+
newTranslateY = (0.5 * width - e.offsetX) * (1 - newZoom / currZoom) + translate.y;
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
186
190
|
}
|
|
187
191
|
const newTranslate = this.getSafeTranslate(newImageBound.width, newImageBound.height, newTranslateX, newTranslateY);
|
|
188
192
|
this.setState({
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
-
import { ItemProps } from './itemFoundation';
|
|
2
|
+
import { ItemProps, ItemKey } from './itemFoundation';
|
|
3
3
|
export interface ItemKey2ParentKeysMap {
|
|
4
4
|
[key: string]: (string | number)[];
|
|
5
5
|
}
|
|
6
6
|
export interface OnClickData {
|
|
7
|
-
itemKey:
|
|
7
|
+
itemKey: ItemKey;
|
|
8
8
|
domEvent: any;
|
|
9
9
|
isOpen: boolean;
|
|
10
10
|
}
|
|
11
11
|
export interface OnSelectData extends OnClickData {
|
|
12
|
-
selectedKeys:
|
|
12
|
+
selectedKeys: ItemKey[];
|
|
13
13
|
selectedItems: ItemProps[];
|
|
14
14
|
}
|
|
15
15
|
export interface OnOpenChangeData extends OnClickData {
|
|
16
|
-
openKeys:
|
|
16
|
+
openKeys: ItemKey[];
|
|
17
17
|
}
|
|
18
18
|
export interface NavItemType {
|
|
19
19
|
props?: ItemProps;
|
|
@@ -39,7 +39,7 @@ export interface NavigationAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
39
39
|
}
|
|
40
40
|
export default class NavigationFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<NavigationAdapter<P, S>, P, S> {
|
|
41
41
|
constructor(adapter: NavigationAdapter<P, S>);
|
|
42
|
-
static getZeroParentKeys(itemKeysMap?: {}, ...itemKeys:
|
|
42
|
+
static getZeroParentKeys(itemKeysMap?: {}, ...itemKeys: ItemKey[]): any[];
|
|
43
43
|
static buildItemKeysMap(items?: NavItemType[], keysMap?: {}, parentKeys?: (string | number)[], keyPropName?: string): {};
|
|
44
44
|
/**
|
|
45
45
|
* init is called in constructor and componentDidMount.
|
|
@@ -74,12 +74,12 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
|
|
|
74
74
|
* @param {*} itemKeysMap
|
|
75
75
|
*/
|
|
76
76
|
getWillOpenKeys(itemKeysMap: ItemKey2ParentKeysMap): any[];
|
|
77
|
-
getShouldOpenKeys(itemKeysMap?: ItemKey2ParentKeysMap, selectedKeys?:
|
|
77
|
+
getShouldOpenKeys(itemKeysMap?: ItemKey2ParentKeysMap, selectedKeys?: ItemKey[]): unknown[];
|
|
78
78
|
destroy(): void;
|
|
79
|
-
selectLevelZeroParentKeys(itemKeysMap: ItemKey2ParentKeysMap, itemKeys:
|
|
79
|
+
selectLevelZeroParentKeys(itemKeysMap: ItemKey2ParentKeysMap, itemKeys: ItemKey[]): any[];
|
|
80
80
|
formatItems(items?: ItemProps[]): any[];
|
|
81
81
|
handleSelect(data: OnSelectData): void;
|
|
82
|
-
judgeIfOpen(openKeys:
|
|
82
|
+
judgeIfOpen(openKeys: ItemKey[], items: NavItemType[]): boolean;
|
|
83
83
|
handleCollapseChange(): void;
|
|
84
84
|
handleItemsChange(isChanged: boolean): void;
|
|
85
85
|
}
|
|
@@ -12,10 +12,11 @@ export interface ItemProps {
|
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
children?: any;
|
|
14
14
|
}
|
|
15
|
+
export type ItemKey = string | number;
|
|
15
16
|
export interface SelectedItemProps<Props = ItemProps> {
|
|
16
|
-
itemKey:
|
|
17
|
+
itemKey: ItemKey;
|
|
17
18
|
text?: any;
|
|
18
|
-
selectedKeys?:
|
|
19
|
+
selectedKeys?: ItemKey[];
|
|
19
20
|
selectedItems?: Props[];
|
|
20
21
|
domEvent?: any;
|
|
21
22
|
}
|
|
@@ -23,8 +24,8 @@ export interface ItemAdapter<P = Record<string, any>, S = Record<string, any>> e
|
|
|
23
24
|
cloneDeep(value: any, customizer?: (value: any) => void): any;
|
|
24
25
|
updateTooltipShow(showTooltip: boolean): void;
|
|
25
26
|
updateSelected(selected: boolean): void;
|
|
26
|
-
updateGlobalSelectedKeys(keys:
|
|
27
|
-
getSelectedKeys():
|
|
27
|
+
updateGlobalSelectedKeys(keys: ItemKey[]): void;
|
|
28
|
+
getSelectedKeys(): ItemKey[];
|
|
28
29
|
getSelectedKeysIsControlled(): boolean;
|
|
29
30
|
notifyGlobalOnSelect(item: SelectedItemProps): void;
|
|
30
31
|
notifyGlobalOnClick(item: SelectedItemProps): void;
|
|
@@ -22,7 +22,7 @@ class RadioInnerFoundation extends _foundation.default {
|
|
|
22
22
|
return this._adapter.getProp('checked');
|
|
23
23
|
}
|
|
24
24
|
handleChange(e) {
|
|
25
|
-
const isControlledMode =
|
|
25
|
+
const isControlledMode = 'checked' in this.getProps();
|
|
26
26
|
const {
|
|
27
27
|
checked
|
|
28
28
|
} = e.target;
|
|
@@ -202,6 +202,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
202
202
|
_handleHomeKey: (handler: 'min' | 'max') => any;
|
|
203
203
|
_handleEndKey: (handler: 'min' | 'max') => any;
|
|
204
204
|
handleKeyDown: (event: any, handler: 'min' | 'max') => void;
|
|
205
|
+
_noTooltip: () => boolean;
|
|
205
206
|
onFocus: (e: any, handler: 'min' | 'max') => void;
|
|
206
207
|
onBlur: (e: any, handler: 'min' | 'max') => void;
|
|
207
208
|
handleWrapClick: (e: any) => void;
|
|
@@ -619,7 +619,18 @@ class SliderFoundation extends _foundation.default {
|
|
|
619
619
|
(0, _a11y.handlePrevent)(event);
|
|
620
620
|
}
|
|
621
621
|
};
|
|
622
|
+
this._noTooltip = () => {
|
|
623
|
+
const {
|
|
624
|
+
tipFormatter,
|
|
625
|
+
tooltipVisible
|
|
626
|
+
} = this.getProps();
|
|
627
|
+
return tipFormatter === null || tooltipVisible === false;
|
|
628
|
+
};
|
|
622
629
|
this.onFocus = (e, handler) => {
|
|
630
|
+
const noTooltip = this._noTooltip();
|
|
631
|
+
if (noTooltip) {
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
623
634
|
(0, _a11y.handlePrevent)(e);
|
|
624
635
|
const {
|
|
625
636
|
target
|
|
@@ -637,6 +648,10 @@ class SliderFoundation extends _foundation.default {
|
|
|
637
648
|
}
|
|
638
649
|
};
|
|
639
650
|
this.onBlur = (e, handler) => {
|
|
651
|
+
const noTooltip = this._noTooltip();
|
|
652
|
+
if (noTooltip) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
640
655
|
const {
|
|
641
656
|
firstDotFocusVisible,
|
|
642
657
|
secondDotFocusVisible
|
package/lib/cjs/table/utils.d.ts
CHANGED
|
@@ -102,4 +102,4 @@ export declare function isTreeTable({ dataSource, childrenRecordName }: {
|
|
|
102
102
|
}): boolean;
|
|
103
103
|
export declare function getRTLAlign(align: typeof strings.ALIGNS[number], direction?: 'ltr' | 'rtl'): typeof strings.ALIGNS[number];
|
|
104
104
|
export declare function getRTLFlexAlign(align: typeof strings.ALIGNS[number], direction?: 'ltr' | 'rtl'): typeof strings.JUSTIFY_CONTENT[number];
|
|
105
|
-
export declare function shouldShowEllipsisTitle(ellipsis: BaseEllipsis):
|
|
105
|
+
export declare function shouldShowEllipsisTitle(ellipsis: BaseEllipsis): boolean;
|
|
@@ -84,8 +84,9 @@ class Tooltip extends _foundation.default {
|
|
|
84
84
|
});
|
|
85
85
|
if (trigger === "hover") {
|
|
86
86
|
const checkTriggerIsHover = () => {
|
|
87
|
+
var _a;
|
|
87
88
|
const triggerDOM = this._adapter.getTriggerDOM();
|
|
88
|
-
if (trigger && !triggerDOM.matches(":hover")) {
|
|
89
|
+
if (trigger && !((_a = triggerDOM === null || triggerDOM === void 0 ? void 0 : triggerDOM.matches) === null || _a === void 0 ? void 0 : _a.call(triggerDOM, ":hover"))) {
|
|
89
90
|
this.hide();
|
|
90
91
|
}
|
|
91
92
|
this._adapter.off("portalInserted", checkTriggerIsHover);
|
|
@@ -85,7 +85,7 @@ class BaseFoundation {
|
|
|
85
85
|
_isControlledComponent() {
|
|
86
86
|
let key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'value';
|
|
87
87
|
const props = this.getProps();
|
|
88
|
-
const isControlComponent =
|
|
88
|
+
const isControlComponent = key in props;
|
|
89
89
|
return isControlComponent;
|
|
90
90
|
}
|
|
91
91
|
// Does the user have incoming props, eg: _isInProps (value)
|
|
@@ -33,7 +33,7 @@ class CheckboxGroupFoundation extends BaseFoundation {
|
|
|
33
33
|
} else {
|
|
34
34
|
newValue = prevValue.filter((itm, idx) => itm !== evt.target.value);
|
|
35
35
|
}
|
|
36
|
-
const isControlledMode =
|
|
36
|
+
const isControlledMode = 'value' in this.getProps();
|
|
37
37
|
if (isControlledMode) {
|
|
38
38
|
// Controlled mode only needs to notify
|
|
39
39
|
this.notifyChange(newValue);
|
|
@@ -158,24 +158,28 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
158
158
|
height: imageBound.height * changeScale
|
|
159
159
|
};
|
|
160
160
|
if (e && imageDOM && e.target === imageDOM) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
161
|
+
let angle = rotation % 360;
|
|
162
|
+
angle < 0 && (angle = 360 + angle);
|
|
163
|
+
switch (angle) {
|
|
164
|
+
case 0:
|
|
165
|
+
newTranslateX = (e.offsetX - 0.5 * width) * (1 - newZoom / currZoom) + translate.x;
|
|
166
|
+
newTranslateY = (e.offsetY - 0.5 * height) * (1 - newZoom / currZoom) + translate.y;
|
|
167
|
+
break;
|
|
168
|
+
case 90:
|
|
169
|
+
newTranslateX = (0.5 * height - e.offsetY) * (1 - newZoom / currZoom) + translate.x;
|
|
170
|
+
newTranslateY = (e.offsetX - 0.5 * width) * (1 - newZoom / currZoom) + translate.y;
|
|
171
|
+
break;
|
|
172
|
+
case 180:
|
|
173
|
+
newTranslateX = (0.5 * width - e.offsetX) * (1 - newZoom / currZoom) + translate.x;
|
|
174
|
+
newTranslateY = (0.5 * height - e.offsetY) * (1 - newZoom / currZoom) + translate.y;
|
|
175
|
+
break;
|
|
176
|
+
case 270:
|
|
177
|
+
newTranslateX = (e.offsetY - 0.5 * height) * (1 - newZoom / currZoom) + translate.x;
|
|
178
|
+
newTranslateY = (0.5 * width - e.offsetX) * (1 - newZoom / currZoom) + translate.y;
|
|
179
|
+
break;
|
|
180
|
+
default:
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
179
183
|
}
|
|
180
184
|
const newTranslate = this.getSafeTranslate(newImageBound.width, newImageBound.height, newTranslateX, newTranslateY);
|
|
181
185
|
this.setState({
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
-
import { ItemProps } from './itemFoundation';
|
|
2
|
+
import { ItemProps, ItemKey } from './itemFoundation';
|
|
3
3
|
export interface ItemKey2ParentKeysMap {
|
|
4
4
|
[key: string]: (string | number)[];
|
|
5
5
|
}
|
|
6
6
|
export interface OnClickData {
|
|
7
|
-
itemKey:
|
|
7
|
+
itemKey: ItemKey;
|
|
8
8
|
domEvent: any;
|
|
9
9
|
isOpen: boolean;
|
|
10
10
|
}
|
|
11
11
|
export interface OnSelectData extends OnClickData {
|
|
12
|
-
selectedKeys:
|
|
12
|
+
selectedKeys: ItemKey[];
|
|
13
13
|
selectedItems: ItemProps[];
|
|
14
14
|
}
|
|
15
15
|
export interface OnOpenChangeData extends OnClickData {
|
|
16
|
-
openKeys:
|
|
16
|
+
openKeys: ItemKey[];
|
|
17
17
|
}
|
|
18
18
|
export interface NavItemType {
|
|
19
19
|
props?: ItemProps;
|
|
@@ -39,7 +39,7 @@ export interface NavigationAdapter<P = Record<string, any>, S = Record<string, a
|
|
|
39
39
|
}
|
|
40
40
|
export default class NavigationFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<NavigationAdapter<P, S>, P, S> {
|
|
41
41
|
constructor(adapter: NavigationAdapter<P, S>);
|
|
42
|
-
static getZeroParentKeys(itemKeysMap?: {}, ...itemKeys:
|
|
42
|
+
static getZeroParentKeys(itemKeysMap?: {}, ...itemKeys: ItemKey[]): any[];
|
|
43
43
|
static buildItemKeysMap(items?: NavItemType[], keysMap?: {}, parentKeys?: (string | number)[], keyPropName?: string): {};
|
|
44
44
|
/**
|
|
45
45
|
* init is called in constructor and componentDidMount.
|
|
@@ -74,12 +74,12 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
|
|
|
74
74
|
* @param {*} itemKeysMap
|
|
75
75
|
*/
|
|
76
76
|
getWillOpenKeys(itemKeysMap: ItemKey2ParentKeysMap): any[];
|
|
77
|
-
getShouldOpenKeys(itemKeysMap?: ItemKey2ParentKeysMap, selectedKeys?:
|
|
77
|
+
getShouldOpenKeys(itemKeysMap?: ItemKey2ParentKeysMap, selectedKeys?: ItemKey[]): unknown[];
|
|
78
78
|
destroy(): void;
|
|
79
|
-
selectLevelZeroParentKeys(itemKeysMap: ItemKey2ParentKeysMap, itemKeys:
|
|
79
|
+
selectLevelZeroParentKeys(itemKeysMap: ItemKey2ParentKeysMap, itemKeys: ItemKey[]): any[];
|
|
80
80
|
formatItems(items?: ItemProps[]): any[];
|
|
81
81
|
handleSelect(data: OnSelectData): void;
|
|
82
|
-
judgeIfOpen(openKeys:
|
|
82
|
+
judgeIfOpen(openKeys: ItemKey[], items: NavItemType[]): boolean;
|
|
83
83
|
handleCollapseChange(): void;
|
|
84
84
|
handleItemsChange(isChanged: boolean): void;
|
|
85
85
|
}
|
|
@@ -12,10 +12,11 @@ export interface ItemProps {
|
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
children?: any;
|
|
14
14
|
}
|
|
15
|
+
export type ItemKey = string | number;
|
|
15
16
|
export interface SelectedItemProps<Props = ItemProps> {
|
|
16
|
-
itemKey:
|
|
17
|
+
itemKey: ItemKey;
|
|
17
18
|
text?: any;
|
|
18
|
-
selectedKeys?:
|
|
19
|
+
selectedKeys?: ItemKey[];
|
|
19
20
|
selectedItems?: Props[];
|
|
20
21
|
domEvent?: any;
|
|
21
22
|
}
|
|
@@ -23,8 +24,8 @@ export interface ItemAdapter<P = Record<string, any>, S = Record<string, any>> e
|
|
|
23
24
|
cloneDeep(value: any, customizer?: (value: any) => void): any;
|
|
24
25
|
updateTooltipShow(showTooltip: boolean): void;
|
|
25
26
|
updateSelected(selected: boolean): void;
|
|
26
|
-
updateGlobalSelectedKeys(keys:
|
|
27
|
-
getSelectedKeys():
|
|
27
|
+
updateGlobalSelectedKeys(keys: ItemKey[]): void;
|
|
28
|
+
getSelectedKeys(): ItemKey[];
|
|
28
29
|
getSelectedKeysIsControlled(): boolean;
|
|
29
30
|
notifyGlobalOnSelect(item: SelectedItemProps): void;
|
|
30
31
|
notifyGlobalOnClick(item: SelectedItemProps): void;
|
|
@@ -15,7 +15,7 @@ export default class RadioInnerFoundation extends BaseFoundation {
|
|
|
15
15
|
return this._adapter.getProp('checked');
|
|
16
16
|
}
|
|
17
17
|
handleChange(e) {
|
|
18
|
-
const isControlledMode =
|
|
18
|
+
const isControlledMode = 'checked' in this.getProps();
|
|
19
19
|
const {
|
|
20
20
|
checked
|
|
21
21
|
} = e.target;
|
|
@@ -202,6 +202,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
202
202
|
_handleHomeKey: (handler: 'min' | 'max') => any;
|
|
203
203
|
_handleEndKey: (handler: 'min' | 'max') => any;
|
|
204
204
|
handleKeyDown: (event: any, handler: 'min' | 'max') => void;
|
|
205
|
+
_noTooltip: () => boolean;
|
|
205
206
|
onFocus: (e: any, handler: 'min' | 'max') => void;
|
|
206
207
|
onBlur: (e: any, handler: 'min' | 'max') => void;
|
|
207
208
|
handleWrapClick: (e: any) => void;
|
|
@@ -612,7 +612,18 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
612
612
|
handlePrevent(event);
|
|
613
613
|
}
|
|
614
614
|
};
|
|
615
|
+
this._noTooltip = () => {
|
|
616
|
+
const {
|
|
617
|
+
tipFormatter,
|
|
618
|
+
tooltipVisible
|
|
619
|
+
} = this.getProps();
|
|
620
|
+
return tipFormatter === null || tooltipVisible === false;
|
|
621
|
+
};
|
|
615
622
|
this.onFocus = (e, handler) => {
|
|
623
|
+
const noTooltip = this._noTooltip();
|
|
624
|
+
if (noTooltip) {
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
616
627
|
handlePrevent(e);
|
|
617
628
|
const {
|
|
618
629
|
target
|
|
@@ -630,6 +641,10 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
630
641
|
}
|
|
631
642
|
};
|
|
632
643
|
this.onBlur = (e, handler) => {
|
|
644
|
+
const noTooltip = this._noTooltip();
|
|
645
|
+
if (noTooltip) {
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
633
648
|
const {
|
|
634
649
|
firstDotFocusVisible,
|
|
635
650
|
secondDotFocusVisible
|
package/lib/es/table/utils.d.ts
CHANGED
|
@@ -102,4 +102,4 @@ export declare function isTreeTable({ dataSource, childrenRecordName }: {
|
|
|
102
102
|
}): boolean;
|
|
103
103
|
export declare function getRTLAlign(align: typeof strings.ALIGNS[number], direction?: 'ltr' | 'rtl'): typeof strings.ALIGNS[number];
|
|
104
104
|
export declare function getRTLFlexAlign(align: typeof strings.ALIGNS[number], direction?: 'ltr' | 'rtl'): typeof strings.JUSTIFY_CONTENT[number];
|
|
105
|
-
export declare function shouldShowEllipsisTitle(ellipsis: BaseEllipsis):
|
|
105
|
+
export declare function shouldShowEllipsisTitle(ellipsis: BaseEllipsis): boolean;
|
|
@@ -77,8 +77,9 @@ export default class Tooltip extends BaseFoundation {
|
|
|
77
77
|
});
|
|
78
78
|
if (trigger === "hover") {
|
|
79
79
|
const checkTriggerIsHover = () => {
|
|
80
|
+
var _a;
|
|
80
81
|
const triggerDOM = this._adapter.getTriggerDOM();
|
|
81
|
-
if (trigger && !triggerDOM.matches(":hover")) {
|
|
82
|
+
if (trigger && !((_a = triggerDOM === null || triggerDOM === void 0 ? void 0 : triggerDOM.matches) === null || _a === void 0 ? void 0 : _a.call(triggerDOM, ":hover"))) {
|
|
82
83
|
this.hide();
|
|
83
84
|
}
|
|
84
85
|
this._adapter.off("portalInserted", checkTriggerIsHover);
|
package/navigation/foundation.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
2
|
import NavItem from './NavItem';
|
|
3
|
-
import { ItemProps } from './itemFoundation';
|
|
3
|
+
import { ItemProps, ItemKey } from './itemFoundation';
|
|
4
4
|
import { strings } from './constants';
|
|
5
5
|
import { get } from 'lodash';
|
|
6
6
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
@@ -10,18 +10,18 @@ export interface ItemKey2ParentKeysMap {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface OnClickData {
|
|
13
|
-
itemKey:
|
|
13
|
+
itemKey: ItemKey;
|
|
14
14
|
domEvent: any;
|
|
15
15
|
isOpen: boolean
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export interface OnSelectData extends OnClickData {
|
|
19
|
-
selectedKeys:
|
|
19
|
+
selectedKeys: ItemKey[];
|
|
20
20
|
selectedItems: ItemProps[]
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export interface OnOpenChangeData extends OnClickData {
|
|
24
|
-
openKeys:
|
|
24
|
+
openKeys: ItemKey[]
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export interface NavItemType {
|
|
@@ -52,7 +52,7 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
/* istanbul ignore next */
|
|
55
|
-
static getZeroParentKeys(itemKeysMap = {}, ...itemKeys:
|
|
55
|
+
static getZeroParentKeys(itemKeysMap = {}, ...itemKeys: ItemKey[]) {
|
|
56
56
|
const willAddKeys = [];
|
|
57
57
|
if (itemKeys.length) {
|
|
58
58
|
for (const itemKey of itemKeys) {
|
|
@@ -182,7 +182,7 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
|
|
|
182
182
|
return [...willOpenKeys];
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
getShouldOpenKeys(itemKeysMap: ItemKey2ParentKeysMap = {}, selectedKeys:
|
|
185
|
+
getShouldOpenKeys(itemKeysMap: ItemKey2ParentKeysMap = {}, selectedKeys: ItemKey[] = []) {
|
|
186
186
|
const willOpenKeySet = new Set();
|
|
187
187
|
|
|
188
188
|
if (Array.isArray(selectedKeys) && selectedKeys.length) {
|
|
@@ -202,7 +202,7 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
|
|
|
202
202
|
|
|
203
203
|
destroy() {}
|
|
204
204
|
|
|
205
|
-
selectLevelZeroParentKeys(itemKeysMap: ItemKey2ParentKeysMap, itemKeys:
|
|
205
|
+
selectLevelZeroParentKeys(itemKeysMap: ItemKey2ParentKeysMap, itemKeys: ItemKey[]) {
|
|
206
206
|
const _itemKeysMap = isNullOrUndefined(itemKeysMap) ? this.getState('itemKeysMap') : itemKeysMap;
|
|
207
207
|
// console.log(itemKeysMap);
|
|
208
208
|
|
|
@@ -236,7 +236,7 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
/* istanbul ignore next */
|
|
239
|
-
judgeIfOpen(openKeys:
|
|
239
|
+
judgeIfOpen(openKeys: ItemKey[], items: NavItemType[]): boolean {
|
|
240
240
|
let shouldBeOpen = false;
|
|
241
241
|
|
|
242
242
|
const _openKeys = Array.isArray(openKeys) ? openKeys : openKeys && [openKeys];
|
|
@@ -17,10 +17,12 @@ export interface ItemProps {
|
|
|
17
17
|
children?: any
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
export type ItemKey = string | number;
|
|
21
|
+
|
|
20
22
|
export interface SelectedItemProps<Props = ItemProps> {
|
|
21
|
-
itemKey:
|
|
23
|
+
itemKey: ItemKey;
|
|
22
24
|
text?: any;
|
|
23
|
-
selectedKeys?:
|
|
25
|
+
selectedKeys?: ItemKey[];
|
|
24
26
|
selectedItems?: Props[];
|
|
25
27
|
domEvent?: any
|
|
26
28
|
}
|
|
@@ -29,8 +31,8 @@ export interface ItemAdapter<P = Record<string, any>, S = Record<string, any>> e
|
|
|
29
31
|
cloneDeep(value: any, customizer?: (value: any) => void): any;
|
|
30
32
|
updateTooltipShow(showTooltip: boolean): void;
|
|
31
33
|
updateSelected(selected: boolean): void;
|
|
32
|
-
updateGlobalSelectedKeys(keys:
|
|
33
|
-
getSelectedKeys():
|
|
34
|
+
updateGlobalSelectedKeys(keys: ItemKey[]): void;
|
|
35
|
+
getSelectedKeys(): ItemKey[];
|
|
34
36
|
getSelectedKeysIsControlled(): boolean;
|
|
35
37
|
notifyGlobalOnSelect(item: SelectedItemProps): void;
|
|
36
38
|
notifyGlobalOnClick(item: SelectedItemProps): void;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.64.0
|
|
3
|
+
"version": "2.64.0",
|
|
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.64.0
|
|
10
|
+
"@douyinfe/semi-animation": "2.64.0",
|
|
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": "b5976e500b9e93cf0cf1f3ce6f4ec87d75e1d62f",
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
34
34
|
"@babel/preset-env": "^7.15.8",
|
package/slider/foundation.ts
CHANGED
|
@@ -686,7 +686,16 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
686
686
|
}
|
|
687
687
|
}
|
|
688
688
|
|
|
689
|
+
_noTooltip = () => {
|
|
690
|
+
const { tipFormatter, tooltipVisible } = this.getProps();
|
|
691
|
+
return tipFormatter === null || tooltipVisible === false;
|
|
692
|
+
}
|
|
693
|
+
|
|
689
694
|
onFocus = (e: any, handler: 'min'| 'max') => {
|
|
695
|
+
const noTooltip = this._noTooltip();
|
|
696
|
+
if (noTooltip) {
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
690
699
|
handlePrevent(e);
|
|
691
700
|
const { target } = e;
|
|
692
701
|
try {
|
|
@@ -703,6 +712,10 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
703
712
|
}
|
|
704
713
|
|
|
705
714
|
onBlur = (e: any, handler: 'min'| 'max') => {
|
|
715
|
+
const noTooltip = this._noTooltip();
|
|
716
|
+
if (noTooltip) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
706
719
|
const { firstDotFocusVisible, secondDotFocusVisible } = this.getStates();
|
|
707
720
|
if (handler === 'min') {
|
|
708
721
|
firstDotFocusVisible && this._adapter.setStateVal('firstDotFocusVisible', false);
|
package/tooltip/foundation.ts
CHANGED
|
@@ -337,7 +337,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
337
337
|
if (trigger==="hover") {
|
|
338
338
|
const checkTriggerIsHover = () => {
|
|
339
339
|
const triggerDOM = this._adapter.getTriggerDOM();
|
|
340
|
-
if (trigger && !triggerDOM
|
|
340
|
+
if (trigger && !triggerDOM?.matches?.(":hover")) {
|
|
341
341
|
this.hide();
|
|
342
342
|
}
|
|
343
343
|
this._adapter.off("portalInserted", checkTriggerIsHover);
|