@douyinfe/semi-foundation 2.0.6 → 2.0.9-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autoComplete/autoComplete.scss +1 -1
- package/datePicker/foundation.ts +1 -1
- package/form/interface.ts +1 -1
- package/form/utils.ts +2 -2
- package/lib/es/autoComplete/autoComplete.css +79 -5
- package/lib/es/autoComplete/autoComplete.scss +1 -1
- package/lib/es/form/interface.d.ts +1 -1
- package/lib/es/form/utils.d.ts +2 -2
- package/lib/es/modal/modalFoundation.d.ts +2 -2
- package/lib/es/modal/modalFoundation.js +2 -2
- package/lib/es/radio/variables.scss +1 -1
- package/lib/es/select/option.css +1 -1
- package/lib/es/select/option.scss +1 -1
- package/lib/es/select/select.css +74 -0
- package/lib/es/select/select.scss +2 -1
- package/lib/es/slider/foundation.d.ts +2 -2
- package/lib/es/slider/foundation.js +9 -4
- package/lib/es/table/table.css +3 -0
- package/lib/es/table/table.scss +8 -0
- package/lib/es/table/utils.d.ts +1 -0
- package/lib/es/table/utils.js +17 -1
- package/lib/es/tabs/foundation.d.ts +1 -0
- package/lib/es/tabs/foundation.js +12 -2
- package/lib/es/tree/treeUtil.d.ts +1 -1
- package/lib/es/upload/constants.d.ts +1 -1
- package/modal/modalFoundation.ts +3 -4
- package/package.json +3 -3
- package/radio/variables.scss +1 -1
- package/select/option.scss +1 -1
- package/select/select.scss +2 -1
- package/slider/foundation.ts +4 -4
- package/table/table.scss +8 -0
- package/table/utils.ts +15 -1
- package/tabs/foundation.ts +9 -2
package/datePicker/foundation.ts
CHANGED
|
@@ -282,7 +282,7 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
|
|
|
282
282
|
if (isValidDate(value)) {
|
|
283
283
|
dateObj = value as Date;
|
|
284
284
|
} else if (isString(value)) {
|
|
285
|
-
dateObj = compatiableParse(value, this.getProp('format'), undefined, dateFnsLocale);
|
|
285
|
+
dateObj = compatiableParse(value as string, this.getProp('format'), undefined, dateFnsLocale);
|
|
286
286
|
} else if (isTimestamp(value)) {
|
|
287
287
|
dateObj = new Date(value);
|
|
288
288
|
} else {
|
package/form/interface.ts
CHANGED
package/form/utils.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
4
4
|
import AsyncValidator from 'async-validator';
|
|
5
5
|
import { cloneDeep, toPath } from 'lodash-es';
|
|
6
|
-
import { FieldValidateTriggerType, BasicTriggerType, ComponentProps,
|
|
6
|
+
import { FieldValidateTriggerType, BasicTriggerType, ComponentProps, WithFieldOption } from './interface';
|
|
7
7
|
|
|
8
8
|
export function getDisplayName(WrappedComponent: React.ComponentType | any) {
|
|
9
9
|
const originName = WrappedComponent.displayName || WrappedComponent.name;
|
|
@@ -61,7 +61,7 @@ function transformTrigger(trigger: FieldValidateTriggerType): Array<BasicTrigger
|
|
|
61
61
|
return result;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export function mergeOptions(opts:
|
|
64
|
+
export function mergeOptions(opts: WithFieldOption, props: ComponentProps) {
|
|
65
65
|
// 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
|
|
66
66
|
// valueKey: input, select class component control value props are value, and checkbox, switch is checked
|
|
67
67
|
// eg:checkbox、radio { valueKey: 'checked', onKeyChangeFnName: 'onChange', valuePath: 'target.value' }
|
|
@@ -1,25 +1,99 @@
|
|
|
1
1
|
/* shadow */
|
|
2
2
|
/* sizing */
|
|
3
3
|
/* spacing */
|
|
4
|
-
.semi-
|
|
4
|
+
.semi-select-option {
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
line-height: 20px;
|
|
7
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
8
|
+
word-break: break-all;
|
|
9
|
+
padding-left: 12px;
|
|
10
|
+
padding-right: 12px;
|
|
11
|
+
padding-top: 8px;
|
|
12
|
+
padding-bottom: 8px;
|
|
13
|
+
color: var(--semi-color-text-0);
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-wrap: nowrap;
|
|
17
|
+
align-items: center;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
.semi-select-option-icon {
|
|
22
|
+
width: 12px;
|
|
23
|
+
color: transparent;
|
|
24
|
+
visibility: hidden;
|
|
25
|
+
margin-right: 8px;
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
align-content: center;
|
|
29
|
+
}
|
|
30
|
+
.semi-select-option-text {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
white-space: pre;
|
|
34
|
+
}
|
|
35
|
+
.semi-select-option-keyword {
|
|
36
|
+
color: var(--semi-color-primary);
|
|
37
|
+
background-color: inherit;
|
|
38
|
+
font-weight: 600;
|
|
39
|
+
}
|
|
40
|
+
.semi-select-option:active {
|
|
41
|
+
background-color: var(--semi-color-fill-1);
|
|
42
|
+
}
|
|
43
|
+
.semi-select-option-empty {
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
color: var(--semi-color-disabled-text);
|
|
46
|
+
justify-content: center;
|
|
47
|
+
}
|
|
48
|
+
.semi-select-option-empty:hover {
|
|
49
|
+
background-color: inherit;
|
|
50
|
+
}
|
|
51
|
+
.semi-select-option-empty:active {
|
|
52
|
+
background-color: inherit;
|
|
53
|
+
}
|
|
54
|
+
.semi-select-option-disabled {
|
|
55
|
+
color: var(--semi-color-disabled-text);
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
}
|
|
58
|
+
.semi-select-option-disabled:hover {
|
|
59
|
+
background-color: var(--semi-color-fill-0);
|
|
60
|
+
}
|
|
61
|
+
.semi-select-option-selected {
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
}
|
|
64
|
+
.semi-select-option-selected .semi-select-option-icon {
|
|
65
|
+
visibility: visible;
|
|
66
|
+
color: var(--semi-color-text-2);
|
|
67
|
+
}
|
|
68
|
+
.semi-select-option-focused {
|
|
69
|
+
background-color: var(--semi-color-fill-0);
|
|
70
|
+
}
|
|
71
|
+
.semi-select-option:first-of-type {
|
|
72
|
+
margin-top: 4px;
|
|
73
|
+
}
|
|
74
|
+
.semi-select-option:last-of-type {
|
|
75
|
+
margin-bottom: 4px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.semi-select {
|
|
5
79
|
cursor: text;
|
|
6
80
|
display: inline-flex;
|
|
7
81
|
vertical-align: middle;
|
|
8
82
|
box-sizing: border-box;
|
|
9
83
|
}
|
|
10
|
-
.semi-
|
|
84
|
+
.semi-select-option-list {
|
|
11
85
|
overflow-x: hidden;
|
|
12
86
|
overflow-y: auto;
|
|
13
87
|
}
|
|
14
|
-
.semi-
|
|
88
|
+
.semi-select-option-list-chosen .semi-select-option-icon {
|
|
15
89
|
display: flex;
|
|
16
90
|
}
|
|
17
|
-
.semi-
|
|
91
|
+
.semi-select-loading-wrapper {
|
|
18
92
|
padding-top: 8px;
|
|
19
93
|
padding-bottom: 8px;
|
|
20
94
|
cursor: not-allowed;
|
|
21
95
|
}
|
|
22
|
-
.semi-
|
|
96
|
+
.semi-select-loading-wrapper .semi-spin {
|
|
23
97
|
width: 100%;
|
|
24
98
|
}
|
|
25
99
|
|
package/lib/es/form/utils.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import AsyncValidator from 'async-validator';
|
|
3
|
-
import { ComponentProps,
|
|
3
|
+
import { ComponentProps, WithFieldOption } from './interface';
|
|
4
4
|
export declare function getDisplayName(WrappedComponent: React.ComponentType | any): string;
|
|
5
5
|
export declare function generateValidatesFromRules(field: string, rules?: any[]): AsyncValidator;
|
|
6
6
|
export declare function isRequired(rules?: any[] | Record<string, any>): boolean;
|
|
7
7
|
export declare function isValid(errors: any): boolean;
|
|
8
|
-
export declare function mergeOptions(opts:
|
|
8
|
+
export declare function mergeOptions(opts: WithFieldOption, props: ComponentProps): {
|
|
9
9
|
options: {
|
|
10
10
|
valueKey: string;
|
|
11
11
|
onKeyChangeFnName: string;
|
|
@@ -8,7 +8,7 @@ export interface ModalAdapter extends DefaultAdapter<ModalProps, ModalState> {
|
|
|
8
8
|
notifyCancel: (e: any) => void;
|
|
9
9
|
notifyOk: (e: any) => void;
|
|
10
10
|
notifyClose: () => void;
|
|
11
|
-
toggleHidden: (hidden: boolean) => void;
|
|
11
|
+
toggleHidden: (hidden: boolean, callback?: (hidden: boolean) => void) => void;
|
|
12
12
|
notifyFullScreen: (isFullScreen: boolean) => void;
|
|
13
13
|
getProps: () => ModalProps;
|
|
14
14
|
}
|
|
@@ -64,5 +64,5 @@ export default class ModalFoundation extends BaseFoundation<ModalAdapter> {
|
|
|
64
64
|
beforeShow(): void;
|
|
65
65
|
afterHide(): void;
|
|
66
66
|
afterClose(): void;
|
|
67
|
-
toggleHidden: (hidden: boolean) => void;
|
|
67
|
+
toggleHidden: (hidden: boolean, callback?: (hidden: boolean) => void) => void;
|
|
68
68
|
}
|
|
@@ -4,8 +4,8 @@ export default class ModalFoundation extends BaseFoundation {
|
|
|
4
4
|
constructor(adapter) {
|
|
5
5
|
super(_Object$assign({}, adapter));
|
|
6
6
|
|
|
7
|
-
this.toggleHidden = hidden => {
|
|
8
|
-
this._adapter.toggleHidden(hidden);
|
|
7
|
+
this.toggleHidden = (hidden, callback) => {
|
|
8
|
+
this._adapter.toggleHidden(hidden, callback);
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -48,7 +48,7 @@ $width-radio_hover-border: $border-thickness-control; // 描边宽度 - 悬浮
|
|
|
48
48
|
$width-radio_disabled-border: $border-thickness-control; // 描边宽度 - 禁用态
|
|
49
49
|
$width-radio_innder-border: $border-thickness-control; // 描边宽度 - 禁用态
|
|
50
50
|
|
|
51
|
-
$height-radio_inner_min:
|
|
51
|
+
$height-radio_inner_min: 20px; // 单选按钮高度
|
|
52
52
|
$width-radio_inner: $width-icon-medium; // 单选按钮宽度
|
|
53
53
|
$spacing-radio_addon-paddingLeft: $spacing-tight; //单选标题到单选按钮左侧边距
|
|
54
54
|
$spacing-radio_addon-marginLeft: $width-radio_inner; //单选标题左侧整体外边距
|
package/lib/es/select/option.css
CHANGED
package/lib/es/select/select.css
CHANGED
|
@@ -1,6 +1,80 @@
|
|
|
1
1
|
/* shadow */
|
|
2
2
|
/* sizing */
|
|
3
3
|
/* spacing */
|
|
4
|
+
.semi-select-option {
|
|
5
|
+
font-size: 14px;
|
|
6
|
+
line-height: 20px;
|
|
7
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
8
|
+
word-break: break-all;
|
|
9
|
+
padding-left: 12px;
|
|
10
|
+
padding-right: 12px;
|
|
11
|
+
padding-top: 8px;
|
|
12
|
+
padding-bottom: 8px;
|
|
13
|
+
color: var(--semi-color-text-0);
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-wrap: nowrap;
|
|
17
|
+
align-items: center;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
.semi-select-option-icon {
|
|
22
|
+
width: 12px;
|
|
23
|
+
color: transparent;
|
|
24
|
+
visibility: hidden;
|
|
25
|
+
margin-right: 8px;
|
|
26
|
+
display: flex;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
align-content: center;
|
|
29
|
+
}
|
|
30
|
+
.semi-select-option-text {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-wrap: wrap;
|
|
33
|
+
white-space: pre;
|
|
34
|
+
}
|
|
35
|
+
.semi-select-option-keyword {
|
|
36
|
+
color: var(--semi-color-primary);
|
|
37
|
+
background-color: inherit;
|
|
38
|
+
font-weight: 600;
|
|
39
|
+
}
|
|
40
|
+
.semi-select-option:active {
|
|
41
|
+
background-color: var(--semi-color-fill-1);
|
|
42
|
+
}
|
|
43
|
+
.semi-select-option-empty {
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
color: var(--semi-color-disabled-text);
|
|
46
|
+
justify-content: center;
|
|
47
|
+
}
|
|
48
|
+
.semi-select-option-empty:hover {
|
|
49
|
+
background-color: inherit;
|
|
50
|
+
}
|
|
51
|
+
.semi-select-option-empty:active {
|
|
52
|
+
background-color: inherit;
|
|
53
|
+
}
|
|
54
|
+
.semi-select-option-disabled {
|
|
55
|
+
color: var(--semi-color-disabled-text);
|
|
56
|
+
cursor: not-allowed;
|
|
57
|
+
}
|
|
58
|
+
.semi-select-option-disabled:hover {
|
|
59
|
+
background-color: var(--semi-color-fill-0);
|
|
60
|
+
}
|
|
61
|
+
.semi-select-option-selected {
|
|
62
|
+
font-weight: 600;
|
|
63
|
+
}
|
|
64
|
+
.semi-select-option-selected .semi-select-option-icon {
|
|
65
|
+
visibility: visible;
|
|
66
|
+
color: var(--semi-color-text-2);
|
|
67
|
+
}
|
|
68
|
+
.semi-select-option-focused {
|
|
69
|
+
background-color: var(--semi-color-fill-0);
|
|
70
|
+
}
|
|
71
|
+
.semi-select-option:first-of-type {
|
|
72
|
+
margin-top: 4px;
|
|
73
|
+
}
|
|
74
|
+
.semi-select-option:last-of-type {
|
|
75
|
+
margin-bottom: 4px;
|
|
76
|
+
}
|
|
77
|
+
|
|
4
78
|
.semi-select {
|
|
5
79
|
box-sizing: border-box;
|
|
6
80
|
border-radius: var(--semi-border-radius-small);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//@import '../theme/variables.scss';
|
|
2
2
|
@import './variables.scss';
|
|
3
3
|
@import './mixin.scss';
|
|
4
|
+
@import './option.scss';
|
|
4
5
|
|
|
5
6
|
$module: #{$prefix}-select;
|
|
6
7
|
$single: #{$module}-single;
|
|
@@ -418,4 +419,4 @@ $multiple: #{$module}-multiple;
|
|
|
418
419
|
cursor: not-allowed;
|
|
419
420
|
}
|
|
420
421
|
|
|
421
|
-
@import './rtl.scss';
|
|
422
|
+
@import './rtl.scss';
|
|
@@ -70,7 +70,7 @@ export interface SliderAdapter extends DefaultAdapter<SliderProps, SliderState>
|
|
|
70
70
|
current: HTMLElement;
|
|
71
71
|
};
|
|
72
72
|
onHandleDown: (e: any) => any;
|
|
73
|
-
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback?: () => void) => boolean | void;
|
|
73
|
+
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback?: () => void, clickTrack?: boolean) => boolean | void;
|
|
74
74
|
setEventDefault: (e: any) => void;
|
|
75
75
|
setStateVal: (state: keyof SliderState, value: any) => void;
|
|
76
76
|
onHandleEnter: (position: SliderState['focusPos']) => void;
|
|
@@ -190,7 +190,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
190
190
|
*
|
|
191
191
|
* @memberof SliderFoundation
|
|
192
192
|
*/
|
|
193
|
-
setHandlePos: (position: number, isMin: boolean) => void;
|
|
193
|
+
setHandlePos: (position: number, isMin: boolean, clickTrack?: boolean) => void;
|
|
194
194
|
/**
|
|
195
195
|
* Determine which slider should be moved currently
|
|
196
196
|
*
|
|
@@ -10,14 +10,17 @@ import BaseFoundation from '../base/foundation';
|
|
|
10
10
|
import touchEventPolyfill from '../utils/touchPolyfill';
|
|
11
11
|
export default class SliderFoundation extends BaseFoundation {
|
|
12
12
|
constructor(adapter) {
|
|
13
|
+
var _this;
|
|
14
|
+
|
|
13
15
|
super(_Object$assign(_Object$assign({}, SliderFoundation.defaultAdapter), adapter));
|
|
16
|
+
_this = this;
|
|
17
|
+
|
|
14
18
|
/**
|
|
15
19
|
* Calculate the percentage corresponding to the current value for style calculation
|
|
16
20
|
* @{}
|
|
17
21
|
*
|
|
18
22
|
* @memberof SliderFoundation
|
|
19
23
|
*/
|
|
20
|
-
|
|
21
24
|
this.getMinAndMaxPercent = value => {
|
|
22
25
|
// debugger
|
|
23
26
|
const {
|
|
@@ -610,7 +613,7 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
610
613
|
const mousePos = this.handleMousePos(e.pageX, e.pageY);
|
|
611
614
|
const position = vertical ? mousePos.y : mousePos.x;
|
|
612
615
|
const isMin = this.checkWhichHandle(position);
|
|
613
|
-
this.setHandlePos(position, isMin);
|
|
616
|
+
this.setHandlePos(position, isMin, true);
|
|
614
617
|
};
|
|
615
618
|
/**
|
|
616
619
|
* Move the slider to the current click position
|
|
@@ -619,8 +622,10 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
619
622
|
*/
|
|
620
623
|
|
|
621
624
|
|
|
622
|
-
this.setHandlePos = (position, isMin)
|
|
623
|
-
|
|
625
|
+
this.setHandlePos = function (position, isMin) {
|
|
626
|
+
let clickTrack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
627
|
+
|
|
628
|
+
_this._adapter.onHandleMove(position, isMin, () => _this._adapter.onHandleUpAfter(), clickTrack);
|
|
624
629
|
};
|
|
625
630
|
/**
|
|
626
631
|
* Determine which slider should be moved currently
|
package/lib/es/table/table.css
CHANGED
|
@@ -403,6 +403,9 @@
|
|
|
403
403
|
display: flex;
|
|
404
404
|
align-items: center;
|
|
405
405
|
}
|
|
406
|
+
.semi-table-fixed-header table {
|
|
407
|
+
table-layout: fixed;
|
|
408
|
+
}
|
|
406
409
|
.semi-table-scroll-position-left .semi-table-tbody > .semi-table-row > .semi-table-cell-fixed-left-last,
|
|
407
410
|
.semi-table-scroll-position-left .semi-table-thead > .semi-table-row > .semi-table-cell-fixed-left-last {
|
|
408
411
|
box-shadow: none;
|
package/lib/es/table/table.scss
CHANGED
|
@@ -492,6 +492,14 @@ $module: #{$prefix}-table;
|
|
|
492
492
|
align-items: center;
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
+
|
|
496
|
+
// when header is fixed, table should use `table-layout: fixed` to avoid align bug
|
|
497
|
+
&-header {
|
|
498
|
+
|
|
499
|
+
table {
|
|
500
|
+
table-layout: fixed;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
495
503
|
}
|
|
496
504
|
|
|
497
505
|
&-scroll {
|
package/lib/es/table/utils.d.ts
CHANGED
package/lib/es/table/utils.js
CHANGED
|
@@ -13,9 +13,10 @@ import _spliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
|
13
13
|
/* eslint-disable no-param-reassign */
|
|
14
14
|
|
|
15
15
|
/* eslint-disable eqeqeq */
|
|
16
|
-
import { cloneDeepWith, isEqualWith, get, filter, find, map, clone as lodashClone, each, findIndex, some, includes, toString } from 'lodash-es';
|
|
16
|
+
import { cloneDeepWith, isEqualWith, get, filter, find, map, clone as lodashClone, each, findIndex, some, includes, toString, isFunction } from 'lodash-es';
|
|
17
17
|
import { strings, numbers } from './constants';
|
|
18
18
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
19
|
+
import Logger from '../utils/Logger';
|
|
19
20
|
export function cloneDeep(value, customizer) {
|
|
20
21
|
return cloneDeepWith(value, v => {
|
|
21
22
|
if (typeof v === 'function') {
|
|
@@ -259,6 +260,7 @@ export function flattenColumns(cols) {
|
|
|
259
260
|
if (_Array$isArray(col[childrenColumnName]) && col[childrenColumnName].length) {
|
|
260
261
|
list.push(...flattenColumns(col[childrenColumnName], childrenColumnName));
|
|
261
262
|
} else {
|
|
263
|
+
warnIfNoDataIndex(col);
|
|
262
264
|
list.push(col);
|
|
263
265
|
}
|
|
264
266
|
}
|
|
@@ -482,4 +484,18 @@ export function getAllDisabledRowKeys(_ref) {
|
|
|
482
484
|
}
|
|
483
485
|
|
|
484
486
|
return disabledRowKeys;
|
|
487
|
+
}
|
|
488
|
+
export function warnIfNoDataIndex(column) {
|
|
489
|
+
if (typeof column === 'object' && column !== null) {
|
|
490
|
+
const {
|
|
491
|
+
filters,
|
|
492
|
+
sorter,
|
|
493
|
+
dataIndex
|
|
494
|
+
} = column;
|
|
495
|
+
const logger = new Logger('[@douyinfe/semi-ui Table]');
|
|
496
|
+
|
|
497
|
+
if ((_Array$isArray(filters) || isFunction(sorter)) && isNullOrUndefined(dataIndex)) {
|
|
498
|
+
logger.warn("The column with sorter or filter must pass the 'dataIndex' prop");
|
|
499
|
+
}
|
|
500
|
+
}
|
|
485
501
|
}
|
|
@@ -10,6 +10,7 @@ declare class TabsFoundation<P = Record<string, any>, S = Record<string, any>> e
|
|
|
10
10
|
constructor(adapter: TabsAdapter<P, S>);
|
|
11
11
|
init(): void;
|
|
12
12
|
destroy: (...args: any[]) => void;
|
|
13
|
+
_notifyChange(activeKey: string): void;
|
|
13
14
|
handleTabClick(activeKey: string, event: any): void;
|
|
14
15
|
handleNewActiveKey(activeKey: string): void;
|
|
15
16
|
getDefaultActiveKey(): string;
|
|
@@ -12,13 +12,23 @@ class TabsFoundation extends BaseFoundation {
|
|
|
12
12
|
this._adapter.collectPane();
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
_notifyChange(activeKey) {
|
|
16
|
+
const {
|
|
17
|
+
activeKey: stateActiveKey
|
|
18
|
+
} = this.getStates();
|
|
19
|
+
|
|
20
|
+
if (stateActiveKey !== activeKey) {
|
|
21
|
+
this._adapter.notifyChange(activeKey);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
15
25
|
handleTabClick(activeKey, event) {
|
|
16
26
|
const isControledComponent = this._isInProps('activeKey');
|
|
17
27
|
|
|
18
28
|
if (isControledComponent) {
|
|
19
|
-
this.
|
|
29
|
+
this._notifyChange(activeKey);
|
|
20
30
|
} else {
|
|
21
|
-
this.
|
|
31
|
+
this._notifyChange(activeKey);
|
|
22
32
|
|
|
23
33
|
this.handleNewActiveKey(activeKey);
|
|
24
34
|
}
|
|
@@ -74,6 +74,6 @@ export declare function getValueOrKey(data: any): any;
|
|
|
74
74
|
export declare function normalizeValue(value: any, withObject: boolean): any;
|
|
75
75
|
export declare function updateKeys(keySet: Set<string>, keyEntities: KeyEntities): string[];
|
|
76
76
|
export declare function calcDisabledKeys(keyEntities: KeyEntities): Set<string>;
|
|
77
|
-
export declare function calcDropRelativePosition(event: any, treeNode: any):
|
|
77
|
+
export declare function calcDropRelativePosition(event: any, treeNode: any): 0 | 1 | -1;
|
|
78
78
|
export declare function getDragNodesKeys(key: string, keyEntities: KeyEntities): string[];
|
|
79
79
|
export declare function calcDropActualPosition(pos: string, relativeDropPos: any): any;
|
|
@@ -18,7 +18,7 @@ declare const strings: {
|
|
|
18
18
|
DRAG_AREA_ILLEGAL: string;
|
|
19
19
|
TRIGGER_AUTO: "auto";
|
|
20
20
|
TRIGGER_CUSTOM: "custom";
|
|
21
|
-
UPLOAD_TRIGGER: ("
|
|
21
|
+
UPLOAD_TRIGGER: ("custom" | "auto")[];
|
|
22
22
|
VALIDATE_STATUS: readonly ["default", "error", "warning", "success"];
|
|
23
23
|
PROMPT_POSITION: readonly ["left", "right", "bottom"];
|
|
24
24
|
};
|
package/modal/modalFoundation.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { get } from 'lodash-es';
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { Motion } from '../utils/type';
|
|
4
3
|
|
|
@@ -11,7 +10,7 @@ export interface ModalAdapter extends DefaultAdapter<ModalProps, ModalState> {
|
|
|
11
10
|
notifyCancel: (e: any) => void;
|
|
12
11
|
notifyOk: (e: any) => void;
|
|
13
12
|
notifyClose: () => void;
|
|
14
|
-
toggleHidden: (hidden: boolean) => void;
|
|
13
|
+
toggleHidden: (hidden: boolean, callback?: (hidden: boolean) => void) => void;
|
|
15
14
|
notifyFullScreen: (isFullScreen: boolean) => void;
|
|
16
15
|
getProps: () => ModalProps;
|
|
17
16
|
}
|
|
@@ -95,8 +94,8 @@ export default class ModalFoundation extends BaseFoundation<ModalAdapter> {
|
|
|
95
94
|
}
|
|
96
95
|
|
|
97
96
|
|
|
98
|
-
toggleHidden = (hidden: boolean) => {
|
|
99
|
-
this._adapter.toggleHidden(hidden);
|
|
97
|
+
toggleHidden = (hidden: boolean, callback?: (hidden: boolean) => void) => {
|
|
98
|
+
this._adapter.toggleHidden(hidden, callback);
|
|
100
99
|
};
|
|
101
100
|
|
|
102
101
|
// // eslint-disable-next-line max-len
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.9-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
11
|
-
"@douyinfe/semi-animation": "2.0.
|
|
11
|
+
"@douyinfe/semi-animation": "2.0.8",
|
|
12
12
|
"async-validator": "^3.5.0",
|
|
13
13
|
"classnames": "^2.2.6",
|
|
14
14
|
"date-fns": "^2.9.0",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"*.scss",
|
|
25
25
|
"*.css"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "cfbebccbd9c618b43a0eeca339980cea3723453d",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
package/radio/variables.scss
CHANGED
|
@@ -48,7 +48,7 @@ $width-radio_hover-border: $border-thickness-control; // 描边宽度 - 悬浮
|
|
|
48
48
|
$width-radio_disabled-border: $border-thickness-control; // 描边宽度 - 禁用态
|
|
49
49
|
$width-radio_innder-border: $border-thickness-control; // 描边宽度 - 禁用态
|
|
50
50
|
|
|
51
|
-
$height-radio_inner_min:
|
|
51
|
+
$height-radio_inner_min: 20px; // 单选按钮高度
|
|
52
52
|
$width-radio_inner: $width-icon-medium; // 单选按钮宽度
|
|
53
53
|
$spacing-radio_addon-paddingLeft: $spacing-tight; //单选标题到单选按钮左侧边距
|
|
54
54
|
$spacing-radio_addon-marginLeft: $width-radio_inner; //单选标题左侧整体外边距
|
package/select/option.scss
CHANGED
package/select/select.scss
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
//@import '../theme/variables.scss';
|
|
2
2
|
@import './variables.scss';
|
|
3
3
|
@import './mixin.scss';
|
|
4
|
+
@import './option.scss';
|
|
4
5
|
|
|
5
6
|
$module: #{$prefix}-select;
|
|
6
7
|
$single: #{$module}-single;
|
|
@@ -418,4 +419,4 @@ $multiple: #{$module}-multiple;
|
|
|
418
419
|
cursor: not-allowed;
|
|
419
420
|
}
|
|
420
421
|
|
|
421
|
-
@import './rtl.scss';
|
|
422
|
+
@import './rtl.scss';
|
package/slider/foundation.ts
CHANGED
|
@@ -79,7 +79,7 @@ export interface SliderAdapter extends DefaultAdapter<SliderProps, SliderState>{
|
|
|
79
79
|
getMinHandleEl: () => { current: HTMLElement };
|
|
80
80
|
getMaxHandleEl: () => { current: HTMLElement };
|
|
81
81
|
onHandleDown: (e: any) => any;
|
|
82
|
-
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback?: () => void) => boolean | void;
|
|
82
|
+
onHandleMove: (mousePos: number, isMin: boolean, stateChangeCallback?: () => void, clickTrack?: boolean) => boolean | void;
|
|
83
83
|
setEventDefault: (e: any) => void;
|
|
84
84
|
setStateVal: (state: keyof SliderState, value: any) => void;
|
|
85
85
|
onHandleEnter: (position: SliderState['focusPos']) => void;
|
|
@@ -568,7 +568,7 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
568
568
|
const mousePos = this.handleMousePos(e.pageX, e.pageY);
|
|
569
569
|
const position = vertical ? mousePos.y : mousePos.x;
|
|
570
570
|
const isMin = this.checkWhichHandle(position);
|
|
571
|
-
this.setHandlePos(position, isMin);
|
|
571
|
+
this.setHandlePos(position, isMin, true);
|
|
572
572
|
};
|
|
573
573
|
|
|
574
574
|
/**
|
|
@@ -576,8 +576,8 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
576
576
|
*
|
|
577
577
|
* @memberof SliderFoundation
|
|
578
578
|
*/
|
|
579
|
-
setHandlePos = (position: number, isMin: boolean) => {
|
|
580
|
-
this._adapter.onHandleMove(position, isMin, () => this._adapter.onHandleUpAfter());
|
|
579
|
+
setHandlePos = (position: number, isMin: boolean, clickTrack = false) => {
|
|
580
|
+
this._adapter.onHandleMove(position, isMin, () => this._adapter.onHandleUpAfter(), clickTrack);
|
|
581
581
|
};
|
|
582
582
|
|
|
583
583
|
/**
|
package/table/table.scss
CHANGED
|
@@ -492,6 +492,14 @@ $module: #{$prefix}-table;
|
|
|
492
492
|
align-items: center;
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
|
+
|
|
496
|
+
// when header is fixed, table should use `table-layout: fixed` to avoid align bug
|
|
497
|
+
&-header {
|
|
498
|
+
|
|
499
|
+
table {
|
|
500
|
+
table-layout: fixed;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
495
503
|
}
|
|
496
504
|
|
|
497
505
|
&-scroll {
|
package/table/utils.ts
CHANGED
|
@@ -13,10 +13,13 @@ import {
|
|
|
13
13
|
findIndex,
|
|
14
14
|
some,
|
|
15
15
|
includes,
|
|
16
|
-
toString
|
|
16
|
+
toString,
|
|
17
|
+
isFunction
|
|
17
18
|
} from 'lodash-es';
|
|
18
19
|
import { strings, numbers } from './constants';
|
|
19
20
|
import isNullOrUndefined from '../utils/isNullOrUndefined';
|
|
21
|
+
import Logger from '../utils/Logger';
|
|
22
|
+
|
|
20
23
|
|
|
21
24
|
export function cloneDeep(value: any, customizer?: (v: any) => any) {
|
|
22
25
|
return cloneDeepWith(value, v => {
|
|
@@ -265,6 +268,7 @@ export function flattenColumns(cols: Record<string, any>[], childrenColumnName =
|
|
|
265
268
|
if (Array.isArray(col[childrenColumnName]) && col[childrenColumnName].length) {
|
|
266
269
|
list.push(...flattenColumns(col[childrenColumnName], childrenColumnName));
|
|
267
270
|
} else {
|
|
271
|
+
warnIfNoDataIndex(col);
|
|
268
272
|
list.push(col);
|
|
269
273
|
}
|
|
270
274
|
}
|
|
@@ -470,4 +474,14 @@ export interface GetAllDisabledRowKeysProps {
|
|
|
470
474
|
getCheckboxProps: (record?: Record<string, any>) => any;
|
|
471
475
|
childrenRecordName?: string;
|
|
472
476
|
rowKey?: string | number | ((record: Record<string, any>) => string | number);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export function warnIfNoDataIndex(column: Record<string, any>) {
|
|
480
|
+
if (typeof column === 'object' && column !== null) {
|
|
481
|
+
const { filters, sorter, dataIndex } = column;
|
|
482
|
+
const logger = new Logger('[@douyinfe/semi-ui Table]');
|
|
483
|
+
if ((Array.isArray(filters) || isFunction(sorter)) && isNullOrUndefined(dataIndex) ) {
|
|
484
|
+
logger.warn(`The column with sorter or filter must pass the 'dataIndex' prop`);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
473
487
|
}
|
package/tabs/foundation.ts
CHANGED
|
@@ -20,12 +20,19 @@ class TabsFoundation<P = Record<string, any>, S = Record<string, any>> extends B
|
|
|
20
20
|
|
|
21
21
|
destroy = noop;
|
|
22
22
|
|
|
23
|
+
_notifyChange(activeKey: string): void {
|
|
24
|
+
const { activeKey: stateActiveKey } = this.getStates();
|
|
25
|
+
if (stateActiveKey !== activeKey) {
|
|
26
|
+
this._adapter.notifyChange(activeKey);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
23
30
|
handleTabClick(activeKey: string, event: any): void {
|
|
24
31
|
const isControledComponent = this._isInProps('activeKey');
|
|
25
32
|
if (isControledComponent) {
|
|
26
|
-
this.
|
|
33
|
+
this._notifyChange(activeKey);
|
|
27
34
|
} else {
|
|
28
|
-
this.
|
|
35
|
+
this._notifyChange(activeKey);
|
|
29
36
|
this.handleNewActiveKey(activeKey);
|
|
30
37
|
}
|
|
31
38
|
this._adapter.notifyTabClick(activeKey, event);
|