@douyinfe/semi-foundation 2.20.0-beta.1 → 2.20.1
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 +1 -2
- package/datePicker/foundation.ts +6 -5
- package/datePicker/monthsGridFoundation.ts +6 -6
- package/datePicker/yearAndMonthFoundation.ts +2 -2
- package/form/form.scss +14 -0
- package/image/image.scss +3 -0
- package/image/previewImageFoundation.ts +5 -5
- package/image/previewInnerFoundation.ts +5 -1
- package/image/utils.ts +5 -3
- package/image/variables.scss +3 -0
- package/lib/cjs/calendar/foundation.d.ts +2 -1
- package/lib/cjs/datePicker/foundation.d.ts +4 -4
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +2 -3
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +2 -3
- package/lib/cjs/form/form.css +8 -0
- package/lib/cjs/form/form.scss +14 -0
- package/lib/cjs/image/image.css +3 -0
- package/lib/cjs/image/image.scss +3 -0
- package/lib/cjs/image/previewImageFoundation.js +11 -10
- package/lib/cjs/image/previewInnerFoundation.js +6 -2
- package/lib/cjs/image/utils.js +5 -5
- package/lib/cjs/image/variables.scss +3 -0
- package/lib/cjs/navigation/foundation.d.ts +0 -1
- package/lib/cjs/navigation/foundation.js +1 -11
- package/lib/es/calendar/foundation.d.ts +2 -1
- package/lib/es/datePicker/foundation.d.ts +4 -4
- package/lib/es/datePicker/monthsGridFoundation.d.ts +2 -3
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +2 -3
- package/lib/es/form/form.css +8 -0
- package/lib/es/form/form.scss +14 -0
- package/lib/es/image/image.css +3 -0
- package/lib/es/image/image.scss +3 -0
- package/lib/es/image/previewImageFoundation.js +11 -10
- package/lib/es/image/previewInnerFoundation.js +6 -2
- package/lib/es/image/utils.js +5 -5
- package/lib/es/image/variables.scss +3 -0
- package/lib/es/navigation/foundation.d.ts +0 -1
- package/lib/es/navigation/foundation.js +1 -11
- package/navigation/foundation.ts +2 -9
- package/package.json +2 -2
- package/tree/treeUtil.ts +1 -1
package/calendar/foundation.ts
CHANGED
package/datePicker/foundation.ts
CHANGED
|
@@ -12,13 +12,14 @@ import { getDefaultFormatTokenByType } from './_utils/getDefaultFormatToken';
|
|
|
12
12
|
import { strings } from './constants';
|
|
13
13
|
import { strings as inputStrings } from '../input/constants';
|
|
14
14
|
|
|
15
|
-
import { Type, DateInputFoundationProps, InsetInputValue } from './inputFoundation';
|
|
16
|
-
import { MonthsGridFoundationProps } from './monthsGridFoundation';
|
|
17
|
-
import { WeekStartNumber } from './_utils/getMonthTable';
|
|
18
|
-
import { ArrayElement, Motion } from '../utils/type';
|
|
19
15
|
import getInsetInputFormatToken from './_utils/getInsetInputFormatToken';
|
|
20
16
|
import getInsetInputValueFromInsetInputStr from './_utils/getInsetInputValueFromInsetInputStr';
|
|
21
17
|
|
|
18
|
+
import type { ArrayElement, Motion } from '../utils/type';
|
|
19
|
+
import type { Type, DateInputFoundationProps, InsetInputValue } from './inputFoundation';
|
|
20
|
+
import type { MonthsGridFoundationProps } from './monthsGridFoundation';
|
|
21
|
+
import type { WeekStartNumber } from './_utils/getMonthTable';
|
|
22
|
+
|
|
22
23
|
export type ValidateStatus = ArrayElement<typeof strings.STATUS>;
|
|
23
24
|
export type InputSize = ArrayElement<typeof strings.SIZE_SET>;
|
|
24
25
|
export type Position = ArrayElement<typeof strings.POSITION_SET>;
|
|
@@ -956,7 +957,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
956
957
|
if (insetInput) {
|
|
957
958
|
const insetInputFormatToken = getInsetInputFormatToken({ format, type });
|
|
958
959
|
const insetInputStr = this._isMultiple() ? this.formatMultipleDates(dates, undefined, insetInputFormatToken) : this.formatDates(dates, insetInputFormatToken);
|
|
959
|
-
insetInputValue = getInsetInputValueFromInsetInputStr({ inputValue: insetInputStr, type, rangeSeparator
|
|
960
|
+
insetInputValue = getInsetInputValueFromInsetInputStr({ inputValue: insetInputStr, type, rangeSeparator });
|
|
960
961
|
}
|
|
961
962
|
const isRangeTypeAndInputIncomplete = this._isRangeType() && !this._isRangeValueComplete(dates);
|
|
962
963
|
/**
|
|
@@ -92,8 +92,8 @@ export interface MonthsGridFoundationProps extends MonthsGridElementProps {
|
|
|
92
92
|
triggerRender?: (props: Record<string, any>) => any;
|
|
93
93
|
insetInput: boolean;
|
|
94
94
|
presetPosition?: PresetPosition;
|
|
95
|
-
renderQuickControls?:
|
|
96
|
-
renderDateInput?:
|
|
95
|
+
renderQuickControls?: any;
|
|
96
|
+
renderDateInput?: any;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
export interface MonthInfo {
|
|
@@ -284,7 +284,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
284
284
|
* sync change another panel month when change months from the else yam panel
|
|
285
285
|
* call it when
|
|
286
286
|
* - current change panel targe date month is same with another panel date
|
|
287
|
-
*
|
|
287
|
+
*
|
|
288
288
|
* @example
|
|
289
289
|
* - panelType=right, target=new Date('2022-09-01') and left panel is in '2022-09' => call it, left panel minus one month to '2022-08'
|
|
290
290
|
* - panelType=left, target=new Date('2021-12-01') and right panel is in '2021-12' => call it, right panel add one month to '2021-01'
|
|
@@ -310,7 +310,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
310
310
|
const { monthRight, monthLeft } = this._adapter.getStates();
|
|
311
311
|
const currentDate = panelType === 'left' ? monthLeft.pickerDate : monthRight.pickerDate;
|
|
312
312
|
let target: Date;
|
|
313
|
-
|
|
313
|
+
|
|
314
314
|
switch (switchType) {
|
|
315
315
|
case 'prevMonth':
|
|
316
316
|
target = addMonths(currentDate, -1);
|
|
@@ -335,7 +335,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
335
335
|
const { type } = this._adapter.getProps();
|
|
336
336
|
const diff = this._getDiff('month', target, panelType);
|
|
337
337
|
this.handleYearOrMonthChange(diff < 0 ? 'prevMonth' : 'nextMonth', panelType, Math.abs(diff), false);
|
|
338
|
-
|
|
338
|
+
|
|
339
339
|
if (this.isRangeType(type)) {
|
|
340
340
|
this.handleSyncChangeMonths({ panelType, target });
|
|
341
341
|
}
|
|
@@ -936,7 +936,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
936
936
|
|
|
937
937
|
/**
|
|
938
938
|
* Get year and month panel open type
|
|
939
|
-
*
|
|
939
|
+
*
|
|
940
940
|
* It is useful info to set minHeight of weeks.
|
|
941
941
|
* - When yam open type is 'left' or 'right', weeks minHeight should be set
|
|
942
942
|
* If the minHeight is not set, the change of the number of weeks will cause the scrollList to be unstable
|
|
@@ -14,8 +14,8 @@ export interface YearAndMonthFoundationProps {
|
|
|
14
14
|
disabledDate?: (date: Date) => boolean;
|
|
15
15
|
density?: string;
|
|
16
16
|
presetPosition?: PresetPosition;
|
|
17
|
-
renderQuickControls?:
|
|
18
|
-
renderDateInput?:
|
|
17
|
+
renderQuickControls?: any;
|
|
18
|
+
renderDateInput?: any;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface YearAndMonthFoundationState {
|
package/form/form.scss
CHANGED
|
@@ -66,6 +66,20 @@ $rating: #{$prefix}-rating;
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
.#{$field}-group {
|
|
71
|
+
.#{$col} {
|
|
72
|
+
&-right {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: flex-end;
|
|
75
|
+
}
|
|
76
|
+
&-left {
|
|
77
|
+
display: flex;
|
|
78
|
+
justify-content: flex-start;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
.#{$field}-pure {
|
|
70
84
|
// padding-top: 0;
|
|
71
85
|
// padding-bottom: 0;
|
package/image/image.scss
CHANGED
|
@@ -13,6 +13,7 @@ $module: #{$prefix}-image;
|
|
|
13
13
|
&-img {
|
|
14
14
|
vertical-align: middle;
|
|
15
15
|
border-radius: inherit;
|
|
16
|
+
user-select: none;
|
|
16
17
|
|
|
17
18
|
&-preview {
|
|
18
19
|
cursor: zoom-in;
|
|
@@ -135,6 +136,7 @@ $module: #{$prefix}-image;
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
&-page {
|
|
139
|
+
user-select: none;
|
|
138
140
|
color: $color-image_preview_footer_icon;
|
|
139
141
|
@include font-size-header-6;
|
|
140
142
|
margin: $spacing-image_preview_footer_page-marginY $spacing-image_preview_footer_page-marginX;
|
|
@@ -192,6 +194,7 @@ $module: #{$prefix}-image;
|
|
|
192
194
|
transform: scale3d($transform_scale3d-image_preview_image_img) $transform_rotate-image_preview_image_img;
|
|
193
195
|
transition: transform $transition_duration-image_preview_image_img $transition_delay-image_preview_image_img;
|
|
194
196
|
z-index: 0;
|
|
197
|
+
user-select: none;
|
|
195
198
|
}
|
|
196
199
|
|
|
197
200
|
&-spin {
|
|
@@ -220,16 +220,16 @@ export default class PreviewImageFoundation<P = Record<string, any>, S = Record<
|
|
|
220
220
|
};
|
|
221
221
|
|
|
222
222
|
handleMoveImage = (e: any): void => {
|
|
223
|
-
const { offset, width, height
|
|
224
|
-
const { rotation } = this.getProps();
|
|
223
|
+
const { offset, width, height } = this.getStates();
|
|
225
224
|
const startMouseMove = this._adapter.getMouseMove();
|
|
226
225
|
const startMouseOffset = this._adapter.getMouseOffset();
|
|
227
226
|
const { canDragVertical, canDragHorizontal } = this.calcCanDragDirection();
|
|
228
227
|
if (startMouseMove && (canDragVertical || canDragHorizontal)) {
|
|
229
|
-
const {
|
|
228
|
+
const { clientX, clientY } = e;
|
|
229
|
+
const { left: containerLeft, top: containerTop } = this._getContainerBounds();
|
|
230
230
|
const { left: extremeLeft, top: extremeTop } = this.calcExtremeBounds();
|
|
231
|
-
let newX = canDragHorizontal ?
|
|
232
|
-
let newY = canDragVertical ?
|
|
231
|
+
let newX = canDragHorizontal ? clientX - containerLeft - startMouseOffset.x : offset.x;
|
|
232
|
+
let newY = canDragVertical ? clientY - containerTop - startMouseOffset.y : offset.y;
|
|
233
233
|
if (canDragHorizontal) {
|
|
234
234
|
newX = newX > 0 ? 0 : newX < extremeLeft ? extremeLeft : newX;
|
|
235
235
|
}
|
|
@@ -77,7 +77,11 @@ export default class PreviewInnerFoundation<P = Record<string, any>, S = Record<
|
|
|
77
77
|
let couldClose = !isTargetEmit(e.nativeEvent, NOT_CLOSE_TARGETS);
|
|
78
78
|
const { clientX, clientY } = e;
|
|
79
79
|
const { x, y } = this._adapter.getStartMouseDown();
|
|
80
|
-
|
|
80
|
+
// 对鼠标移动做容错处理,当 x 和 y 方向在 mouseUp 的时候移动距离都小于等于 5px 时候就可以关闭预览
|
|
81
|
+
// Error-tolerant processing of mouse movement, when the movement distance in the x and y directions is less than or equal to 5px in mouseUp, the preview can be closed
|
|
82
|
+
// 不做容错处理的话,直接用 clientX !== x || y !== clientY 做判断,鼠标在用户点击时候无意识的轻微移动无法关闭预览,不符合用户预期
|
|
83
|
+
// If you do not do fault-tolerant processing, but directly use clientX !== x || y !== clientY to make judgments, the slight movement of the mouse when the user clicks will not be able to close the preview, which does not meet the user's expectations.
|
|
84
|
+
if (Math.abs(clientX - x) > 5 || Math.abs(y - clientY) > 5) {
|
|
81
85
|
couldClose = false;
|
|
82
86
|
}
|
|
83
87
|
if (couldClose && maskClosable) {
|
package/image/utils.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export const isTargetEmit = (event, targetClasses): boolean => {
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
|
|
2
|
+
// event.path usage is discouraged, use event.composedPath() as it's standard and is more future-proof
|
|
3
|
+
// path is the event-triggered bubbling path, which stores each node through which bubbling passes.
|
|
4
|
+
// path.length-4 is to remove elements above the root node, such as body, html, document, window
|
|
5
|
+
const path = event?.composedPath();
|
|
6
|
+
const isTarget = path?.slice(0, path.length - 4).some((node): boolean => {
|
|
5
7
|
if (node.className && typeof node.className === "string") {
|
|
6
8
|
return targetClasses.some(c => node.className.includes(c));
|
|
7
9
|
}
|
package/image/variables.scss
CHANGED
|
@@ -45,3 +45,6 @@ $color-image_header_close-bg: rgba(0, 0, 0, 0.75); //图像预览header的关闭
|
|
|
45
45
|
$color-image_preview_footer-bg: rgba(0, 0, 0, 0.75); // 图像预览footer部分背景色
|
|
46
46
|
$color-image-preview_divider-bg: rgba(255, 255, 255, .5); // 图像预览footer中的分割线背景色
|
|
47
47
|
$color-image_preview_image_spin: #ccc; // 图像预览的加载状态颜色
|
|
48
|
+
|
|
49
|
+
$z-image_preview: 1070 !default; // Image 组件预览层z-index
|
|
50
|
+
$z-image_preview_header: 1 !default; // Image 组件预览层中 header 部分 z-index
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
2
|
import { Locale } from 'date-fns';
|
|
3
|
-
import { DateObj
|
|
3
|
+
import { DateObj } from './eventUtil';
|
|
4
|
+
import type { weeekStartsOnEnum } from './eventUtil';
|
|
4
5
|
export { weeekStartsOnEnum };
|
|
5
6
|
export interface EventObject {
|
|
6
7
|
[x: string]: any;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
2
|
import { strings } from './constants';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import type { ArrayElement, Motion } from '../utils/type';
|
|
4
|
+
import type { Type, DateInputFoundationProps, InsetInputValue } from './inputFoundation';
|
|
5
|
+
import type { MonthsGridFoundationProps } from './monthsGridFoundation';
|
|
6
|
+
import type { WeekStartNumber } from './_utils/getMonthTable';
|
|
7
7
|
export declare type ValidateStatus = ArrayElement<typeof strings.STATUS>;
|
|
8
8
|
export declare type InputSize = ArrayElement<typeof strings.SIZE_SET>;
|
|
9
9
|
export declare type Position = ArrayElement<typeof strings.POSITION_SET>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { strings } from './constants';
|
|
4
3
|
import { WeekStartNumber } from './_utils/getMonthTable';
|
|
@@ -56,8 +55,8 @@ export interface MonthsGridFoundationProps extends MonthsGridElementProps {
|
|
|
56
55
|
triggerRender?: (props: Record<string, any>) => any;
|
|
57
56
|
insetInput: boolean;
|
|
58
57
|
presetPosition?: PresetPosition;
|
|
59
|
-
renderQuickControls?:
|
|
60
|
-
renderDateInput?:
|
|
58
|
+
renderQuickControls?: any;
|
|
59
|
+
renderDateInput?: any;
|
|
61
60
|
}
|
|
62
61
|
export interface MonthInfo {
|
|
63
62
|
pickerDate: Date;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { PresetPosition } from './foundation';
|
|
4
3
|
export interface YearAndMonthFoundationProps {
|
|
@@ -17,8 +16,8 @@ export interface YearAndMonthFoundationProps {
|
|
|
17
16
|
disabledDate?: (date: Date) => boolean;
|
|
18
17
|
density?: string;
|
|
19
18
|
presetPosition?: PresetPosition;
|
|
20
|
-
renderQuickControls?:
|
|
21
|
-
renderDateInput?:
|
|
19
|
+
renderQuickControls?: any;
|
|
20
|
+
renderDateInput?: any;
|
|
22
21
|
}
|
|
23
22
|
export interface YearAndMonthFoundationState {
|
|
24
23
|
years: Array<{
|
package/lib/cjs/form/form.css
CHANGED
|
@@ -35,6 +35,14 @@
|
|
|
35
35
|
display: flex;
|
|
36
36
|
justify-content: flex-start;
|
|
37
37
|
}
|
|
38
|
+
.semi-form-vertical .semi-form-field-group .semi-form-col-right {
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: flex-end;
|
|
41
|
+
}
|
|
42
|
+
.semi-form-vertical .semi-form-field-group .semi-form-col-left {
|
|
43
|
+
display: flex;
|
|
44
|
+
justify-content: flex-start;
|
|
45
|
+
}
|
|
38
46
|
.semi-form-field-label {
|
|
39
47
|
box-sizing: border-box;
|
|
40
48
|
padding-right: 16px;
|
package/lib/cjs/form/form.scss
CHANGED
|
@@ -66,6 +66,20 @@ $rating: #{$prefix}-rating;
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
.#{$field}-group {
|
|
71
|
+
.#{$col} {
|
|
72
|
+
&-right {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: flex-end;
|
|
75
|
+
}
|
|
76
|
+
&-left {
|
|
77
|
+
display: flex;
|
|
78
|
+
justify-content: flex-start;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
.#{$field}-pure {
|
|
70
84
|
// padding-top: 0;
|
|
71
85
|
// padding-bottom: 0;
|
package/lib/cjs/image/image.css
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
.semi-image-img {
|
|
11
11
|
vertical-align: middle;
|
|
12
12
|
border-radius: inherit;
|
|
13
|
+
user-select: none;
|
|
13
14
|
}
|
|
14
15
|
.semi-image-img-preview {
|
|
15
16
|
cursor: zoom-in;
|
|
@@ -120,6 +121,7 @@
|
|
|
120
121
|
transform: translateX(-50%);
|
|
121
122
|
}
|
|
122
123
|
.semi-image-preview-footer-page {
|
|
124
|
+
user-select: none;
|
|
123
125
|
color: var(--semi-color-white);
|
|
124
126
|
font-size: 16px;
|
|
125
127
|
line-height: 22px;
|
|
@@ -168,6 +170,7 @@
|
|
|
168
170
|
transform: scale3d(1, 1, 1) var(--semi-transform-rotate-none);
|
|
169
171
|
transition: transform 0.3s 0s;
|
|
170
172
|
z-index: 0;
|
|
173
|
+
user-select: none;
|
|
171
174
|
}
|
|
172
175
|
.semi-image-preview-image-spin {
|
|
173
176
|
position: absolute;
|
package/lib/cjs/image/image.scss
CHANGED
|
@@ -13,6 +13,7 @@ $module: #{$prefix}-image;
|
|
|
13
13
|
&-img {
|
|
14
14
|
vertical-align: middle;
|
|
15
15
|
border-radius: inherit;
|
|
16
|
+
user-select: none;
|
|
16
17
|
|
|
17
18
|
&-preview {
|
|
18
19
|
cursor: zoom-in;
|
|
@@ -135,6 +136,7 @@ $module: #{$prefix}-image;
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
&-page {
|
|
139
|
+
user-select: none;
|
|
138
140
|
color: $color-image_preview_footer_icon;
|
|
139
141
|
@include font-size-header-6;
|
|
140
142
|
margin: $spacing-image_preview_footer_page-marginY $spacing-image_preview_footer_page-marginX;
|
|
@@ -192,6 +194,7 @@ $module: #{$prefix}-image;
|
|
|
192
194
|
transform: scale3d($transform_scale3d-image_preview_image_img) $transform_rotate-image_preview_image_img;
|
|
193
195
|
transition: transform $transition_duration-image_preview_image_img $transition_delay-image_preview_image_img;
|
|
194
196
|
z-index: 0;
|
|
197
|
+
user-select: none;
|
|
195
198
|
}
|
|
196
199
|
|
|
197
200
|
&-spin {
|
|
@@ -301,13 +301,8 @@ class PreviewImageFoundation extends _foundation.default {
|
|
|
301
301
|
const {
|
|
302
302
|
offset,
|
|
303
303
|
width,
|
|
304
|
-
height
|
|
305
|
-
left,
|
|
306
|
-
top
|
|
304
|
+
height
|
|
307
305
|
} = this.getStates();
|
|
308
|
-
const {
|
|
309
|
-
rotation
|
|
310
|
-
} = this.getProps();
|
|
311
306
|
|
|
312
307
|
const startMouseMove = this._adapter.getMouseMove();
|
|
313
308
|
|
|
@@ -320,15 +315,21 @@ class PreviewImageFoundation extends _foundation.default {
|
|
|
320
315
|
|
|
321
316
|
if (startMouseMove && (canDragVertical || canDragHorizontal)) {
|
|
322
317
|
const {
|
|
323
|
-
|
|
324
|
-
|
|
318
|
+
clientX,
|
|
319
|
+
clientY
|
|
325
320
|
} = e;
|
|
321
|
+
|
|
322
|
+
const {
|
|
323
|
+
left: containerLeft,
|
|
324
|
+
top: containerTop
|
|
325
|
+
} = this._getContainerBounds();
|
|
326
|
+
|
|
326
327
|
const {
|
|
327
328
|
left: extremeLeft,
|
|
328
329
|
top: extremeTop
|
|
329
330
|
} = this.calcExtremeBounds();
|
|
330
|
-
let newX = canDragHorizontal ?
|
|
331
|
-
let newY = canDragVertical ?
|
|
331
|
+
let newX = canDragHorizontal ? clientX - containerLeft - startMouseOffset.x : offset.x;
|
|
332
|
+
let newY = canDragVertical ? clientY - containerTop - startMouseOffset.y : offset.y;
|
|
332
333
|
|
|
333
334
|
if (canDragHorizontal) {
|
|
334
335
|
newX = newX > 0 ? 0 : newX < extremeLeft ? extremeLeft : newX;
|
|
@@ -72,9 +72,13 @@ class PreviewInnerFoundation extends _foundation.default {
|
|
|
72
72
|
const {
|
|
73
73
|
x,
|
|
74
74
|
y
|
|
75
|
-
} = this._adapter.getStartMouseDown();
|
|
75
|
+
} = this._adapter.getStartMouseDown(); // 对鼠标移动做容错处理,当 x 和 y 方向在 mouseUp 的时候移动距离都小于等于 5px 时候就可以关闭预览
|
|
76
|
+
// Error-tolerant processing of mouse movement, when the movement distance in the x and y directions is less than or equal to 5px in mouseUp, the preview can be closed
|
|
77
|
+
// 不做容错处理的话,直接用 clientX !== x || y !== clientY 做判断,鼠标在用户点击时候无意识的轻微移动无法关闭预览,不符合用户预期
|
|
78
|
+
// If you do not do fault-tolerant processing, but directly use clientX !== x || y !== clientY to make judgments, the slight movement of the mouse when the user clicks will not be able to close the preview, which does not meet the user's expectations.
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
|
|
81
|
+
if (Math.abs(clientX - x) > 5 || Math.abs(y - clientY) > 5) {
|
|
78
82
|
couldClose = false;
|
|
79
83
|
}
|
|
80
84
|
|
package/lib/cjs/image/utils.js
CHANGED
|
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.isTargetEmit = exports.getPreloadImagArr = exports.downloadImage = exports.crossMerge = void 0;
|
|
7
7
|
|
|
8
8
|
const isTargetEmit = (event, targetClasses) => {
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const isTarget =
|
|
9
|
+
// event.path usage is discouraged, use event.composedPath() as it's standard and is more future-proof
|
|
10
|
+
// path is the event-triggered bubbling path, which stores each node through which bubbling passes.
|
|
11
|
+
// path.length-4 is to remove elements above the root node, such as body, html, document, window
|
|
12
|
+
const path = event === null || event === void 0 ? void 0 : event.composedPath();
|
|
13
|
+
const isTarget = path === null || path === void 0 ? void 0 : path.slice(0, path.length - 4).some(node => {
|
|
14
14
|
if (node.className && typeof node.className === "string") {
|
|
15
15
|
return targetClasses.some(c => node.className.includes(c));
|
|
16
16
|
}
|
|
@@ -45,3 +45,6 @@ $color-image_header_close-bg: rgba(0, 0, 0, 0.75); //图像预览header的关闭
|
|
|
45
45
|
$color-image_preview_footer-bg: rgba(0, 0, 0, 0.75); // 图像预览footer部分背景色
|
|
46
46
|
$color-image-preview_divider-bg: rgba(255, 255, 255, .5); // 图像预览footer中的分割线背景色
|
|
47
47
|
$color-image_preview_image_spin: #ccc; // 图像预览的加载状态颜色
|
|
48
|
+
|
|
49
|
+
$z-image_preview: 1070 !default; // Image 组件预览层z-index
|
|
50
|
+
$z-image_preview_header: 1 !default; // Image 组件预览层中 header 部分 z-index
|
|
@@ -74,7 +74,6 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
|
|
|
74
74
|
* @param {*} itemKeysMap
|
|
75
75
|
*/
|
|
76
76
|
getWillOpenKeys(itemKeysMap: ItemKey2ParentKeysMap): any[];
|
|
77
|
-
getItemKey(item: string | number, keyPropName?: string): string | number;
|
|
78
77
|
getShouldOpenKeys(itemKeysMap?: ItemKey2ParentKeysMap, selectedKeys?: string | number[]): unknown[];
|
|
79
78
|
destroy(): void;
|
|
80
79
|
selectLevelZeroParentKeys(itemKeysMap: ItemKey2ParentKeysMap, ...itemKeys: (string | number)[]): any[];
|
|
@@ -186,16 +186,6 @@ class NavigationFoundation extends _foundation.default {
|
|
|
186
186
|
return [...willOpenKeys];
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
getItemKey(item) {
|
|
190
|
-
let keyPropName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'itemKey';
|
|
191
|
-
|
|
192
|
-
if (item && typeof item === 'object') {
|
|
193
|
-
return item[keyPropName];
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
return item;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
189
|
getShouldOpenKeys() {
|
|
200
190
|
let itemKeysMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
201
191
|
let selectedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -204,7 +194,7 @@ class NavigationFoundation extends _foundation.default {
|
|
|
204
194
|
if (Array.isArray(selectedKeys) && selectedKeys.length) {
|
|
205
195
|
selectedKeys.forEach(item => {
|
|
206
196
|
if (item) {
|
|
207
|
-
const parentKeys = (0, _get2.default)(itemKeysMap,
|
|
197
|
+
const parentKeys = (0, _get2.default)(itemKeysMap, item);
|
|
208
198
|
|
|
209
199
|
if (Array.isArray(parentKeys)) {
|
|
210
200
|
parentKeys.forEach(k => willOpenKeySet.add(k));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
2
|
import { Locale } from 'date-fns';
|
|
3
|
-
import { DateObj
|
|
3
|
+
import { DateObj } from './eventUtil';
|
|
4
|
+
import type { weeekStartsOnEnum } from './eventUtil';
|
|
4
5
|
export { weeekStartsOnEnum };
|
|
5
6
|
export interface EventObject {
|
|
6
7
|
[x: string]: any;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
2
|
import { strings } from './constants';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import type { ArrayElement, Motion } from '../utils/type';
|
|
4
|
+
import type { Type, DateInputFoundationProps, InsetInputValue } from './inputFoundation';
|
|
5
|
+
import type { MonthsGridFoundationProps } from './monthsGridFoundation';
|
|
6
|
+
import type { WeekStartNumber } from './_utils/getMonthTable';
|
|
7
7
|
export declare type ValidateStatus = ArrayElement<typeof strings.STATUS>;
|
|
8
8
|
export declare type InputSize = ArrayElement<typeof strings.SIZE_SET>;
|
|
9
9
|
export declare type Position = ArrayElement<typeof strings.POSITION_SET>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { strings } from './constants';
|
|
4
3
|
import { WeekStartNumber } from './_utils/getMonthTable';
|
|
@@ -56,8 +55,8 @@ export interface MonthsGridFoundationProps extends MonthsGridElementProps {
|
|
|
56
55
|
triggerRender?: (props: Record<string, any>) => any;
|
|
57
56
|
insetInput: boolean;
|
|
58
57
|
presetPosition?: PresetPosition;
|
|
59
|
-
renderQuickControls?:
|
|
60
|
-
renderDateInput?:
|
|
58
|
+
renderQuickControls?: any;
|
|
59
|
+
renderDateInput?: any;
|
|
61
60
|
}
|
|
62
61
|
export interface MonthInfo {
|
|
63
62
|
pickerDate: Date;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { PresetPosition } from './foundation';
|
|
4
3
|
export interface YearAndMonthFoundationProps {
|
|
@@ -17,8 +16,8 @@ export interface YearAndMonthFoundationProps {
|
|
|
17
16
|
disabledDate?: (date: Date) => boolean;
|
|
18
17
|
density?: string;
|
|
19
18
|
presetPosition?: PresetPosition;
|
|
20
|
-
renderQuickControls?:
|
|
21
|
-
renderDateInput?:
|
|
19
|
+
renderQuickControls?: any;
|
|
20
|
+
renderDateInput?: any;
|
|
22
21
|
}
|
|
23
22
|
export interface YearAndMonthFoundationState {
|
|
24
23
|
years: Array<{
|
package/lib/es/form/form.css
CHANGED
|
@@ -35,6 +35,14 @@
|
|
|
35
35
|
display: flex;
|
|
36
36
|
justify-content: flex-start;
|
|
37
37
|
}
|
|
38
|
+
.semi-form-vertical .semi-form-field-group .semi-form-col-right {
|
|
39
|
+
display: flex;
|
|
40
|
+
justify-content: flex-end;
|
|
41
|
+
}
|
|
42
|
+
.semi-form-vertical .semi-form-field-group .semi-form-col-left {
|
|
43
|
+
display: flex;
|
|
44
|
+
justify-content: flex-start;
|
|
45
|
+
}
|
|
38
46
|
.semi-form-field-label {
|
|
39
47
|
box-sizing: border-box;
|
|
40
48
|
padding-right: 16px;
|
package/lib/es/form/form.scss
CHANGED
|
@@ -66,6 +66,20 @@ $rating: #{$prefix}-rating;
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
.#{$field}-group {
|
|
71
|
+
.#{$col} {
|
|
72
|
+
&-right {
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: flex-end;
|
|
75
|
+
}
|
|
76
|
+
&-left {
|
|
77
|
+
display: flex;
|
|
78
|
+
justify-content: flex-start;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
69
83
|
.#{$field}-pure {
|
|
70
84
|
// padding-top: 0;
|
|
71
85
|
// padding-bottom: 0;
|
package/lib/es/image/image.css
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
.semi-image-img {
|
|
11
11
|
vertical-align: middle;
|
|
12
12
|
border-radius: inherit;
|
|
13
|
+
user-select: none;
|
|
13
14
|
}
|
|
14
15
|
.semi-image-img-preview {
|
|
15
16
|
cursor: zoom-in;
|
|
@@ -120,6 +121,7 @@
|
|
|
120
121
|
transform: translateX(-50%);
|
|
121
122
|
}
|
|
122
123
|
.semi-image-preview-footer-page {
|
|
124
|
+
user-select: none;
|
|
123
125
|
color: var(--semi-color-white);
|
|
124
126
|
font-size: 16px;
|
|
125
127
|
line-height: 22px;
|
|
@@ -168,6 +170,7 @@
|
|
|
168
170
|
transform: scale3d(1, 1, 1) var(--semi-transform-rotate-none);
|
|
169
171
|
transition: transform 0.3s 0s;
|
|
170
172
|
z-index: 0;
|
|
173
|
+
user-select: none;
|
|
171
174
|
}
|
|
172
175
|
.semi-image-preview-image-spin {
|
|
173
176
|
position: absolute;
|
package/lib/es/image/image.scss
CHANGED
|
@@ -13,6 +13,7 @@ $module: #{$prefix}-image;
|
|
|
13
13
|
&-img {
|
|
14
14
|
vertical-align: middle;
|
|
15
15
|
border-radius: inherit;
|
|
16
|
+
user-select: none;
|
|
16
17
|
|
|
17
18
|
&-preview {
|
|
18
19
|
cursor: zoom-in;
|
|
@@ -135,6 +136,7 @@ $module: #{$prefix}-image;
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
&-page {
|
|
139
|
+
user-select: none;
|
|
138
140
|
color: $color-image_preview_footer_icon;
|
|
139
141
|
@include font-size-header-6;
|
|
140
142
|
margin: $spacing-image_preview_footer_page-marginY $spacing-image_preview_footer_page-marginX;
|
|
@@ -192,6 +194,7 @@ $module: #{$prefix}-image;
|
|
|
192
194
|
transform: scale3d($transform_scale3d-image_preview_image_img) $transform_rotate-image_preview_image_img;
|
|
193
195
|
transition: transform $transition_duration-image_preview_image_img $transition_delay-image_preview_image_img;
|
|
194
196
|
z-index: 0;
|
|
197
|
+
user-select: none;
|
|
195
198
|
}
|
|
196
199
|
|
|
197
200
|
&-spin {
|
|
@@ -288,13 +288,8 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
288
288
|
const {
|
|
289
289
|
offset,
|
|
290
290
|
width,
|
|
291
|
-
height
|
|
292
|
-
left,
|
|
293
|
-
top
|
|
291
|
+
height
|
|
294
292
|
} = this.getStates();
|
|
295
|
-
const {
|
|
296
|
-
rotation
|
|
297
|
-
} = this.getProps();
|
|
298
293
|
|
|
299
294
|
const startMouseMove = this._adapter.getMouseMove();
|
|
300
295
|
|
|
@@ -307,15 +302,21 @@ export default class PreviewImageFoundation extends BaseFoundation {
|
|
|
307
302
|
|
|
308
303
|
if (startMouseMove && (canDragVertical || canDragHorizontal)) {
|
|
309
304
|
const {
|
|
310
|
-
|
|
311
|
-
|
|
305
|
+
clientX,
|
|
306
|
+
clientY
|
|
312
307
|
} = e;
|
|
308
|
+
|
|
309
|
+
const {
|
|
310
|
+
left: containerLeft,
|
|
311
|
+
top: containerTop
|
|
312
|
+
} = this._getContainerBounds();
|
|
313
|
+
|
|
313
314
|
const {
|
|
314
315
|
left: extremeLeft,
|
|
315
316
|
top: extremeTop
|
|
316
317
|
} = this.calcExtremeBounds();
|
|
317
|
-
let newX = canDragHorizontal ?
|
|
318
|
-
let newY = canDragVertical ?
|
|
318
|
+
let newX = canDragHorizontal ? clientX - containerLeft - startMouseOffset.x : offset.x;
|
|
319
|
+
let newY = canDragVertical ? clientY - containerTop - startMouseOffset.y : offset.y;
|
|
319
320
|
|
|
320
321
|
if (canDragHorizontal) {
|
|
321
322
|
newX = newX > 0 ? 0 : newX < extremeLeft ? extremeLeft : newX;
|
|
@@ -59,9 +59,13 @@ export default class PreviewInnerFoundation extends BaseFoundation {
|
|
|
59
59
|
const {
|
|
60
60
|
x,
|
|
61
61
|
y
|
|
62
|
-
} = this._adapter.getStartMouseDown();
|
|
62
|
+
} = this._adapter.getStartMouseDown(); // 对鼠标移动做容错处理,当 x 和 y 方向在 mouseUp 的时候移动距离都小于等于 5px 时候就可以关闭预览
|
|
63
|
+
// Error-tolerant processing of mouse movement, when the movement distance in the x and y directions is less than or equal to 5px in mouseUp, the preview can be closed
|
|
64
|
+
// 不做容错处理的话,直接用 clientX !== x || y !== clientY 做判断,鼠标在用户点击时候无意识的轻微移动无法关闭预览,不符合用户预期
|
|
65
|
+
// If you do not do fault-tolerant processing, but directly use clientX !== x || y !== clientY to make judgments, the slight movement of the mouse when the user clicks will not be able to close the preview, which does not meet the user's expectations.
|
|
63
66
|
|
|
64
|
-
|
|
67
|
+
|
|
68
|
+
if (Math.abs(clientX - x) > 5 || Math.abs(y - clientY) > 5) {
|
|
65
69
|
couldClose = false;
|
|
66
70
|
}
|
|
67
71
|
|
package/lib/es/image/utils.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const isTargetEmit = (event, targetClasses) => {
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const isTarget =
|
|
2
|
+
// event.path usage is discouraged, use event.composedPath() as it's standard and is more future-proof
|
|
3
|
+
// path is the event-triggered bubbling path, which stores each node through which bubbling passes.
|
|
4
|
+
// path.length-4 is to remove elements above the root node, such as body, html, document, window
|
|
5
|
+
const path = event === null || event === void 0 ? void 0 : event.composedPath();
|
|
6
|
+
const isTarget = path === null || path === void 0 ? void 0 : path.slice(0, path.length - 4).some(node => {
|
|
7
7
|
if (node.className && typeof node.className === "string") {
|
|
8
8
|
return targetClasses.some(c => node.className.includes(c));
|
|
9
9
|
}
|
|
@@ -45,3 +45,6 @@ $color-image_header_close-bg: rgba(0, 0, 0, 0.75); //图像预览header的关闭
|
|
|
45
45
|
$color-image_preview_footer-bg: rgba(0, 0, 0, 0.75); // 图像预览footer部分背景色
|
|
46
46
|
$color-image-preview_divider-bg: rgba(255, 255, 255, .5); // 图像预览footer中的分割线背景色
|
|
47
47
|
$color-image_preview_image_spin: #ccc; // 图像预览的加载状态颜色
|
|
48
|
+
|
|
49
|
+
$z-image_preview: 1070 !default; // Image 组件预览层z-index
|
|
50
|
+
$z-image_preview_header: 1 !default; // Image 组件预览层中 header 部分 z-index
|
|
@@ -74,7 +74,6 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
|
|
|
74
74
|
* @param {*} itemKeysMap
|
|
75
75
|
*/
|
|
76
76
|
getWillOpenKeys(itemKeysMap: ItemKey2ParentKeysMap): any[];
|
|
77
|
-
getItemKey(item: string | number, keyPropName?: string): string | number;
|
|
78
77
|
getShouldOpenKeys(itemKeysMap?: ItemKey2ParentKeysMap, selectedKeys?: string | number[]): unknown[];
|
|
79
78
|
destroy(): void;
|
|
80
79
|
selectLevelZeroParentKeys(itemKeysMap: ItemKey2ParentKeysMap, ...itemKeys: (string | number)[]): any[];
|
|
@@ -173,16 +173,6 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
173
173
|
return [...willOpenKeys];
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
getItemKey(item) {
|
|
177
|
-
let keyPropName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'itemKey';
|
|
178
|
-
|
|
179
|
-
if (item && typeof item === 'object') {
|
|
180
|
-
return item[keyPropName];
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return item;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
176
|
getShouldOpenKeys() {
|
|
187
177
|
let itemKeysMap = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
188
178
|
let selectedKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -191,7 +181,7 @@ export default class NavigationFoundation extends BaseFoundation {
|
|
|
191
181
|
if (Array.isArray(selectedKeys) && selectedKeys.length) {
|
|
192
182
|
selectedKeys.forEach(item => {
|
|
193
183
|
if (item) {
|
|
194
|
-
const parentKeys = _get(itemKeysMap,
|
|
184
|
+
const parentKeys = _get(itemKeysMap, item);
|
|
195
185
|
|
|
196
186
|
if (Array.isArray(parentKeys)) {
|
|
197
187
|
parentKeys.forEach(k => willOpenKeySet.add(k));
|
package/navigation/foundation.ts
CHANGED
|
@@ -181,20 +181,13 @@ export default class NavigationFoundation<P = Record<string, any>, S = Record<st
|
|
|
181
181
|
return [...willOpenKeys];
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
if (item && typeof item === 'object') {
|
|
186
|
-
return item[keyPropName];
|
|
187
|
-
}
|
|
188
|
-
return item;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
getShouldOpenKeys(itemKeysMap: ItemKey2ParentKeysMap = {}, selectedKeys: string | number[] = []) {
|
|
184
|
+
getShouldOpenKeys(itemKeysMap: ItemKey2ParentKeysMap = {}, selectedKeys: string | number[]= []) {
|
|
192
185
|
const willOpenKeySet = new Set();
|
|
193
186
|
|
|
194
187
|
if (Array.isArray(selectedKeys) && selectedKeys.length) {
|
|
195
188
|
selectedKeys.forEach(item => {
|
|
196
189
|
if (item) {
|
|
197
|
-
const parentKeys = get(itemKeysMap,
|
|
190
|
+
const parentKeys = get(itemKeysMap, item);
|
|
198
191
|
|
|
199
192
|
if (Array.isArray(parentKeys)) {
|
|
200
193
|
parentKeys.forEach(k => willOpenKeySet.add(k));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "9f1920d30dcfaf74678976cf9fa16e2ed4bfc226",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/tree/treeUtil.ts
CHANGED
|
@@ -314,7 +314,7 @@ export function calcCheckedKeys(values: any, keyEntities: KeyEntities) {
|
|
|
314
314
|
let halfCheckedKeys = new Set([]);
|
|
315
315
|
let visited: any[] = [];
|
|
316
316
|
|
|
317
|
-
const levelMap = getSortedKeyList(keyList, keyEntities);
|
|
317
|
+
const levelMap:{[key: number]: string[]} = getSortedKeyList(keyList, keyEntities);
|
|
318
318
|
|
|
319
319
|
const calcCurrLevel = (node: any) => {
|
|
320
320
|
const { key, parent, level } = node;
|