@douyinfe/semi-foundation 2.41.2 → 2.42.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.
Files changed (65) hide show
  1. package/button/splitButtonGroup.scss +10 -9
  2. package/form/constants.ts +2 -1
  3. package/form/utils.ts +37 -12
  4. package/lib/cjs/button/button.css +2 -2
  5. package/lib/cjs/button/splitButtonGroup.scss +10 -9
  6. package/lib/cjs/form/constants.d.ts +1 -0
  7. package/lib/cjs/form/constants.js +2 -1
  8. package/lib/cjs/form/utils.d.ts +10 -1
  9. package/lib/cjs/form/utils.js +36 -11
  10. package/lib/cjs/select/select.css +1 -0
  11. package/lib/cjs/select/select.scss +1 -0
  12. package/lib/cjs/toast/animation.scss +3 -0
  13. package/lib/cjs/toast/toast.css +18 -2
  14. package/lib/cjs/toast/toast.scss +25 -2
  15. package/lib/cjs/toast/toastFoundation.d.ts +1 -0
  16. package/lib/cjs/toast/toastListFoundation.d.ts +5 -0
  17. package/lib/cjs/toast/toastListFoundation.js +6 -0
  18. package/lib/cjs/toast/variables.scss +2 -0
  19. package/lib/cjs/tooltip/constants.d.ts +1 -1
  20. package/lib/cjs/tooltip/constants.js +1 -1
  21. package/lib/cjs/tooltip/foundation.d.ts +1 -0
  22. package/lib/cjs/tooltip/foundation.js +8 -1
  23. package/lib/cjs/tree/tree.css +1 -3
  24. package/lib/cjs/tree/tree.scss +3 -7
  25. package/lib/cjs/upload/fileCardFoundation.d.ts +9 -0
  26. package/lib/cjs/upload/fileCardFoundation.js +18 -0
  27. package/lib/cjs/upload/upload.css +6 -0
  28. package/lib/cjs/upload/upload.scss +7 -0
  29. package/lib/es/button/button.css +2 -2
  30. package/lib/es/button/splitButtonGroup.scss +10 -9
  31. package/lib/es/form/constants.d.ts +1 -0
  32. package/lib/es/form/constants.js +2 -1
  33. package/lib/es/form/utils.d.ts +10 -1
  34. package/lib/es/form/utils.js +34 -11
  35. package/lib/es/select/select.css +1 -0
  36. package/lib/es/select/select.scss +1 -0
  37. package/lib/es/toast/animation.scss +3 -0
  38. package/lib/es/toast/toast.css +18 -2
  39. package/lib/es/toast/toast.scss +25 -2
  40. package/lib/es/toast/toastFoundation.d.ts +1 -0
  41. package/lib/es/toast/toastListFoundation.d.ts +5 -0
  42. package/lib/es/toast/toastListFoundation.js +6 -0
  43. package/lib/es/toast/variables.scss +2 -0
  44. package/lib/es/tooltip/constants.d.ts +1 -1
  45. package/lib/es/tooltip/constants.js +1 -1
  46. package/lib/es/tooltip/foundation.d.ts +1 -0
  47. package/lib/es/tooltip/foundation.js +8 -1
  48. package/lib/es/tree/tree.css +1 -3
  49. package/lib/es/tree/tree.scss +3 -7
  50. package/lib/es/upload/fileCardFoundation.d.ts +9 -0
  51. package/lib/es/upload/fileCardFoundation.js +10 -0
  52. package/lib/es/upload/upload.css +6 -0
  53. package/lib/es/upload/upload.scss +7 -0
  54. package/package.json +3 -3
  55. package/select/select.scss +1 -0
  56. package/toast/animation.scss +3 -0
  57. package/toast/toast.scss +25 -2
  58. package/toast/toastFoundation.ts +2 -1
  59. package/toast/toastListFoundation.ts +13 -2
  60. package/toast/variables.scss +2 -0
  61. package/tooltip/constants.ts +1 -1
  62. package/tooltip/foundation.ts +10 -2
  63. package/tree/tree.scss +3 -7
  64. package/upload/fileCardFoundation.ts +17 -0
  65. package/upload/upload.scss +7 -0
@@ -10,19 +10,20 @@ $icon: #{$module}-with-icon;
10
10
  .#{$module} {
11
11
  border-radius: 0;
12
12
  margin-right: 1px;
13
- }
14
13
 
15
- :first-child {
16
- border-top-left-radius: var(--semi-border-radius-small);
17
- border-bottom-left-radius: var(--semi-border-radius-small);
18
- }
14
+ &-first {
15
+ border-top-left-radius: var(--semi-border-radius-small);
16
+ border-bottom-left-radius: var(--semi-border-radius-small);
17
+ }
19
18
 
20
- :last-child {
21
- border-top-right-radius: var(--semi-border-radius-small);
22
- border-bottom-right-radius: var(--semi-border-radius-small);
23
- margin-right: unset;
19
+ &-last {
20
+ border-top-right-radius: var(--semi-border-radius-small);
21
+ border-bottom-right-radius: var(--semi-border-radius-small);
22
+ margin-right: unset;
23
+ }
24
24
  }
25
25
 
26
+
26
27
  &:hover {
27
28
  // 因为上面那条规则,导致原来的active被覆盖
28
29
  .#{$module}-borderless:active {
package/form/constants.ts CHANGED
@@ -8,7 +8,8 @@ const strings = {
8
8
  LAYOUT: ['horizontal', 'vertical'],
9
9
  LABEL_POS: ['left', 'top', 'inset'],
10
10
  LABEL_ALIGN: ['left', 'right'],
11
- EXTRA_POS: ['middle', 'bottom']
11
+ EXTRA_POS: ['middle', 'bottom'],
12
+ DEFAULT_TRIGGER: 'change',
12
13
  };
13
14
 
14
15
  const numbers = {};
package/form/utils.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import AsyncValidator from 'async-validator';
2
- import { cloneDeep, toPath } from 'lodash';
2
+ import { cloneDeep, toPath, isUndefined } from 'lodash';
3
3
  import { FieldValidateTriggerType, BasicTriggerType, ComponentProps, WithFieldOption } from './interface';
4
+ import { strings } from './constants';
4
5
 
5
6
  /**
6
7
  *
@@ -50,17 +51,43 @@ export function isValid(errors: any): boolean {
50
51
  return valid;
51
52
  }
52
53
 
53
- // Compatible with String and Array
54
- function transformTrigger(trigger: FieldValidateTriggerType): Array<BasicTriggerType> {
55
- let result: BasicTriggerType[] = [];
56
- if (Array.isArray(trigger)) {
57
- result = trigger;
54
+ /**
55
+ * trigger transform rule
56
+ 1. If the user has set fieldProps, follow the user's fieldProps
57
+ 2. If the user does not set fieldProps, follow formProps
58
+ 3. If there is no formProps, follow the change
59
+ 4. If it is an array, follow the array, if it is not an array (pure string), convert it to a string array
60
+ */
61
+
62
+ export function transformTrigger(fieldTrigger: FieldValidateTriggerType, formTrigger: FieldValidateTriggerType): Array<BasicTriggerType> {
63
+ let result: BasicTriggerType[] | FieldValidateTriggerType = [];
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 as BasicTriggerType;
71
+ }
72
+
73
+ if (Array.isArray(result)) {
74
+ finalResult = result;
58
75
  }
59
76
 
60
- if (typeof trigger === 'string') {
61
- result[0] = trigger;
77
+ if (typeof result === 'string') {
78
+ finalResult[0] = result;
79
+ }
80
+ return finalResult;
81
+ }
82
+
83
+ export function transformDefaultBooleanAPI(fieldProp: boolean, formProp: boolean, defaultVal = false) {
84
+ if (!isUndefined(fieldProp)) {
85
+ return fieldProp;
86
+ } else if (!isUndefined(formProp)) {
87
+ return formProp;
88
+ } else {
89
+ return defaultVal;
62
90
  }
63
- return result;
64
91
  }
65
92
 
66
93
  export function mergeOptions(opts: WithFieldOption, props: ComponentProps) {
@@ -85,7 +112,6 @@ export function mergeOptions(opts: WithFieldOption, props: ComponentProps) {
85
112
 
86
113
  export function mergeProps(props: any) {
87
114
  const defaultProps = {
88
- trigger: 'change',
89
115
  // validateStatus: 'default',
90
116
  allowEmptyString: false,
91
117
  allowEmpty: false,
@@ -93,7 +119,6 @@ export function mergeProps(props: any) {
93
119
  noLabel: false,
94
120
  noErrorMessage: false,
95
121
  isInInputGroup: false,
96
- stopValidateWithError: false,
97
122
  };
98
123
  let {
99
124
  field,
@@ -151,7 +176,7 @@ export function mergeProps(props: any) {
151
176
  }
152
177
 
153
178
  const required = isRequired(rules);
154
- trigger = transformTrigger(trigger);
179
+
155
180
  emptyValue = typeof emptyValue !== 'undefined' ? emptyValue : '';
156
181
  return {
157
182
  field,
@@ -8,11 +8,11 @@
8
8
  border-radius: 0;
9
9
  margin-right: 1px;
10
10
  }
11
- .semi-button-split :first-child {
11
+ .semi-button-split .semi-button-first {
12
12
  border-top-left-radius: var(--semi-border-radius-small);
13
13
  border-bottom-left-radius: var(--semi-border-radius-small);
14
14
  }
15
- .semi-button-split :last-child {
15
+ .semi-button-split .semi-button-last {
16
16
  border-top-right-radius: var(--semi-border-radius-small);
17
17
  border-bottom-right-radius: var(--semi-border-radius-small);
18
18
  margin-right: unset;
@@ -10,19 +10,20 @@ $icon: #{$module}-with-icon;
10
10
  .#{$module} {
11
11
  border-radius: 0;
12
12
  margin-right: 1px;
13
- }
14
13
 
15
- :first-child {
16
- border-top-left-radius: var(--semi-border-radius-small);
17
- border-bottom-left-radius: var(--semi-border-radius-small);
18
- }
14
+ &-first {
15
+ border-top-left-radius: var(--semi-border-radius-small);
16
+ border-bottom-left-radius: var(--semi-border-radius-small);
17
+ }
19
18
 
20
- :last-child {
21
- border-top-right-radius: var(--semi-border-radius-small);
22
- border-bottom-right-radius: var(--semi-border-radius-small);
23
- margin-right: unset;
19
+ &-last {
20
+ border-top-right-radius: var(--semi-border-radius-small);
21
+ border-bottom-right-radius: var(--semi-border-radius-small);
22
+ margin-right: unset;
23
+ }
24
24
  }
25
25
 
26
+
26
27
  &:hover {
27
28
  // 因为上面那条规则,导致原来的active被覆盖
28
29
  .#{$module}-borderless:active {
@@ -6,6 +6,7 @@ declare const strings: {
6
6
  LABEL_POS: string[];
7
7
  LABEL_ALIGN: string[];
8
8
  EXTRA_POS: string[];
9
+ DEFAULT_TRIGGER: string;
9
10
  };
10
11
  declare const numbers: {};
11
12
  export { cssClasses, strings, numbers };
@@ -13,7 +13,8 @@ const strings = {
13
13
  LAYOUT: ['horizontal', 'vertical'],
14
14
  LABEL_POS: ['left', 'top', 'inset'],
15
15
  LABEL_ALIGN: ['left', 'right'],
16
- EXTRA_POS: ['middle', 'bottom']
16
+ EXTRA_POS: ['middle', 'bottom'],
17
+ DEFAULT_TRIGGER: 'change'
17
18
  };
18
19
  exports.strings = strings;
19
20
  const numbers = {};
@@ -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;
@@ -9,8 +9,12 @@ exports.isRequired = isRequired;
9
9
  exports.isValid = isValid;
10
10
  exports.mergeOptions = mergeOptions;
11
11
  exports.mergeProps = mergeProps;
12
+ exports.transformDefaultBooleanAPI = transformDefaultBooleanAPI;
13
+ exports.transformTrigger = transformTrigger;
14
+ var _isUndefined2 = _interopRequireDefault(require("lodash/isUndefined"));
12
15
  var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
13
16
  var _asyncValidator = _interopRequireDefault(require("async-validator"));
17
+ var _constants = require("./constants");
14
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
19
  var __rest = void 0 && (void 0).__rest || function (s, e) {
16
20
  var t = {};
@@ -62,16 +66,40 @@ function isValid(errors) {
62
66
  }
63
67
  return valid;
64
68
  }
65
- // Compatible with String and Array
66
- function transformTrigger(trigger) {
69
+ /**
70
+ * trigger transform rule
71
+ 1. If the user has set fieldProps, follow the user's fieldProps
72
+ 2. If the user does not set fieldProps, follow formProps
73
+ 3. If there is no formProps, follow the change
74
+ 4. If it is an array, follow the array, if it is not an array (pure string), convert it to a string array
75
+ */
76
+ function transformTrigger(fieldTrigger, formTrigger) {
67
77
  let result = [];
68
- if (Array.isArray(trigger)) {
69
- result = trigger;
78
+ let finalResult = [];
79
+ if (!(0, _isUndefined2.default)(fieldTrigger)) {
80
+ result = fieldTrigger;
81
+ } else if (!(0, _isUndefined2.default)(formTrigger)) {
82
+ result = formTrigger;
83
+ } else {
84
+ result = _constants.strings.DEFAULT_TRIGGER;
85
+ }
86
+ if (Array.isArray(result)) {
87
+ finalResult = result;
70
88
  }
71
- if (typeof trigger === 'string') {
72
- result[0] = trigger;
89
+ if (typeof result === 'string') {
90
+ finalResult[0] = result;
91
+ }
92
+ return finalResult;
93
+ }
94
+ function transformDefaultBooleanAPI(fieldProp, formProp) {
95
+ let defaultVal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
96
+ if (!(0, _isUndefined2.default)(fieldProp)) {
97
+ return fieldProp;
98
+ } else if (!(0, _isUndefined2.default)(formProp)) {
99
+ return formProp;
100
+ } else {
101
+ return defaultVal;
73
102
  }
74
- return result;
75
103
  }
76
104
  function mergeOptions(opts, props) {
77
105
  // 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
@@ -95,15 +123,13 @@ function mergeOptions(opts, props) {
95
123
  }
96
124
  function mergeProps(props) {
97
125
  const defaultProps = {
98
- trigger: 'change',
99
126
  // validateStatus: 'default',
100
127
  allowEmptyString: false,
101
128
  allowEmpty: false,
102
129
  emptyValue: '',
103
130
  noLabel: false,
104
131
  noErrorMessage: false,
105
- isInInputGroup: false,
106
- stopValidateWithError: false
132
+ isInInputGroup: false
107
133
  };
108
134
  let _a = Object.assign(Object.assign({}, defaultProps), props),
109
135
  {
@@ -158,7 +184,6 @@ function mergeProps(props) {
158
184
  initValue = (0, _cloneDeep2.default)(initValue);
159
185
  }
160
186
  const required = isRequired(rules);
161
- trigger = transformTrigger(trigger);
162
187
  emptyValue = typeof emptyValue !== 'undefined' ? emptyValue : '';
163
188
  return {
164
189
  field,
@@ -436,6 +436,7 @@
436
436
  padding-bottom: 8px;
437
437
  cursor: not-allowed;
438
438
  height: 20px;
439
+ box-sizing: content-box;
439
440
  }
440
441
 
441
442
  .semi-select-borderless:not(:focus-within):not(:hover) {
@@ -470,6 +470,7 @@ $overflowList: #{$prefix}-overflow-list;
470
470
  cursor: not-allowed;
471
471
  // make sure that spin align vertical, no need to make 20px as a spacing token here
472
472
  height: 20px;
473
+ box-sizing: content-box;
473
474
  }
474
475
 
475
476
 
@@ -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)
@@ -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
- text-align: center;
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);
@@ -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
- text-align: center;
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;
@@ -23,6 +23,7 @@ export interface ToastProps extends ConfigProps {
23
23
  theme?: ToastTheme;
24
24
  direction?: Directions;
25
25
  close?: (id: string) => void;
26
+ stack?: boolean;
26
27
  }
27
28
  export interface ToastInstance extends ToastProps {
28
29
  id?: string;
@@ -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;
@@ -9,6 +9,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
9
9
  class ToastListFoundation extends _foundation.default {
10
10
  constructor(adapter) {
11
11
  super(Object.assign(Object.assign({}, ToastListFoundation.defaultAdapter), adapter));
12
+ this.handleMouseInSideChange = mouseInSideChange => {
13
+ this._adapter.handleMouseInSideChange(mouseInSideChange);
14
+ };
15
+ this.getInputWrapperRect = () => {
16
+ return this._adapter.getInputWrapperRect();
17
+ };
12
18
  }
13
19
  hasToast(id) {
14
20
  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
  };
@@ -11,7 +11,7 @@ const cssClasses = {
11
11
  exports.cssClasses = cssClasses;
12
12
  const strings = {
13
13
  POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver', 'leftBottomOver', 'rightBottomOver'],
14
- TRIGGER_SET: ['hover', 'focus', 'click', 'custom'],
14
+ TRIGGER_SET: ['hover', 'focus', 'click', 'custom', 'contextMenu'],
15
15
  STATUS_DISABLED: 'disabled',
16
16
  STATUS_LOADING: 'loading'
17
17
  };
@@ -26,6 +26,7 @@ export interface TooltipAdapter<P = Record<string, any>, S = Record<string, any>
26
26
  focus: string;
27
27
  blur: string;
28
28
  keydown: string;
29
+ contextMenu: string;
29
30
  };
30
31
  registerTriggerEvent(...args: any[]): void;
31
32
  getTriggerBounding(...args: any[]): DOMRect;
@@ -93,7 +93,7 @@ class Tooltip extends _foundation.default {
93
93
  * Because the handler needs to be bound to the document. If you bind during the constructor phase
94
94
  * When there are multiple container instances in a page, one click triggers the handler of multiple containers
95
95
  */
96
- if (trigger === 'click' || clickTriggerToHide) {
96
+ if (trigger === 'click' || clickTriggerToHide || trigger === 'contextMenu') {
97
97
  this._adapter.registerClickOutsideHandler(this.hide);
98
98
  }
99
99
  this._bindScrollEvent();
@@ -365,6 +365,13 @@ class Tooltip extends _foundation.default {
365
365
  // when trigger type is 'custom', no need to bind eventHandler
366
366
  // show/hide completely depend on props.visible which change by user
367
367
  break;
368
+ case 'contextMenu':
369
+ triggerEventSet[eventNames.contextMenu] = e => {
370
+ e.preventDefault();
371
+ this.show();
372
+ };
373
+ // Click outside needs special treatment, can not be directly tied to the trigger Element, need to be bound to the document
374
+ break;
368
375
  default:
369
376
  break;
370
377
  }
@@ -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
  }
@@ -134,13 +134,9 @@ $module: #{$prefix}-tree;
134
134
  }
135
135
  }
136
136
 
137
- &-highlight,
138
- &-filtered {
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,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _foundation = _interopRequireDefault(require("../base/foundation"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ class FileCardFoundation extends _foundation.default {
10
+ constructor(adapter) {
11
+ super(Object.assign({}, adapter));
12
+ }
13
+ handleImageError(error) {
14
+ this._adapter.updateFallbackPreview(true);
15
+ }
16
+ }
17
+ var _default = FileCardFoundation;
18
+ exports.default = _default;
@@ -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;
@@ -8,11 +8,11 @@
8
8
  border-radius: 0;
9
9
  margin-right: 1px;
10
10
  }
11
- .semi-button-split :first-child {
11
+ .semi-button-split .semi-button-first {
12
12
  border-top-left-radius: var(--semi-border-radius-small);
13
13
  border-bottom-left-radius: var(--semi-border-radius-small);
14
14
  }
15
- .semi-button-split :last-child {
15
+ .semi-button-split .semi-button-last {
16
16
  border-top-right-radius: var(--semi-border-radius-small);
17
17
  border-bottom-right-radius: var(--semi-border-radius-small);
18
18
  margin-right: unset;
@@ -10,19 +10,20 @@ $icon: #{$module}-with-icon;
10
10
  .#{$module} {
11
11
  border-radius: 0;
12
12
  margin-right: 1px;
13
- }
14
13
 
15
- :first-child {
16
- border-top-left-radius: var(--semi-border-radius-small);
17
- border-bottom-left-radius: var(--semi-border-radius-small);
18
- }
14
+ &-first {
15
+ border-top-left-radius: var(--semi-border-radius-small);
16
+ border-bottom-left-radius: var(--semi-border-radius-small);
17
+ }
19
18
 
20
- :last-child {
21
- border-top-right-radius: var(--semi-border-radius-small);
22
- border-bottom-right-radius: var(--semi-border-radius-small);
23
- margin-right: unset;
19
+ &-last {
20
+ border-top-right-radius: var(--semi-border-radius-small);
21
+ border-bottom-right-radius: var(--semi-border-radius-small);
22
+ margin-right: unset;
23
+ }
24
24
  }
25
25
 
26
+
26
27
  &:hover {
27
28
  // 因为上面那条规则,导致原来的active被覆盖
28
29
  .#{$module}-borderless:active {
@@ -6,6 +6,7 @@ declare const strings: {
6
6
  LABEL_POS: string[];
7
7
  LABEL_ALIGN: string[];
8
8
  EXTRA_POS: string[];
9
+ DEFAULT_TRIGGER: string;
9
10
  };
10
11
  declare const numbers: {};
11
12
  export { cssClasses, strings, numbers };