@douyinfe/semi-foundation 2.63.0 → 2.64.0-beta.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/calendar/foundation.ts +20 -0
- package/chat/foundation.ts +18 -23
- package/colorPicker/AlphaSliderFoundation.ts +62 -0
- package/colorPicker/ColorChooseAreaFoundation.ts +86 -0
- package/colorPicker/ColorSliderFoundation.ts +61 -0
- package/colorPicker/DataPartFoundation.ts +113 -0
- package/colorPicker/colorPicker.scss +113 -0
- package/colorPicker/constants.ts +11 -0
- package/colorPicker/foundation.ts +206 -0
- package/colorPicker/interface.ts +51 -0
- package/colorPicker/utils/convert.ts +228 -0
- package/colorPicker/utils/round.ts +3 -0
- package/colorPicker/utils/split.ts +40 -0
- package/colorPicker/variables.scss +28 -0
- 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/calendar/foundation.js +18 -0
- package/lib/cjs/chat/foundation.d.ts +1 -2
- package/lib/cjs/chat/foundation.js +2 -7
- package/lib/cjs/colorPicker/AlphaSliderFoundation.d.ts +27 -0
- package/lib/cjs/colorPicker/AlphaSliderFoundation.js +40 -0
- package/lib/cjs/colorPicker/ColorChooseAreaFoundation.d.ts +42 -0
- package/lib/cjs/colorPicker/ColorChooseAreaFoundation.js +62 -0
- package/lib/cjs/colorPicker/ColorSliderFoundation.d.ts +26 -0
- package/lib/cjs/colorPicker/ColorSliderFoundation.js +40 -0
- package/lib/cjs/colorPicker/DataPartFoundation.d.ts +28 -0
- package/lib/cjs/colorPicker/DataPartFoundation.js +115 -0
- package/lib/cjs/colorPicker/colorPicker.css +84 -0
- package/lib/cjs/colorPicker/colorPicker.scss +113 -0
- package/lib/cjs/colorPicker/constants.d.ts +4 -0
- package/lib/cjs/colorPicker/constants.js +11 -0
- package/lib/cjs/colorPicker/foundation.d.ts +66 -0
- package/lib/cjs/colorPicker/foundation.js +150 -0
- package/lib/cjs/colorPicker/interface.d.ts +40 -0
- package/lib/cjs/colorPicker/interface.js +5 -0
- package/lib/cjs/colorPicker/utils/convert.d.ts +28 -0
- package/lib/cjs/colorPicker/utils/convert.js +306 -0
- package/lib/cjs/colorPicker/utils/round.d.ts +1 -0
- package/lib/cjs/colorPicker/utils/round.js +12 -0
- package/lib/cjs/colorPicker/utils/split.d.ts +18 -0
- package/lib/cjs/colorPicker/utils/split.js +40 -0
- package/lib/cjs/colorPicker/variables.scss +28 -0
- 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/upload/foundation.d.ts +1 -0
- package/lib/cjs/upload/foundation.js +30 -14
- package/lib/es/calendar/foundation.js +18 -0
- package/lib/es/chat/foundation.d.ts +1 -2
- package/lib/es/chat/foundation.js +2 -7
- package/lib/es/colorPicker/AlphaSliderFoundation.d.ts +27 -0
- package/lib/es/colorPicker/AlphaSliderFoundation.js +33 -0
- package/lib/es/colorPicker/ColorChooseAreaFoundation.d.ts +42 -0
- package/lib/es/colorPicker/ColorChooseAreaFoundation.js +55 -0
- package/lib/es/colorPicker/ColorSliderFoundation.d.ts +26 -0
- package/lib/es/colorPicker/ColorSliderFoundation.js +33 -0
- package/lib/es/colorPicker/DataPartFoundation.d.ts +28 -0
- package/lib/es/colorPicker/DataPartFoundation.js +108 -0
- package/lib/es/colorPicker/colorPicker.css +84 -0
- package/lib/es/colorPicker/colorPicker.scss +113 -0
- package/lib/es/colorPicker/constants.d.ts +4 -0
- package/lib/es/colorPicker/constants.js +6 -0
- package/lib/es/colorPicker/foundation.d.ts +66 -0
- package/lib/es/colorPicker/foundation.js +143 -0
- package/lib/es/colorPicker/interface.d.ts +40 -0
- package/lib/es/colorPicker/interface.js +1 -0
- package/lib/es/colorPicker/utils/convert.d.ts +28 -0
- package/lib/es/colorPicker/utils/convert.js +277 -0
- package/lib/es/colorPicker/utils/round.d.ts +1 -0
- package/lib/es/colorPicker/utils/round.js +5 -0
- package/lib/es/colorPicker/utils/split.d.ts +18 -0
- package/lib/es/colorPicker/utils/split.js +34 -0
- package/lib/es/colorPicker/variables.scss +28 -0
- 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/upload/foundation.d.ts +1 -0
- package/lib/es/upload/foundation.js +30 -14
- package/package.json +3 -3
- package/upload/foundation.ts +19 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const split: (str: string, mode: 'rgba' | 'hsva') => false | {
|
|
2
|
+
r: number;
|
|
3
|
+
g: number;
|
|
4
|
+
b: number;
|
|
5
|
+
a: number;
|
|
6
|
+
h?: undefined;
|
|
7
|
+
s?: undefined;
|
|
8
|
+
v?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
h: number;
|
|
11
|
+
s: number;
|
|
12
|
+
v: number;
|
|
13
|
+
a: number;
|
|
14
|
+
r?: undefined;
|
|
15
|
+
g?: undefined;
|
|
16
|
+
b?: undefined;
|
|
17
|
+
};
|
|
18
|
+
export default split;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const split = (str, mode) => {
|
|
2
|
+
// 12,32,43 => [12,32,43]
|
|
3
|
+
const reg = /^\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*,?\s*([\d.]*)\s*$/;
|
|
4
|
+
const res = str.match(reg);
|
|
5
|
+
const result = [];
|
|
6
|
+
result[0] = Number(res === null || res === void 0 ? void 0 : res[1]);
|
|
7
|
+
result[1] = Number(res === null || res === void 0 ? void 0 : res[2]);
|
|
8
|
+
result[2] = Number(res === null || res === void 0 ? void 0 : res[3]);
|
|
9
|
+
result[3] = Number((res === null || res === void 0 ? void 0 : res[4]) === undefined || (res === null || res === void 0 ? void 0 : res[4]) === '' ? 1 : res === null || res === void 0 ? void 0 : res[4]);
|
|
10
|
+
const check = (a, max) => {
|
|
11
|
+
return !(isNaN(a) || a < 0 || a > max);
|
|
12
|
+
};
|
|
13
|
+
const ok = check(result[0], mode === 'rgba' ? 255 : 360) && check(result[1], mode === 'rgba' ? 255 : 100) && check(result[2], mode === 'rgba' ? 255 : 100) && check(result[3], 1);
|
|
14
|
+
if (ok) {
|
|
15
|
+
if (mode === 'rgba') {
|
|
16
|
+
return {
|
|
17
|
+
r: result[0],
|
|
18
|
+
g: result[1],
|
|
19
|
+
b: result[2],
|
|
20
|
+
a: result[3]
|
|
21
|
+
};
|
|
22
|
+
} else {
|
|
23
|
+
return {
|
|
24
|
+
h: result[0],
|
|
25
|
+
s: result[1],
|
|
26
|
+
v: result[2],
|
|
27
|
+
a: result[3]
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
export default split;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
$radius-colorPicker-topLeft:8px; // 圆角 - 左上
|
|
2
|
+
$radius-colorPicker-topRight:8px; // 圆角 - 右上
|
|
3
|
+
$radius-colorPicker-bottomLeft:0px; // 圆角 - 左下
|
|
4
|
+
$radius-colorPicker-bottomRight:0px; // 圆角 - 右下
|
|
5
|
+
$radius-colorPicker-handle:var(--semi-border-radius-full); // 圆角 - 拖拽把手
|
|
6
|
+
$radius-colorPicker-alphaSliderInner:4px; // 圆角 - 透明度 Slider
|
|
7
|
+
$radius-colorPicker-demoBlock: 4px; // 圆角 - 颜色手动输入区域左侧当前选中颜色色块
|
|
8
|
+
$radius-colorPicker-defaultTrigger:4px; // 默认 trigger 圆角
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
$width-colorPicker_handle-border: 2px; // 把手宽度
|
|
12
|
+
$width-colorPicker-colorPickerInputNumber:58px; // 数组输入器宽度
|
|
13
|
+
$width-colorPicker-formatSelect:80px; // 格式选择下拉 Select 宽度
|
|
14
|
+
$width-colorPicker-defaultTrigger: 24px; // 默认 trigger 大小
|
|
15
|
+
|
|
16
|
+
$color-colorPicker_handle-border:var(--semi-color-white); // 把手边框颜色
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
$spacing-colorPicker_inputNumberSuffix-horizontal:4px; // 数字输入框后百分比水平距离
|
|
20
|
+
$spacing-colorPicker_inputGroup-marginLeft:4px; // 颜色手动输入区域 左侧距离色块距离
|
|
21
|
+
$spacing-colorPicker_popover-padding:8px; // 弹层模式时整体内边距
|
|
22
|
+
$spacing-colorPicker_inputNumberSuffix-vertical:4px; // 数字输入框后百分比垂直距离
|
|
23
|
+
$spacing-colorPicker_slider-marginTop:6px; // 滑动选择器上边距
|
|
24
|
+
$spacing-colorPicker_dataPart-marginTop:8px; // 颜色手动输入区域 上边距
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
$font-colorPicker_inputNumberSuffix-fontSize:14px; // 颜色手动输入区域百分比字体大小
|
|
28
|
+
|
|
@@ -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 {};
|