@douyinfe/semi-foundation 2.0.8 → 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.
@@ -1,7 +1,7 @@
1
1
  $module: #{$prefix}-autocomplete;
2
2
 
3
3
  @import "./variables.scss";
4
-
4
+ @import "../select/option.scss";
5
5
  .#{$module} {
6
6
  cursor: text;
7
7
  display: inline-flex;
@@ -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
@@ -79,7 +79,7 @@ export interface FieldState {
79
79
  status?: 'error' | 'success';
80
80
  }
81
81
 
82
- export interface withFieldOption {
82
+ export interface WithFieldOption {
83
83
  valueKey?: string;
84
84
  onKeyChangeFnName?: string;
85
85
  valuePath?: string;
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, withFieldOption } from './interface';
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: withFieldOption, props: ComponentProps) {
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-autocomplete {
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-autocomplete-option-list {
84
+ .semi-select-option-list {
11
85
  overflow-x: hidden;
12
86
  overflow-y: auto;
13
87
  }
14
- .semi-autocomplete-option-list-chosen .semi-autocomplete-option-icon {
88
+ .semi-select-option-list-chosen .semi-select-option-icon {
15
89
  display: flex;
16
90
  }
17
- .semi-autocomplete-loading-wrapper {
91
+ .semi-select-loading-wrapper {
18
92
  padding-top: 8px;
19
93
  padding-bottom: 8px;
20
94
  cursor: not-allowed;
21
95
  }
22
- .semi-autocomplete-loading-wrapper .semi-spin {
96
+ .semi-select-loading-wrapper .semi-spin {
23
97
  width: 100%;
24
98
  }
25
99
 
@@ -1,7 +1,7 @@
1
1
  $module: #{$prefix}-autocomplete;
2
2
 
3
3
  @import "./variables.scss";
4
-
4
+ @import "../select/option.scss";
5
5
  .#{$module} {
6
6
  cursor: text;
7
7
  display: inline-flex;
@@ -75,7 +75,7 @@ export interface FieldState {
75
75
  error?: any;
76
76
  status?: 'error' | 'success';
77
77
  }
78
- export interface withFieldOption {
78
+ export interface WithFieldOption {
79
79
  valueKey?: string;
80
80
  onKeyChangeFnName?: string;
81
81
  valuePath?: string;
@@ -1,11 +1,11 @@
1
1
  /// <reference types="react" />
2
2
  import AsyncValidator from 'async-validator';
3
- import { ComponentProps, withFieldOption } from './interface';
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: withFieldOption, props: ComponentProps): {
8
+ export declare function mergeOptions(opts: WithFieldOption, props: ComponentProps): {
9
9
  options: {
10
10
  valueKey: string;
11
11
  onKeyChangeFnName: string;
@@ -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: $spacing-base-loose; // 单选按钮高度
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; //单选标题左侧整体外边距
@@ -13,7 +13,7 @@
13
13
  color: var(--semi-color-text-0);
14
14
  position: relative;
15
15
  display: flex;
16
- flex-wrap: no-wrap;
16
+ flex-wrap: nowrap;
17
17
  align-items: center;
18
18
  cursor: pointer;
19
19
  box-sizing: border-box;
@@ -15,7 +15,7 @@ $multiple: #{$module}-multiple;
15
15
  color: $color-select_option_main-text;
16
16
  position: relative;
17
17
  display: flex;
18
- flex-wrap: no-wrap;
18
+ flex-wrap: nowrap;
19
19
  align-items: center;
20
20
  cursor: pointer;
21
21
  box-sizing: border-box;
@@ -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
- this._adapter.onHandleMove(position, isMin, () => this._adapter.onHandleUpAfter());
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
@@ -92,3 +92,4 @@ export interface GetAllDisabledRowKeysProps {
92
92
  childrenRecordName?: string;
93
93
  rowKey?: string | number | ((record: Record<string, any>) => string | number);
94
94
  }
95
+ export declare function warnIfNoDataIndex(column: Record<string, any>): void;
@@ -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._adapter.notifyChange(activeKey);
29
+ this._notifyChange(activeKey);
20
30
  } else {
21
- this._adapter.notifyChange(activeKey);
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): 1 | -1 | 0;
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: ("auto" | "custom")[];
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.0.8",
3
+ "version": "2.0.9-alpha.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -24,7 +24,7 @@
24
24
  "*.scss",
25
25
  "*.css"
26
26
  ],
27
- "gitHead": "0a2a5df053d415ee634ae3c5b8aa24915aa2cf9b",
27
+ "gitHead": "cfbebccbd9c618b43a0eeca339980cea3723453d",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
@@ -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: $spacing-base-loose; // 单选按钮高度
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; //单选标题左侧整体外边距
@@ -15,7 +15,7 @@ $multiple: #{$module}-multiple;
15
15
  color: $color-select_option_main-text;
16
16
  position: relative;
17
17
  display: flex;
18
- flex-wrap: no-wrap;
18
+ flex-wrap: nowrap;
19
19
  align-items: center;
20
20
  cursor: pointer;
21
21
  box-sizing: border-box;
@@ -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';
@@ -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/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
  }
@@ -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._adapter.notifyChange(activeKey);
33
+ this._notifyChange(activeKey);
27
34
  } else {
28
- this._adapter.notifyChange(activeKey);
35
+ this._notifyChange(activeKey);
29
36
  this.handleNewActiveKey(activeKey);
30
37
  }
31
38
  this._adapter.notifyTabClick(activeKey, event);