@douyinfe/semi-foundation 2.5.0-beta.0 → 2.5.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.
@@ -384,6 +384,18 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
384
384
  this._adapter.notifyBlur(e);
385
385
  }
386
386
 
387
+ /**
388
+ * clear range input focus when open is controlled
389
+ * fixed github 1375
390
+ */
391
+ clearRangeInputFocus = () => {
392
+ const { type } = this._adapter.getProps();
393
+ const { rangeInputFocus } = this._adapter.getStates();
394
+ if (type === 'dateTimeRange' && rangeInputFocus) {
395
+ this._adapter.setRangeInputFocus(false);
396
+ }
397
+ }
398
+
387
399
  /**
388
400
  * Callback when the content of the input box changes
389
401
  * Update the date panel if the changed value is a legal date, otherwise only update the input box
@@ -221,6 +221,11 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
221
221
  * @param {Date[]} dates
222
222
  */
223
223
  closePanel(e?: any, inputValue?: string, dates?: Date[]): void;
224
+ /**
225
+ * clear range input focus when open is controlled
226
+ * fixed github 1375
227
+ */
228
+ clearRangeInputFocus: () => void;
224
229
  /**
225
230
  * Callback when the content of the input box changes
226
231
  * Update the date panel if the changed value is a legal date, otherwise only update the input box
@@ -76,6 +76,24 @@ var _constants2 = require("../input/constants");
76
76
  class DatePickerFoundation extends _foundation.default {
77
77
  constructor(adapter) {
78
78
  super((0, _assign.default)({}, adapter));
79
+ /**
80
+ * clear range input focus when open is controlled
81
+ * fixed github 1375
82
+ */
83
+
84
+ this.clearRangeInputFocus = () => {
85
+ const {
86
+ type
87
+ } = this._adapter.getProps();
88
+
89
+ const {
90
+ rangeInputFocus
91
+ } = this._adapter.getStates();
92
+
93
+ if (type === 'dateTimeRange' && rangeInputFocus) {
94
+ this._adapter.setRangeInputFocus(false);
95
+ }
96
+ };
79
97
 
80
98
  this.getMergedMotion = motion => {
81
99
  const mergedMotion = typeof motion === 'undefined' || motion ? (0, _assign.default)((0, _assign.default)({}, motion), {
@@ -36,7 +36,7 @@ export interface SelectAdapter<P = Record<string, any>, S = Record<string, any>>
36
36
  notifyMouseLeave(event: any): void;
37
37
  notifyMouseEnter(event: any): void;
38
38
  updateHovering(isHover: boolean): void;
39
- updateScrollTop(): void;
39
+ updateScrollTop(index?: number): void;
40
40
  }
41
41
  declare type LabelValue = string | number;
42
42
  declare type PropValue = LabelValue | Record<string, any>;
@@ -944,8 +944,9 @@ class SelectFoundation extends _foundation.default {
944
944
  } // console.log('new:' + index);
945
945
 
946
946
 
947
- this._adapter.updateFocusIndex(index); // TODO requires scrollIntoView
947
+ this._adapter.updateFocusIndex(index);
948
948
 
949
+ this._adapter.updateScrollTop(index);
949
950
  }
950
951
 
951
952
  _handleArrowKeyDown(offset) {
@@ -384,7 +384,10 @@ function assignColumnKeys(columns) {
384
384
  if (column.key == null) {
385
385
  var _context4;
386
386
 
387
- column.key = (0, _concat.default)(_context4 = "".concat(level, "-")).call(_context4, index);
387
+ // if user give column a dataIndex, use it for backup
388
+ const _index = column.dataIndex || index;
389
+
390
+ column.key = (0, _concat.default)(_context4 = "".concat(level, "-")).call(_context4, _index);
388
391
  }
389
392
 
390
393
  if ((0, _isArray.default)(column[childrenColumnName]) && column[childrenColumnName].length) {
@@ -221,6 +221,11 @@ export default class DatePickerFoundation extends BaseFoundation<DatePickerAdapt
221
221
  * @param {Date[]} dates
222
222
  */
223
223
  closePanel(e?: any, inputValue?: string, dates?: Date[]): void;
224
+ /**
225
+ * clear range input focus when open is controlled
226
+ * fixed github 1375
227
+ */
228
+ clearRangeInputFocus: () => void;
224
229
  /**
225
230
  * Callback when the content of the input box changes
226
231
  * Update the date panel if the changed value is a legal date, otherwise only update the input box
@@ -38,6 +38,24 @@ import { strings as inputStrings } from '../input/constants';
38
38
  export default class DatePickerFoundation extends BaseFoundation {
39
39
  constructor(adapter) {
40
40
  super(_Object$assign({}, adapter));
41
+ /**
42
+ * clear range input focus when open is controlled
43
+ * fixed github 1375
44
+ */
45
+
46
+ this.clearRangeInputFocus = () => {
47
+ const {
48
+ type
49
+ } = this._adapter.getProps();
50
+
51
+ const {
52
+ rangeInputFocus
53
+ } = this._adapter.getStates();
54
+
55
+ if (type === 'dateTimeRange' && rangeInputFocus) {
56
+ this._adapter.setRangeInputFocus(false);
57
+ }
58
+ };
41
59
 
42
60
  this.getMergedMotion = motion => {
43
61
  const mergedMotion = typeof motion === 'undefined' || motion ? _Object$assign(_Object$assign({}, motion), {
@@ -36,7 +36,7 @@ export interface SelectAdapter<P = Record<string, any>, S = Record<string, any>>
36
36
  notifyMouseLeave(event: any): void;
37
37
  notifyMouseEnter(event: any): void;
38
38
  updateHovering(isHover: boolean): void;
39
- updateScrollTop(): void;
39
+ updateScrollTop(index?: number): void;
40
40
  }
41
41
  declare type LabelValue = string | number;
42
42
  declare type PropValue = LabelValue | Record<string, any>;
@@ -916,8 +916,9 @@ export default class SelectFoundation extends BaseFoundation {
916
916
  } // console.log('new:' + index);
917
917
 
918
918
 
919
- this._adapter.updateFocusIndex(index); // TODO requires scrollIntoView
919
+ this._adapter.updateFocusIndex(index);
920
920
 
921
+ this._adapter.updateScrollTop(index);
921
922
  }
922
923
 
923
924
  _handleArrowKeyDown(offset) {
@@ -296,7 +296,10 @@ export function assignColumnKeys(columns) {
296
296
  if (column.key == null) {
297
297
  var _context4;
298
298
 
299
- column.key = _concatInstanceProperty(_context4 = "".concat(level, "-")).call(_context4, index);
299
+ // if user give column a dataIndex, use it for backup
300
+ const _index = column.dataIndex || index;
301
+
302
+ column.key = _concatInstanceProperty(_context4 = "".concat(level, "-")).call(_context4, _index);
300
303
  }
301
304
 
302
305
  if (_Array$isArray(column[childrenColumnName]) && column[childrenColumnName].length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.5.0-beta.0",
3
+ "version": "2.5.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.5.0-beta.0",
11
+ "@douyinfe/semi-animation": "2.5.0",
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": "d71dddacba0c96004c19103f2e0d3cb59ac52857",
27
+ "gitHead": "856255d8b5ad895a5fee47c5920aa1835836aff0",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
@@ -44,7 +44,7 @@ export interface SelectAdapter<P = Record<string, any>, S = Record<string, any>>
44
44
  notifyMouseLeave(event: any): void;
45
45
  notifyMouseEnter(event: any): void;
46
46
  updateHovering(isHover: boolean): void;
47
- updateScrollTop(): void;
47
+ updateScrollTop(index?: number): void;
48
48
  }
49
49
 
50
50
  type LabelValue = string | number;
@@ -704,7 +704,7 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
704
704
  }
705
705
  // console.log('new:' + index);
706
706
  this._adapter.updateFocusIndex(index);
707
- // TODO requires scrollIntoView
707
+ this._adapter.updateScrollTop(index);
708
708
  }
709
709
 
710
710
  _handleArrowKeyDown(offset: number) {
@@ -954,4 +954,5 @@ export default class SelectFoundation extends BaseFoundation<SelectAdapter> {
954
954
  updateScrollTop() {
955
955
  this._adapter.updateScrollTop();
956
956
  }
957
+
957
958
  }
package/table/utils.ts CHANGED
@@ -281,7 +281,9 @@ export function assignColumnKeys(columns: Record<string, any>[], childrenColumnN
281
281
  const sameLevelCols: Record<string, any>[] = [];
282
282
  each(columns, (column, index) => {
283
283
  if (column.key == null) {
284
- column.key = `${level}-${index}`;
284
+ // if user give column a dataIndex, use it for backup
285
+ const _index = column.dataIndex || index;
286
+ column.key = `${level}-${_index}`;
285
287
  }
286
288
  if (Array.isArray(column[childrenColumnName]) && column[childrenColumnName].length) {
287
289
  sameLevelCols.push(...column[childrenColumnName]);