@douyinfe/semi-foundation 2.41.3 → 2.42.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/button/splitButtonGroup.scss +10 -9
- package/datePicker/datePicker.scss +1 -0
- package/form/constants.ts +2 -1
- package/form/utils.ts +37 -12
- package/lib/cjs/button/button.css +2 -2
- package/lib/cjs/button/splitButtonGroup.scss +10 -9
- package/lib/cjs/datePicker/datePicker.css +1 -0
- package/lib/cjs/datePicker/datePicker.scss +1 -0
- package/lib/cjs/form/constants.d.ts +1 -0
- package/lib/cjs/form/constants.js +2 -1
- package/lib/cjs/form/utils.d.ts +10 -1
- package/lib/cjs/form/utils.js +36 -11
- package/lib/cjs/toast/animation.scss +3 -0
- package/lib/cjs/toast/toast.css +18 -2
- package/lib/cjs/toast/toast.scss +25 -2
- package/lib/cjs/toast/toastFoundation.d.ts +1 -0
- package/lib/cjs/toast/toastListFoundation.d.ts +5 -0
- package/lib/cjs/toast/toastListFoundation.js +6 -0
- package/lib/cjs/toast/variables.scss +2 -0
- package/lib/cjs/tooltip/constants.d.ts +1 -1
- package/lib/cjs/tooltip/constants.js +1 -1
- package/lib/cjs/tooltip/foundation.d.ts +1 -0
- package/lib/cjs/tooltip/foundation.js +8 -1
- package/lib/cjs/tree/tree.css +1 -3
- package/lib/cjs/tree/tree.scss +3 -7
- package/lib/cjs/upload/fileCardFoundation.d.ts +9 -0
- package/lib/cjs/upload/fileCardFoundation.js +18 -0
- package/lib/cjs/upload/upload.css +6 -0
- package/lib/cjs/upload/upload.scss +7 -0
- package/lib/es/button/button.css +2 -2
- package/lib/es/button/splitButtonGroup.scss +10 -9
- package/lib/es/datePicker/datePicker.css +1 -0
- package/lib/es/datePicker/datePicker.scss +1 -0
- package/lib/es/form/constants.d.ts +1 -0
- package/lib/es/form/constants.js +2 -1
- package/lib/es/form/utils.d.ts +10 -1
- package/lib/es/form/utils.js +34 -11
- package/lib/es/toast/animation.scss +3 -0
- package/lib/es/toast/toast.css +18 -2
- package/lib/es/toast/toast.scss +25 -2
- package/lib/es/toast/toastFoundation.d.ts +1 -0
- package/lib/es/toast/toastListFoundation.d.ts +5 -0
- package/lib/es/toast/toastListFoundation.js +6 -0
- package/lib/es/toast/variables.scss +2 -0
- package/lib/es/tooltip/constants.d.ts +1 -1
- package/lib/es/tooltip/constants.js +1 -1
- package/lib/es/tooltip/foundation.d.ts +1 -0
- package/lib/es/tooltip/foundation.js +8 -1
- package/lib/es/tree/tree.css +1 -3
- package/lib/es/tree/tree.scss +3 -7
- package/lib/es/upload/fileCardFoundation.d.ts +9 -0
- package/lib/es/upload/fileCardFoundation.js +10 -0
- package/lib/es/upload/upload.css +6 -0
- package/lib/es/upload/upload.scss +7 -0
- package/package.json +3 -3
- package/toast/animation.scss +3 -0
- package/toast/toast.scss +25 -2
- package/toast/toastFoundation.ts +2 -1
- package/toast/toastListFoundation.ts +13 -2
- package/toast/variables.scss +2 -0
- package/tooltip/constants.ts +1 -1
- package/tooltip/foundation.ts +10 -2
- package/tree/tree.scss +3 -7
- package/upload/fileCardFoundation.ts +17 -0
- package/upload/upload.scss +7 -0
|
@@ -718,6 +718,7 @@
|
|
|
718
718
|
font-weight: 600;
|
|
719
719
|
font-size: 14px;
|
|
720
720
|
line-height: 20px;
|
|
721
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
721
722
|
white-space: nowrap;
|
|
722
723
|
color: var(--semi-color-text-2);
|
|
723
724
|
}
|
|
@@ -1072,6 +1072,7 @@ $module-list: #{$prefix}-scrolllist;
|
|
|
1072
1072
|
font-weight: $font-datepicker_range_input_prefix_suffix_clearbtn-fontWeight;
|
|
1073
1073
|
font-size: $font-datepicker_range_input_prefix_suffix_clearbtn-fontSize;
|
|
1074
1074
|
line-height: $font-datepicker_range_input_prefix_suffix_clearbtn-lineHeight;
|
|
1075
|
+
font-family: $font-family-regular;
|
|
1075
1076
|
white-space: nowrap;
|
|
1076
1077
|
color: $color-datepicker_range_input-text-default;
|
|
1077
1078
|
}
|
package/lib/es/form/constants.js
CHANGED
|
@@ -6,7 +6,8 @@ const strings = {
|
|
|
6
6
|
LAYOUT: ['horizontal', 'vertical'],
|
|
7
7
|
LABEL_POS: ['left', 'top', 'inset'],
|
|
8
8
|
LABEL_ALIGN: ['left', 'right'],
|
|
9
|
-
EXTRA_POS: ['middle', 'bottom']
|
|
9
|
+
EXTRA_POS: ['middle', 'bottom'],
|
|
10
|
+
DEFAULT_TRIGGER: 'change'
|
|
10
11
|
};
|
|
11
12
|
const numbers = {};
|
|
12
13
|
export { cssClasses, strings, numbers };
|
package/lib/es/form/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import AsyncValidator from 'async-validator';
|
|
2
|
-
import { ComponentProps, WithFieldOption } from './interface';
|
|
2
|
+
import { FieldValidateTriggerType, BasicTriggerType, ComponentProps, WithFieldOption } from './interface';
|
|
3
3
|
/**
|
|
4
4
|
*
|
|
5
5
|
* @param WrappedComponent React.ComponentType | any
|
|
@@ -8,6 +8,15 @@ export declare function getDisplayName(WrappedComponent: any): string;
|
|
|
8
8
|
export declare function generateValidatesFromRules(field: string, rules?: any[]): AsyncValidator;
|
|
9
9
|
export declare function isRequired(rules?: any[] | Record<string, any>): boolean;
|
|
10
10
|
export declare function isValid(errors: any): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* trigger transform rule
|
|
13
|
+
1. If the user has set fieldProps, follow the user's fieldProps
|
|
14
|
+
2. If the user does not set fieldProps, follow formProps
|
|
15
|
+
3. If there is no formProps, follow the change
|
|
16
|
+
4. If it is an array, follow the array, if it is not an array (pure string), convert it to a string array
|
|
17
|
+
*/
|
|
18
|
+
export declare function transformTrigger(fieldTrigger: FieldValidateTriggerType, formTrigger: FieldValidateTriggerType): Array<BasicTriggerType>;
|
|
19
|
+
export declare function transformDefaultBooleanAPI(fieldProp: boolean, formProp: boolean, defaultVal?: boolean): boolean;
|
|
11
20
|
export declare function mergeOptions(opts: WithFieldOption, props: ComponentProps): {
|
|
12
21
|
options: {
|
|
13
22
|
valueKey: string;
|
package/lib/es/form/utils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _isUndefined from "lodash/isUndefined";
|
|
1
2
|
import _cloneDeep from "lodash/cloneDeep";
|
|
2
3
|
var __rest = this && this.__rest || function (s, e) {
|
|
3
4
|
var t = {};
|
|
@@ -8,6 +9,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
8
9
|
return t;
|
|
9
10
|
};
|
|
10
11
|
import AsyncValidator from 'async-validator';
|
|
12
|
+
import { strings } from './constants';
|
|
11
13
|
/**
|
|
12
14
|
*
|
|
13
15
|
* @param WrappedComponent React.ComponentType | any
|
|
@@ -50,16 +52,40 @@ export function isValid(errors) {
|
|
|
50
52
|
}
|
|
51
53
|
return valid;
|
|
52
54
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
/**
|
|
56
|
+
* trigger transform rule
|
|
57
|
+
1. If the user has set fieldProps, follow the user's fieldProps
|
|
58
|
+
2. If the user does not set fieldProps, follow formProps
|
|
59
|
+
3. If there is no formProps, follow the change
|
|
60
|
+
4. If it is an array, follow the array, if it is not an array (pure string), convert it to a string array
|
|
61
|
+
*/
|
|
62
|
+
export function transformTrigger(fieldTrigger, formTrigger) {
|
|
55
63
|
let result = [];
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
let finalResult = [];
|
|
65
|
+
if (!_isUndefined(fieldTrigger)) {
|
|
66
|
+
result = fieldTrigger;
|
|
67
|
+
} else if (!_isUndefined(formTrigger)) {
|
|
68
|
+
result = formTrigger;
|
|
69
|
+
} else {
|
|
70
|
+
result = strings.DEFAULT_TRIGGER;
|
|
71
|
+
}
|
|
72
|
+
if (Array.isArray(result)) {
|
|
73
|
+
finalResult = result;
|
|
58
74
|
}
|
|
59
|
-
if (typeof
|
|
60
|
-
|
|
75
|
+
if (typeof result === 'string') {
|
|
76
|
+
finalResult[0] = result;
|
|
77
|
+
}
|
|
78
|
+
return finalResult;
|
|
79
|
+
}
|
|
80
|
+
export function transformDefaultBooleanAPI(fieldProp, formProp) {
|
|
81
|
+
let defaultVal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
82
|
+
if (!_isUndefined(fieldProp)) {
|
|
83
|
+
return fieldProp;
|
|
84
|
+
} else if (!_isUndefined(formProp)) {
|
|
85
|
+
return formProp;
|
|
86
|
+
} else {
|
|
87
|
+
return defaultVal;
|
|
61
88
|
}
|
|
62
|
-
return result;
|
|
63
89
|
}
|
|
64
90
|
export function mergeOptions(opts, props) {
|
|
65
91
|
// Opts: different types of component identification value, value change callback function may be inconsistent, used to adapt 1, input, select 2, radio, checkbox 3, switch
|
|
@@ -83,15 +109,13 @@ export function mergeOptions(opts, props) {
|
|
|
83
109
|
}
|
|
84
110
|
export function mergeProps(props) {
|
|
85
111
|
const defaultProps = {
|
|
86
|
-
trigger: 'change',
|
|
87
112
|
// validateStatus: 'default',
|
|
88
113
|
allowEmptyString: false,
|
|
89
114
|
allowEmpty: false,
|
|
90
115
|
emptyValue: '',
|
|
91
116
|
noLabel: false,
|
|
92
117
|
noErrorMessage: false,
|
|
93
|
-
isInInputGroup: false
|
|
94
|
-
stopValidateWithError: false
|
|
118
|
+
isInInputGroup: false
|
|
95
119
|
};
|
|
96
120
|
let _a = Object.assign(Object.assign({}, defaultProps), props),
|
|
97
121
|
{
|
|
@@ -146,7 +170,6 @@ export function mergeProps(props) {
|
|
|
146
170
|
initValue = _cloneDeep(initValue);
|
|
147
171
|
}
|
|
148
172
|
const required = isRequired(rules);
|
|
149
|
-
trigger = transformTrigger(trigger);
|
|
150
173
|
emptyValue = typeof emptyValue !== 'undefined' ? emptyValue : '';
|
|
151
174
|
return {
|
|
152
175
|
field,
|
|
@@ -9,3 +9,6 @@ $animation_opacity-toast-show: 0;
|
|
|
9
9
|
$animation_opacity-toast-hide: 0;
|
|
10
10
|
$animation_transform_translateY-toast-show: -100%;
|
|
11
11
|
$animation_transform_translateY-toast-hide: -100%;
|
|
12
|
+
|
|
13
|
+
$animation_duration-toast-stack: 300ms;
|
|
14
|
+
$animation_function-toast-stack: cubic-bezier(.22,.57,.02,1.2)
|
package/lib/es/toast/toast.css
CHANGED
|
@@ -5,13 +5,29 @@
|
|
|
5
5
|
pointer-events: none;
|
|
6
6
|
}
|
|
7
7
|
.semi-toast-wrapper {
|
|
8
|
-
pointer-events: none;
|
|
9
8
|
position: fixed;
|
|
9
|
+
height: 0;
|
|
10
10
|
top: 0;
|
|
11
11
|
width: 100%;
|
|
12
|
-
|
|
12
|
+
display: flex;
|
|
13
|
+
justify-content: center;
|
|
13
14
|
z-index: 1010;
|
|
14
15
|
}
|
|
16
|
+
.semi-toast-wrapper .semi-toast-innerWrapper {
|
|
17
|
+
width: fit-content;
|
|
18
|
+
height: fit-content;
|
|
19
|
+
}
|
|
20
|
+
.semi-toast-wrapper .semi-toast-innerWrapper-hover .semi-toast-zero-height-wrapper {
|
|
21
|
+
perspective: unset;
|
|
22
|
+
perspective-origin: center center;
|
|
23
|
+
}
|
|
24
|
+
.semi-toast-zero-height-wrapper {
|
|
25
|
+
transition: all 300ms cubic-bezier(0.22, 0.57, 0.02, 1.2);
|
|
26
|
+
perspective-origin: center 280px;
|
|
27
|
+
perspective: 280px;
|
|
28
|
+
height: 0;
|
|
29
|
+
overflow: visible;
|
|
30
|
+
}
|
|
15
31
|
.semi-toast-content {
|
|
16
32
|
pointer-events: all;
|
|
17
33
|
box-shadow: var(--semi-shadow-elevated);
|
package/lib/es/toast/toast.scss
CHANGED
|
@@ -8,14 +8,37 @@ $icon: #{$prefix}-toast-icon;
|
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
|
|
10
10
|
&-wrapper {
|
|
11
|
-
pointer-events: none;
|
|
12
11
|
position: fixed;
|
|
12
|
+
height: 0;
|
|
13
13
|
top: $spacing-toast_wrapper-top;
|
|
14
14
|
width: $width-toast_wrapper;
|
|
15
|
-
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
16
17
|
z-index: $z-toast;
|
|
18
|
+
.#{$module}-innerWrapper{
|
|
19
|
+
width: fit-content;
|
|
20
|
+
height: fit-content;
|
|
21
|
+
&-hover{
|
|
22
|
+
.#{$module}-zero-height-wrapper{
|
|
23
|
+
perspective: unset;
|
|
24
|
+
perspective-origin: center center;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
17
30
|
}
|
|
18
31
|
|
|
32
|
+
|
|
33
|
+
&-zero-height-wrapper{
|
|
34
|
+
transition: all $animation_duration-toast-stack $animation_function-toast-stack;
|
|
35
|
+
perspective-origin: center $spacing-toast-perspective-originY; ;
|
|
36
|
+
perspective: $spacing-toast-perspective;
|
|
37
|
+
height: 0;
|
|
38
|
+
overflow: visible;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
19
42
|
&-content {
|
|
20
43
|
pointer-events: all;
|
|
21
44
|
@include shadow-elevated;
|
|
@@ -6,13 +6,18 @@ export interface ToastListState {
|
|
|
6
6
|
list: ToastInstance[];
|
|
7
7
|
removedItems: ToastInstance[];
|
|
8
8
|
updatedItems: ToastInstance[];
|
|
9
|
+
mouseInSide: boolean;
|
|
9
10
|
}
|
|
10
11
|
export interface ToastListAdapter extends DefaultAdapter<ToastListProps, ToastListState> {
|
|
11
12
|
updateToast: (list: ToastListState['list'], removedItems: ToastListState['removedItems'], updatedItems: ToastListState['updatedItems']) => void;
|
|
13
|
+
handleMouseInSideChange: (mouseInSideChange: boolean) => void;
|
|
14
|
+
getInputWrapperRect: () => DOMRect | null;
|
|
12
15
|
}
|
|
13
16
|
export default class ToastListFoundation extends BaseFoundation<ToastListAdapter> {
|
|
14
17
|
constructor(adapter: ToastListAdapter);
|
|
15
18
|
hasToast(id: string): boolean;
|
|
19
|
+
handleMouseInSideChange: (mouseInSideChange: boolean) => void;
|
|
20
|
+
getInputWrapperRect: () => DOMRect;
|
|
16
21
|
addToast(toastOpts: ToastProps): void;
|
|
17
22
|
updateToast(id: string, toastOpts: ToastProps): void;
|
|
18
23
|
removeToast(id: string): void;
|
|
@@ -2,6 +2,12 @@ import BaseFoundation from '../base/foundation';
|
|
|
2
2
|
export default class ToastListFoundation extends BaseFoundation {
|
|
3
3
|
constructor(adapter) {
|
|
4
4
|
super(Object.assign(Object.assign({}, ToastListFoundation.defaultAdapter), adapter));
|
|
5
|
+
this.handleMouseInSideChange = mouseInSideChange => {
|
|
6
|
+
this._adapter.handleMouseInSideChange(mouseInSideChange);
|
|
7
|
+
};
|
|
8
|
+
this.getInputWrapperRect = () => {
|
|
9
|
+
return this._adapter.getInputWrapperRect();
|
|
10
|
+
};
|
|
5
11
|
}
|
|
6
12
|
hasToast(id) {
|
|
7
13
|
const toastList = this._adapter.getState('list');
|
|
@@ -34,6 +34,8 @@ $spacing-toast_content-margin: $spacing-base-tight; // 通知内容外边距
|
|
|
34
34
|
$spacing-toast_content_close_btn-marginTop: -2px; // 通知关闭按钮顶部外边距
|
|
35
35
|
$spacing-toast_content_text-marginLeft: $spacing-base-tight; // 通知文本左侧外边距
|
|
36
36
|
$spacing-toast_content_text-marginRight: $spacing-base-tight; // 通知文本右侧外边距
|
|
37
|
+
$spacing-toast-perspective-originY: 280px; // 通知透视原点 Y 轴位置
|
|
38
|
+
$spacing-toast-perspective: 280px; // 通知透视距离
|
|
37
39
|
|
|
38
40
|
// Width/Height
|
|
39
41
|
$width-toast_wrapper: 100%; // 通知容器整体宽度
|
|
@@ -3,7 +3,7 @@ declare const cssClasses: {
|
|
|
3
3
|
};
|
|
4
4
|
declare const strings: {
|
|
5
5
|
readonly POSITION_SET: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver", "leftBottomOver", "rightBottomOver"];
|
|
6
|
-
readonly TRIGGER_SET: readonly ["hover", "focus", "click", "custom"];
|
|
6
|
+
readonly TRIGGER_SET: readonly ["hover", "focus", "click", "custom", "contextMenu"];
|
|
7
7
|
readonly STATUS_DISABLED: "disabled";
|
|
8
8
|
readonly STATUS_LOADING: "loading";
|
|
9
9
|
};
|
|
@@ -4,7 +4,7 @@ const cssClasses = {
|
|
|
4
4
|
};
|
|
5
5
|
const strings = {
|
|
6
6
|
POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver', 'leftBottomOver', 'rightBottomOver'],
|
|
7
|
-
TRIGGER_SET: ['hover', 'focus', 'click', 'custom'],
|
|
7
|
+
TRIGGER_SET: ['hover', 'focus', 'click', 'custom', 'contextMenu'],
|
|
8
8
|
STATUS_DISABLED: 'disabled',
|
|
9
9
|
STATUS_LOADING: 'loading'
|
|
10
10
|
};
|
|
@@ -86,7 +86,7 @@ export default class Tooltip extends BaseFoundation {
|
|
|
86
86
|
* Because the handler needs to be bound to the document. If you bind during the constructor phase
|
|
87
87
|
* When there are multiple container instances in a page, one click triggers the handler of multiple containers
|
|
88
88
|
*/
|
|
89
|
-
if (trigger === 'click' || clickTriggerToHide) {
|
|
89
|
+
if (trigger === 'click' || clickTriggerToHide || trigger === 'contextMenu') {
|
|
90
90
|
this._adapter.registerClickOutsideHandler(this.hide);
|
|
91
91
|
}
|
|
92
92
|
this._bindScrollEvent();
|
|
@@ -358,6 +358,13 @@ export default class Tooltip extends BaseFoundation {
|
|
|
358
358
|
// when trigger type is 'custom', no need to bind eventHandler
|
|
359
359
|
// show/hide completely depend on props.visible which change by user
|
|
360
360
|
break;
|
|
361
|
+
case 'contextMenu':
|
|
362
|
+
triggerEventSet[eventNames.contextMenu] = e => {
|
|
363
|
+
e.preventDefault();
|
|
364
|
+
this.show();
|
|
365
|
+
};
|
|
366
|
+
// Click outside needs special treatment, can not be directly tied to the trigger Element, need to be bound to the document
|
|
367
|
+
break;
|
|
361
368
|
default:
|
|
362
369
|
break;
|
|
363
370
|
}
|
package/lib/es/tree/tree.css
CHANGED
|
@@ -103,9 +103,7 @@
|
|
|
103
103
|
.semi-tree-option-list .semi-tree-option-collapsed .semi-tree-option-expand-icon {
|
|
104
104
|
transform: rotate(270deg);
|
|
105
105
|
}
|
|
106
|
-
.semi-tree-option-list .semi-tree-option-highlight
|
|
107
|
-
.semi-tree-option-list .semi-tree-option-highlight .semi-checkbox-addon, .semi-tree-option-list .semi-tree-option-filtered,
|
|
108
|
-
.semi-tree-option-list .semi-tree-option-filtered .semi-checkbox-addon {
|
|
106
|
+
.semi-tree-option-list .semi-tree-option-highlight {
|
|
109
107
|
font-weight: 600;
|
|
110
108
|
color: var(--semi-color-primary);
|
|
111
109
|
}
|
package/lib/es/tree/tree.scss
CHANGED
|
@@ -134,13 +134,9 @@ $module: #{$prefix}-tree;
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
&-highlight
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
.#{$prefix}-checkbox-addon {
|
|
141
|
-
font-weight: $font-tree_option_hightlight-fontWeight;
|
|
142
|
-
color: $color-tree_option_hightlight-text;
|
|
143
|
-
}
|
|
137
|
+
&-highlight {
|
|
138
|
+
font-weight: $font-tree_option_hightlight-fontWeight;
|
|
139
|
+
color: $color-tree_option_hightlight-text;
|
|
144
140
|
}
|
|
145
141
|
|
|
146
142
|
&-hidden {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
+
export interface FileCardAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
|
+
updateFallbackPreview: (fallback: boolean) => void;
|
|
4
|
+
}
|
|
5
|
+
declare class FileCardFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<FileCardAdapter<P, S>, P, S> {
|
|
6
|
+
constructor(adapter: FileCardAdapter<P, S>);
|
|
7
|
+
handleImageError(error: any): void;
|
|
8
|
+
}
|
|
9
|
+
export default FileCardFoundation;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import BaseFoundation from '../base/foundation';
|
|
2
|
+
class FileCardFoundation extends BaseFoundation {
|
|
3
|
+
constructor(adapter) {
|
|
4
|
+
super(Object.assign({}, adapter));
|
|
5
|
+
}
|
|
6
|
+
handleImageError(error) {
|
|
7
|
+
this._adapter.updateFallbackPreview(true);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export default FileCardFoundation;
|
package/lib/es/upload/upload.css
CHANGED
|
@@ -354,6 +354,12 @@
|
|
|
354
354
|
left: 50%;
|
|
355
355
|
transform: translate3D(-50%, -50%, 0);
|
|
356
356
|
}
|
|
357
|
+
.semi-upload-picture-file-card-preview-fallback {
|
|
358
|
+
background-color: var(--semi-color-fill-0);
|
|
359
|
+
border: 2px var(--semi-color-border);
|
|
360
|
+
color: var(--semi-color-tertiary);
|
|
361
|
+
border-radius: var(--semi-border-radius-small);
|
|
362
|
+
}
|
|
357
363
|
.semi-upload-picture-file-card-pic-info {
|
|
358
364
|
display: inline-flex;
|
|
359
365
|
box-sizing: border-box;
|
|
@@ -425,6 +425,13 @@ $module: #{$prefix}-upload;
|
|
|
425
425
|
transform: translate3D(-50%, -50%, 0);
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
+
&-preview-fallback {
|
|
429
|
+
background-color: $color-upload_pic_add-bg;
|
|
430
|
+
border: $width-upload_picture_add-border $color-upload-border;
|
|
431
|
+
color: $color-upload-icon;
|
|
432
|
+
border-radius: $radius-upload_picture_add;
|
|
433
|
+
}
|
|
434
|
+
|
|
428
435
|
&-pic-info {
|
|
429
436
|
display: inline-flex;
|
|
430
437
|
box-sizing: border-box;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.42.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.
|
|
10
|
+
"@douyinfe/semi-animation": "2.42.0",
|
|
11
11
|
"async-validator": "^3.5.0",
|
|
12
12
|
"classnames": "^2.2.6",
|
|
13
13
|
"date-fns": "^2.29.3",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"*.scss",
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "164a3ae969dc46f390c293f18f073cf737b6dd7e",
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
29
29
|
"@babel/preset-env": "^7.15.8",
|
package/toast/animation.scss
CHANGED
|
@@ -9,3 +9,6 @@ $animation_opacity-toast-show: 0;
|
|
|
9
9
|
$animation_opacity-toast-hide: 0;
|
|
10
10
|
$animation_transform_translateY-toast-show: -100%;
|
|
11
11
|
$animation_transform_translateY-toast-hide: -100%;
|
|
12
|
+
|
|
13
|
+
$animation_duration-toast-stack: 300ms;
|
|
14
|
+
$animation_function-toast-stack: cubic-bezier(.22,.57,.02,1.2)
|
package/toast/toast.scss
CHANGED
|
@@ -8,14 +8,37 @@ $icon: #{$prefix}-toast-icon;
|
|
|
8
8
|
pointer-events: none;
|
|
9
9
|
|
|
10
10
|
&-wrapper {
|
|
11
|
-
pointer-events: none;
|
|
12
11
|
position: fixed;
|
|
12
|
+
height: 0;
|
|
13
13
|
top: $spacing-toast_wrapper-top;
|
|
14
14
|
width: $width-toast_wrapper;
|
|
15
|
-
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
16
17
|
z-index: $z-toast;
|
|
18
|
+
.#{$module}-innerWrapper{
|
|
19
|
+
width: fit-content;
|
|
20
|
+
height: fit-content;
|
|
21
|
+
&-hover{
|
|
22
|
+
.#{$module}-zero-height-wrapper{
|
|
23
|
+
perspective: unset;
|
|
24
|
+
perspective-origin: center center;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
17
30
|
}
|
|
18
31
|
|
|
32
|
+
|
|
33
|
+
&-zero-height-wrapper{
|
|
34
|
+
transition: all $animation_duration-toast-stack $animation_function-toast-stack;
|
|
35
|
+
perspective-origin: center $spacing-toast-perspective-originY; ;
|
|
36
|
+
perspective: $spacing-toast-perspective;
|
|
37
|
+
height: 0;
|
|
38
|
+
overflow: visible;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
19
42
|
&-content {
|
|
20
43
|
pointer-events: all;
|
|
21
44
|
@include shadow-elevated;
|
package/toast/toastFoundation.ts
CHANGED
|
@@ -8,11 +8,14 @@ export interface ToastListProps{
|
|
|
8
8
|
export interface ToastListState{
|
|
9
9
|
list: ToastInstance[];
|
|
10
10
|
removedItems: ToastInstance[];
|
|
11
|
-
updatedItems: ToastInstance[]
|
|
11
|
+
updatedItems: ToastInstance[];
|
|
12
|
+
mouseInSide: boolean
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export interface ToastListAdapter extends DefaultAdapter<ToastListProps, ToastListState>{
|
|
15
|
-
updateToast: (list: ToastListState['list'], removedItems: ToastListState['removedItems'], updatedItems: ToastListState['updatedItems']) => void
|
|
16
|
+
updateToast: (list: ToastListState['list'], removedItems: ToastListState['removedItems'], updatedItems: ToastListState['updatedItems']) => void;
|
|
17
|
+
handleMouseInSideChange: (mouseInSideChange: boolean) => void;
|
|
18
|
+
getInputWrapperRect: () => DOMRect | null
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
export default class ToastListFoundation extends BaseFoundation<ToastListAdapter> {
|
|
@@ -27,6 +30,14 @@ export default class ToastListFoundation extends BaseFoundation<ToastListAdapter
|
|
|
27
30
|
return toastList.map(({ id }) =>id).includes(id);
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
handleMouseInSideChange = (mouseInSideChange: boolean)=>{
|
|
34
|
+
this._adapter.handleMouseInSideChange(mouseInSideChange);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
getInputWrapperRect = () => {
|
|
38
|
+
return this._adapter.getInputWrapperRect();
|
|
39
|
+
}
|
|
40
|
+
|
|
30
41
|
addToast(toastOpts: ToastProps) {
|
|
31
42
|
const toastList = this._adapter.getState('list') as ToastListState['list'];
|
|
32
43
|
// const id = getUuid('toast');
|
package/toast/variables.scss
CHANGED
|
@@ -34,6 +34,8 @@ $spacing-toast_content-margin: $spacing-base-tight; // 通知内容外边距
|
|
|
34
34
|
$spacing-toast_content_close_btn-marginTop: -2px; // 通知关闭按钮顶部外边距
|
|
35
35
|
$spacing-toast_content_text-marginLeft: $spacing-base-tight; // 通知文本左侧外边距
|
|
36
36
|
$spacing-toast_content_text-marginRight: $spacing-base-tight; // 通知文本右侧外边距
|
|
37
|
+
$spacing-toast-perspective-originY: 280px; // 通知透视原点 Y 轴位置
|
|
38
|
+
$spacing-toast-perspective: 280px; // 通知透视距离
|
|
37
39
|
|
|
38
40
|
// Width/Height
|
|
39
41
|
$width-toast_wrapper: 100%; // 通知容器整体宽度
|
package/tooltip/constants.ts
CHANGED
|
@@ -23,7 +23,7 @@ const strings = {
|
|
|
23
23
|
'leftBottomOver',
|
|
24
24
|
'rightBottomOver',
|
|
25
25
|
],
|
|
26
|
-
TRIGGER_SET: ['hover', 'focus', 'click', 'custom'],
|
|
26
|
+
TRIGGER_SET: ['hover', 'focus', 'click', 'custom', 'contextMenu'],
|
|
27
27
|
STATUS_DISABLED: 'disabled',
|
|
28
28
|
STATUS_LOADING: 'loading',
|
|
29
29
|
} as const;
|
package/tooltip/foundation.ts
CHANGED
|
@@ -44,7 +44,8 @@ export interface TooltipAdapter<P = Record<string, any>, S = Record<string, any>
|
|
|
44
44
|
click: string;
|
|
45
45
|
focus: string;
|
|
46
46
|
blur: string;
|
|
47
|
-
keydown: string
|
|
47
|
+
keydown: string;
|
|
48
|
+
contextMenu: string
|
|
48
49
|
};
|
|
49
50
|
registerTriggerEvent(...args: any[]): void;
|
|
50
51
|
getTriggerBounding(...args: any[]): DOMRect;
|
|
@@ -256,6 +257,13 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
256
257
|
// when trigger type is 'custom', no need to bind eventHandler
|
|
257
258
|
// show/hide completely depend on props.visible which change by user
|
|
258
259
|
break;
|
|
260
|
+
case 'contextMenu':
|
|
261
|
+
triggerEventSet[eventNames.contextMenu] = (e) => {
|
|
262
|
+
e.preventDefault();
|
|
263
|
+
this.show();
|
|
264
|
+
};
|
|
265
|
+
// Click outside needs special treatment, can not be directly tied to the trigger Element, need to be bound to the document
|
|
266
|
+
break;
|
|
259
267
|
default:
|
|
260
268
|
break;
|
|
261
269
|
}
|
|
@@ -334,7 +342,7 @@ export default class Tooltip<P = Record<string, any>, S = Record<string, any>> e
|
|
|
334
342
|
* Because the handler needs to be bound to the document. If you bind during the constructor phase
|
|
335
343
|
* When there are multiple container instances in a page, one click triggers the handler of multiple containers
|
|
336
344
|
*/
|
|
337
|
-
if (trigger === 'click' || clickTriggerToHide) {
|
|
345
|
+
if (trigger === 'click' || clickTriggerToHide || trigger === 'contextMenu') {
|
|
338
346
|
this._adapter.registerClickOutsideHandler(this.hide);
|
|
339
347
|
}
|
|
340
348
|
|
package/tree/tree.scss
CHANGED
|
@@ -134,13 +134,9 @@ $module: #{$prefix}-tree;
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
&-highlight
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
.#{$prefix}-checkbox-addon {
|
|
141
|
-
font-weight: $font-tree_option_hightlight-fontWeight;
|
|
142
|
-
color: $color-tree_option_hightlight-text;
|
|
143
|
-
}
|
|
137
|
+
&-highlight {
|
|
138
|
+
font-weight: $font-tree_option_hightlight-fontWeight;
|
|
139
|
+
color: $color-tree_option_hightlight-text;
|
|
144
140
|
}
|
|
145
141
|
|
|
146
142
|
&-hidden {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
+
|
|
3
|
+
export interface FileCardAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
4
|
+
updateFallbackPreview: (fallback: boolean) => void
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
class FileCardFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<FileCardAdapter<P, S>, P, S> {
|
|
8
|
+
constructor(adapter: FileCardAdapter<P, S>) {
|
|
9
|
+
super({ ...adapter });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
handleImageError(error: any) {
|
|
13
|
+
this._adapter.updateFallbackPreview(true);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default FileCardFoundation;
|
package/upload/upload.scss
CHANGED
|
@@ -425,6 +425,13 @@ $module: #{$prefix}-upload;
|
|
|
425
425
|
transform: translate3D(-50%, -50%, 0);
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
+
&-preview-fallback {
|
|
429
|
+
background-color: $color-upload_pic_add-bg;
|
|
430
|
+
border: $width-upload_picture_add-border $color-upload-border;
|
|
431
|
+
color: $color-upload-icon;
|
|
432
|
+
border-radius: $radius-upload_picture_add;
|
|
433
|
+
}
|
|
434
|
+
|
|
428
435
|
&-pic-info {
|
|
429
436
|
display: inline-flex;
|
|
430
437
|
box-sizing: border-box;
|