@douyinfe/semi-foundation 2.63.1 → 2.63.2-alpha.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/chat/foundation.ts +18 -23
- package/datePicker/foundation.ts +1 -1
- package/image/image.scss +6 -1
- package/image/previewImageFoundation.ts +233 -150
- package/image/previewInnerFoundation.ts +11 -6
- package/lib/cjs/base/foundation.js +1 -1
- package/lib/cjs/chat/foundation.d.ts +1 -2
- package/lib/cjs/chat/foundation.js +2 -7
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +1 -1
- package/lib/cjs/datePicker/foundation.js +1 -1
- package/lib/cjs/image/image.css +5 -1
- package/lib/cjs/image/image.scss +6 -1
- package/lib/cjs/image/previewImageFoundation.d.ts +46 -13
- package/lib/cjs/image/previewImageFoundation.js +207 -181
- package/lib/cjs/image/previewInnerFoundation.d.ts +4 -3
- package/lib/cjs/image/previewInnerFoundation.js +5 -2
- 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/table/utils.d.ts +1 -1
- package/lib/cjs/tabs/constants.d.ts +1 -0
- package/lib/cjs/tabs/constants.js +2 -1
- package/lib/cjs/tabs/tabs.css +28 -199
- package/lib/cjs/tabs/tabs.scss +336 -297
- package/lib/cjs/tabs/variables.scss +21 -2
- package/lib/cjs/tree/treeUtil.d.ts +1 -1
- package/lib/cjs/upload/constants.d.ts +1 -1
- package/lib/es/base/foundation.js +1 -1
- package/lib/es/chat/foundation.d.ts +1 -2
- package/lib/es/chat/foundation.js +2 -7
- package/lib/es/checkbox/checkboxGroupFoundation.js +1 -1
- package/lib/es/datePicker/foundation.js +1 -1
- package/lib/es/image/image.css +5 -1
- package/lib/es/image/image.scss +6 -1
- package/lib/es/image/previewImageFoundation.d.ts +46 -13
- package/lib/es/image/previewImageFoundation.js +207 -181
- package/lib/es/image/previewInnerFoundation.d.ts +4 -3
- package/lib/es/image/previewInnerFoundation.js +5 -2
- 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/table/utils.d.ts +1 -1
- package/lib/es/tabs/constants.d.ts +1 -0
- package/lib/es/tabs/constants.js +2 -1
- package/lib/es/tabs/tabs.css +28 -199
- package/lib/es/tabs/tabs.scss +336 -297
- package/lib/es/tabs/variables.scss +21 -2
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/upload/constants.d.ts +1 -1
- package/navigation/foundation.ts +8 -8
- package/navigation/itemFoundation.ts +6 -4
- package/package.json +3 -3
- package/tabs/constants.ts +2 -1
- package/tabs/tabs.scss +336 -297
- package/tabs/variables.scss +21 -2
|
@@ -26,9 +26,13 @@ $color-tabs_tab_line_disabled-text-hover: var(--semi-color-disabled-text); //
|
|
|
26
26
|
|
|
27
27
|
$color-tabs_tab_card_default-border-default: var(--semi-color-border); // 卡片式页签描边颜色 - 默认
|
|
28
28
|
|
|
29
|
+
$color-tabs_tab_button-bg-default: transparent; // 按钮式页签背景颜色 - 默认
|
|
29
30
|
$color-tabs_tab_button_selected-bg-default: var(--semi-color-primary-light-default); // 按钮式页签背景颜色 - 选中
|
|
30
31
|
$color-tabs_tab_button_selected-text-default: var(--semi-color-primary); // 按钮式页签文本颜色 - 选中
|
|
31
32
|
$color-tabs_tab_button-text-default: var(--semi-color-text-2); // 按钮式页签文本颜色 - 默认
|
|
33
|
+
$color-tabs_tab_button-text-active: var(--semi-color-text-0); // 按钮式页签文本颜色 - 按下
|
|
34
|
+
$color-tabs_tab_button-text-hover: var(--semi-color-text-0); // 按钮式页签文本颜色 - 按下
|
|
35
|
+
|
|
32
36
|
$color-tabs_tab_button-bg-hover: var(--semi-color-fill-0); // 按钮式页签背景颜色 - 悬浮
|
|
33
37
|
$color-tabs_tab_button-bg-active: var(--semi-color-fill-1); // 按钮式页签背景颜色 - 按下
|
|
34
38
|
|
|
@@ -65,6 +69,10 @@ $color-tabs_tab-pane_arrow_disabled-bg-hover: transparent;
|
|
|
65
69
|
$color-tabs_tab-pane_arrow_disabled-text-default: var(--semi-color-disabled-text);
|
|
66
70
|
$color-tabs_tab-pane_arrow_disabled-text-hover: var(--semi-color-disabled-text);
|
|
67
71
|
|
|
72
|
+
$color-tabs_tab_slash_line: var(--semi-color-text-2); //斜线式页签分割线字体颜色
|
|
73
|
+
// $font-tabs_tab_slash_line-fontWeight: $font-weight-regular; //斜线式页签分割线字重
|
|
74
|
+
$font-tabs_tab_slash_line-fontSize: $font-size-regular; //斜线式页签分割线字体大小
|
|
75
|
+
|
|
68
76
|
$font-tabs_tab-fontWeight: $font-weight-regular; // 页签文本字重 - 默认
|
|
69
77
|
$font-tabs_tab_active-fontWeight: $font-weight-bold; // 页签文本字重 - 选中
|
|
70
78
|
|
|
@@ -118,6 +126,11 @@ $spacing-tabs_bar_line_tab_left-padding: 12px; // 垂直线条式页签左侧内
|
|
|
118
126
|
$spacing-tabs_bar_line_tab_left_small-padding: $spacing-tight - 2px; // 小尺寸垂直线条式页签左侧内边距
|
|
119
127
|
$spacing-tabs_bar_line_tab_left_medium-padding: $spacing-base-tight - 2px; // 中等尺寸垂直线条式页签左侧内边距
|
|
120
128
|
|
|
129
|
+
$spacing-tabs_bar_slash_tab-paddingY: 12px; // 斜线式页签上下内边距
|
|
130
|
+
$spacing-tabs_bar_slash_tab-paddingX: 4px; // 斜线式页签水平内边距
|
|
131
|
+
$spacing-tabs_bar_slash-marginRight: 16px; // 斜线式页签右侧外边距
|
|
132
|
+
$spacing-tabs_bar_slash_line_marginLeft: 16px; // 斜线式页签斜线左侧外边距
|
|
133
|
+
|
|
121
134
|
$spacing-tabs_content-paddingY: 5px; // 页签内容区垂直方向内边距
|
|
122
135
|
$spacing-tabs_content-paddingX: 0; // 页签内容区水平方向内边距
|
|
123
136
|
|
|
@@ -148,5 +161,11 @@ $radius-tabs_tab_button: var(--semi-border-radius-small); // 按钮式页签圆
|
|
|
148
161
|
$font-tabs_bar_large-fontSize: $font-size-regular; // 大号模式 字体大小
|
|
149
162
|
$font-tabs_bar_small-fontSize: $font-size-regular; // 小号模式 字体大小
|
|
150
163
|
$font-tabs_bar_medium-fontSize: $font-size-regular; // 中等模式 字体大小
|
|
151
|
-
|
|
152
|
-
|
|
164
|
+
$font-tabs_bar_button-fontSize: $font-size-regular; // 按钮式页签 字体大小
|
|
165
|
+
$font-tabs_bar_slash-fontSize: $font-size-regular; // 斜线式页签 字体大小
|
|
166
|
+
|
|
167
|
+
$font-tabs_bar_large-lineHeight: 20px; // 线条式页签大号模式 行高
|
|
168
|
+
$font-tabs_bar_small-lineHeight: 20px; // 线条式页签小号模式 行高
|
|
169
|
+
$font-tabs_bar_medium-lineHeight: 20px; // 线条式页签中等模式 行高
|
|
170
|
+
$font-tabs_bar_button-lineHeight: 20px; // 按钮式页签 行高
|
|
171
|
+
$font-tabs_bar_slash-lineHeight: 20px; // 卡片式页签 行高
|
|
@@ -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):
|
|
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: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("custom" | "auto")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
|
@@ -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)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
/// <reference types="lodash" />
|
|
3
2
|
import BaseFoundation, { DefaultAdapter } from "../base/foundation";
|
|
4
3
|
export interface Content {
|
|
@@ -27,7 +26,7 @@ export interface Message {
|
|
|
27
26
|
[x: string]: any;
|
|
28
27
|
}
|
|
29
28
|
export interface ChatAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
30
|
-
getContainerRef: () =>
|
|
29
|
+
getContainerRef: () => HTMLDivElement;
|
|
31
30
|
setWheelScroll: (flag: boolean) => void;
|
|
32
31
|
notifyChatsChange: (chats: Message[]) => void;
|
|
33
32
|
notifyLikeMessage: (message: Message) => void;
|
|
@@ -26,16 +26,14 @@ export default class ChatFoundation extends BaseFoundation {
|
|
|
26
26
|
this._adapter.notifyStopGenerate(e);
|
|
27
27
|
};
|
|
28
28
|
this.scrollToBottomImmediately = () => {
|
|
29
|
-
const
|
|
30
|
-
const element = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
29
|
+
const element = this._adapter.getContainerRef();
|
|
31
30
|
if (element) {
|
|
32
31
|
element.scrollTop = element.scrollHeight;
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
34
|
this.scrollToBottomWithAnimation = () => {
|
|
36
35
|
const duration = SCROLL_ANIMATION_TIME;
|
|
37
|
-
const
|
|
38
|
-
const element = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
|
|
36
|
+
const element = this._adapter.getContainerRef();
|
|
39
37
|
if (!element) {
|
|
40
38
|
return;
|
|
41
39
|
}
|
|
@@ -61,9 +59,6 @@ export default class ChatFoundation extends BaseFoundation {
|
|
|
61
59
|
this.animation.start();
|
|
62
60
|
};
|
|
63
61
|
this.containerScroll = e => {
|
|
64
|
-
if (e.target !== e.currentTarget) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
62
|
e.persist();
|
|
68
63
|
const update = () => {
|
|
69
64
|
this.getScroll(e.target);
|
|
@@ -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);
|
|
@@ -258,7 +258,7 @@ export default class DatePickerFoundation extends BaseFoundation {
|
|
|
258
258
|
const {
|
|
259
259
|
value
|
|
260
260
|
} = this._adapter.getStates();
|
|
261
|
-
const needResetCachedSelectedValue = !this.isCachedSelectedValueValid(willUpdateDates) || this._adapter.needConfirm() && !this.clickConfirmButton;
|
|
261
|
+
const needResetCachedSelectedValue = isNullOrUndefined(willUpdateDates) || !this.isCachedSelectedValueValid(willUpdateDates) || this._adapter.needConfirm() && !this.clickConfirmButton;
|
|
262
262
|
if (needResetCachedSelectedValue) {
|
|
263
263
|
this.resetCachedSelectedValue(value);
|
|
264
264
|
}
|
package/lib/es/image/image.css
CHANGED
|
@@ -90,6 +90,7 @@
|
|
|
90
90
|
align-items: center;
|
|
91
91
|
padding: 0 24px;
|
|
92
92
|
z-index: 1;
|
|
93
|
+
pointer-events: none;
|
|
93
94
|
}
|
|
94
95
|
.semi-image-preview-header-title {
|
|
95
96
|
flex: 1;
|
|
@@ -102,6 +103,7 @@
|
|
|
102
103
|
width: 30px;
|
|
103
104
|
height: 30px;
|
|
104
105
|
border-radius: 50%;
|
|
106
|
+
pointer-events: auto;
|
|
105
107
|
}
|
|
106
108
|
.semi-image-preview-header-close:hover {
|
|
107
109
|
background-color: rgba(0, 0, 0, 0.75);
|
|
@@ -166,11 +168,13 @@
|
|
|
166
168
|
.semi-image-preview-image {
|
|
167
169
|
position: relative;
|
|
168
170
|
height: 100%;
|
|
171
|
+
display: flex;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
align-items: center;
|
|
169
174
|
}
|
|
170
175
|
.semi-image-preview-image-img {
|
|
171
176
|
position: absolute;
|
|
172
177
|
transform: scale3d(1, 1, 1) var(--semi-transform-rotate-none);
|
|
173
|
-
transition: transform 300ms 0s;
|
|
174
178
|
z-index: 0;
|
|
175
179
|
user-select: none;
|
|
176
180
|
}
|
package/lib/es/image/image.scss
CHANGED
|
@@ -100,6 +100,7 @@ $module: #{$prefix}-image;
|
|
|
100
100
|
align-items: center;
|
|
101
101
|
padding: $spacing-image_preview_header-paddingY $spacing-image_preview_header-paddingX;
|
|
102
102
|
z-index: $z-image_preview_header;
|
|
103
|
+
pointer-events: none;
|
|
103
104
|
|
|
104
105
|
&-title {
|
|
105
106
|
flex: 1;
|
|
@@ -113,6 +114,7 @@ $module: #{$prefix}-image;
|
|
|
113
114
|
width: $width-image_preview_header_close;
|
|
114
115
|
height: $height-image_preview_header_close;
|
|
115
116
|
border-radius: 50%;
|
|
117
|
+
pointer-events: auto;
|
|
116
118
|
|
|
117
119
|
&:hover {
|
|
118
120
|
background-color: $color-image_header_close-bg;
|
|
@@ -192,11 +194,14 @@ $module: #{$prefix}-image;
|
|
|
192
194
|
&-image {
|
|
193
195
|
position: relative;
|
|
194
196
|
height: 100%;
|
|
197
|
+
display: flex;
|
|
198
|
+
justify-content: center;
|
|
199
|
+
align-items: center;
|
|
195
200
|
|
|
196
201
|
&-img {
|
|
197
202
|
position: absolute;
|
|
198
203
|
transform: scale3d($transform_scale3d-image_preview_image_img) $transform_rotate-image_preview_image_img;
|
|
199
|
-
transition: transform $transition_duration-image_preview_image_img $transition_delay-image_preview_image_img;
|
|
204
|
+
// transition: transform $transition_duration-image_preview_image_img $transition_delay-image_preview_image_img;
|
|
200
205
|
z-index: 0;
|
|
201
206
|
user-select: none;
|
|
202
207
|
}
|
|
@@ -9,36 +9,69 @@ export interface DragDirection {
|
|
|
9
9
|
canDragVertical: boolean;
|
|
10
10
|
canDragHorizontal: boolean;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
export interface ExtremeTranslate {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
15
|
}
|
|
16
|
-
export interface
|
|
16
|
+
export interface Offset {
|
|
17
17
|
x: number;
|
|
18
18
|
y: number;
|
|
19
19
|
}
|
|
20
|
+
export interface Translate {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
}
|
|
24
|
+
interface CalcBoundingRectMouseOffset {
|
|
25
|
+
offset: Offset;
|
|
26
|
+
width: number;
|
|
27
|
+
height: number;
|
|
28
|
+
rotation?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface BoundingRectSize {
|
|
31
|
+
width: number;
|
|
32
|
+
height: number;
|
|
33
|
+
}
|
|
20
34
|
export default class PreviewImageFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<PreviewImageAdapter<P, S>, P, S> {
|
|
21
35
|
constructor(adapter: PreviewImageAdapter<P, S>);
|
|
22
|
-
|
|
36
|
+
startMouseClientPosition: {
|
|
23
37
|
x: number;
|
|
24
38
|
y: number;
|
|
25
39
|
};
|
|
26
40
|
originImageWidth: any;
|
|
27
41
|
originImageHeight: any;
|
|
42
|
+
containerWidth: number;
|
|
43
|
+
containerHeight: number;
|
|
44
|
+
init(): void;
|
|
28
45
|
_isImageVertical: () => boolean;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
46
|
+
_getContainerBoundingRectSize: () => void;
|
|
47
|
+
_getAdaptationZoom: () => number;
|
|
48
|
+
_getInitialZoom: () => number;
|
|
32
49
|
setLoading: (loading: boolean) => void;
|
|
33
50
|
handleWindowResize: () => void;
|
|
34
51
|
handleLoad: (e: any) => void;
|
|
35
52
|
handleError: (e: any) => void;
|
|
36
|
-
handleResizeImage: (notify?: boolean) => void;
|
|
37
53
|
handleRatioChange: () => void;
|
|
54
|
+
initializeImageZoom: (notify?: boolean) => void;
|
|
55
|
+
initializeTranslate: () => void;
|
|
56
|
+
initializeImage: (notify?: boolean) => void;
|
|
38
57
|
handleRightClickImage: (e: any) => boolean;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
calcBoundingRectSize(width?: number, height?: number, rotation?: number): {
|
|
59
|
+
width: number;
|
|
60
|
+
height: number;
|
|
61
|
+
};
|
|
62
|
+
getCanDragDirection: (width: number, height: number) => DragDirection;
|
|
63
|
+
changeZoom: (newZoom: number, e?: WheelEvent) => void;
|
|
64
|
+
getExtremeTranslate: (width: number, height: number) => ExtremeTranslate;
|
|
65
|
+
getSafeTranslate: (width: number, height: number, translateX: number, translateY: number) => {
|
|
66
|
+
x: number;
|
|
67
|
+
y: number;
|
|
68
|
+
};
|
|
69
|
+
handleImageMove: (e: MouseEvent) => void;
|
|
70
|
+
moveImage: (e: MouseEvent) => void;
|
|
43
71
|
handleImageMouseDown: (e: any) => void;
|
|
72
|
+
calcBoundingRectMouseOffset: (calcBoundingRectMouseOffset: CalcBoundingRectMouseOffset) => {
|
|
73
|
+
x: number;
|
|
74
|
+
y: number;
|
|
75
|
+
};
|
|
44
76
|
}
|
|
77
|
+
export {};
|