@douyinfe/semi-foundation 2.4.1 → 2.5.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 (54) hide show
  1. package/cascader/cascader.scss +1 -0
  2. package/cascader/variables.scss +4 -2
  3. package/lib/cjs/autoComplete/constants.d.ts +1 -1
  4. package/lib/cjs/cascader/cascader.css +1 -0
  5. package/lib/cjs/cascader/cascader.scss +1 -0
  6. package/lib/cjs/cascader/variables.scss +4 -2
  7. package/lib/cjs/dropdown/constants.d.ts +1 -1
  8. package/lib/cjs/select/constants.d.ts +1 -1
  9. package/lib/cjs/select/optionFoundation.d.ts +1 -1
  10. package/lib/cjs/select/optionFoundation.js +3 -3
  11. package/lib/cjs/slider/foundation.js +2 -2
  12. package/lib/cjs/table/foundation.d.ts +2 -0
  13. package/lib/cjs/table/foundation.js +16 -4
  14. package/lib/cjs/tooltip/constants.d.ts +1 -1
  15. package/lib/cjs/tooltip/constants.js +1 -1
  16. package/lib/cjs/tooltip/foundation.js +65 -4
  17. package/lib/cjs/tree/foundation.d.ts +4 -1
  18. package/lib/cjs/tree/foundation.js +69 -20
  19. package/lib/cjs/treeSelect/foundation.d.ts +3 -3
  20. package/lib/cjs/treeSelect/foundation.js +103 -35
  21. package/lib/cjs/upload/upload.css +49 -27
  22. package/lib/cjs/upload/upload.scss +66 -41
  23. package/lib/cjs/upload/variables.scss +3 -1
  24. package/lib/es/autoComplete/constants.d.ts +1 -1
  25. package/lib/es/cascader/cascader.css +1 -0
  26. package/lib/es/cascader/cascader.scss +1 -0
  27. package/lib/es/cascader/variables.scss +4 -2
  28. package/lib/es/dropdown/constants.d.ts +1 -1
  29. package/lib/es/select/constants.d.ts +1 -1
  30. package/lib/es/select/optionFoundation.d.ts +1 -1
  31. package/lib/es/select/optionFoundation.js +3 -3
  32. package/lib/es/slider/foundation.js +2 -2
  33. package/lib/es/table/foundation.d.ts +2 -0
  34. package/lib/es/table/foundation.js +16 -4
  35. package/lib/es/tooltip/constants.d.ts +1 -1
  36. package/lib/es/tooltip/constants.js +1 -1
  37. package/lib/es/tooltip/foundation.js +65 -4
  38. package/lib/es/tree/foundation.d.ts +4 -1
  39. package/lib/es/tree/foundation.js +69 -20
  40. package/lib/es/treeSelect/foundation.d.ts +3 -3
  41. package/lib/es/treeSelect/foundation.js +102 -35
  42. package/lib/es/upload/upload.css +49 -27
  43. package/lib/es/upload/upload.scss +66 -41
  44. package/lib/es/upload/variables.scss +3 -1
  45. package/package.json +3 -3
  46. package/select/optionFoundation.ts +3 -3
  47. package/slider/foundation.ts +2 -2
  48. package/table/foundation.ts +23 -10
  49. package/tooltip/constants.ts +2 -0
  50. package/tooltip/foundation.ts +52 -4
  51. package/tree/foundation.ts +56 -17
  52. package/treeSelect/foundation.ts +89 -41
  53. package/upload/upload.scss +66 -41
  54. package/upload/variables.scss +3 -1
@@ -20,6 +20,7 @@ $module: #{$prefix}-cascader;
20
20
 
21
21
  &:hover {
22
22
  background-color: $color-cascader_default-bg-hover;
23
+ border: $width-cascader_hover-border $color-cascader_default-border-hover solid;
23
24
  }
24
25
 
25
26
  &-small {
@@ -1,9 +1,10 @@
1
1
  $radius-cascader: var(--semi-border-radius-small); // 级联选择菜单圆角
2
2
 
3
- $color-cascader_default-border-default: transparent; // 级联选择描边颜色
3
+ $color-cascader_default-border-default: transparent; // 级联选择描边颜色 - 默认
4
+ $color-cascader_default-border-hover: transparent; // 级联选择描边颜色 - 悬浮
5
+ $color-cascader_default-border-focus: var(--semi-color-focus-border); // 级联选择描边颜色 - 选中
4
6
  $color-cascader_default-bg-default: var(--semi-color-fill-0); // 级联选择菜单项背景颜色 - 默认
5
7
  $color-cascader_default-bg-hover: var(--semi-color-fill-1); // 级联选择菜单项背景颜色 - 悬浮
6
- $color-cascader_default-border-focus: var(--semi-color-focus-border); // 级联选择描边颜色 - 选中
7
8
  $color-cascader_option_list-border-default: var(--semi-color-fill-0); // 级联选择各级菜单分割线颜色
8
9
  $color-cascader_option_main-text-default: var(--semi-color-text-0); // 级联选择菜单项文字颜色
9
10
  $color-cascader_option-bg-hover: var(--semi-color-fill-0); // 级联选择菜单项背景颜色 - 悬浮
@@ -83,6 +84,7 @@ $width-cascader: 80px; // 级联选择触发器最小宽度
83
84
  $height-cascader_default: $height-control-default; // 级联选择触发器高度 - 默认
84
85
  $height-cascader_small: $height-control-small; // 级联选择触发器高度 - 小尺寸
85
86
  $height-cascader_large: $height-control-large; // 级联选择触发器高度 - 大尺寸
87
+ $width-cascader_hover-border: $width-cascader-border; // 级联选择触发器描边宽度 - 悬浮
86
88
  $width-cascader_focus-border: $border-thickness-control-focus; // 级联选择触发器描边宽度 - 选中态
87
89
  $width-cascader_search-border: 1px; // 级联选择触搜索描边宽度
88
90
  $width-cascader-icon: 16px; // 级联选择图标尺寸
@@ -3,7 +3,7 @@ declare const cssClasses: {
3
3
  };
4
4
  declare const strings: {
5
5
  readonly SIZE: readonly ["small", "large", "default"];
6
- readonly POSITION: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver"];
6
+ readonly POSITION: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver", "leftBottomOver", "rightBottomOver"];
7
7
  readonly OPTIONS: readonly ["children", "value"];
8
8
  readonly STATUS: readonly ["default", "error", "warning", "success"];
9
9
  };
@@ -19,6 +19,7 @@
19
19
  }
20
20
  .semi-cascader:hover {
21
21
  background-color: var(--semi-color-fill-1);
22
+ border: 1px transparent solid;
22
23
  }
23
24
  .semi-cascader-small {
24
25
  min-height: 24px;
@@ -20,6 +20,7 @@ $module: #{$prefix}-cascader;
20
20
 
21
21
  &:hover {
22
22
  background-color: $color-cascader_default-bg-hover;
23
+ border: $width-cascader_hover-border $color-cascader_default-border-hover solid;
23
24
  }
24
25
 
25
26
  &-small {
@@ -1,9 +1,10 @@
1
1
  $radius-cascader: var(--semi-border-radius-small); // 级联选择菜单圆角
2
2
 
3
- $color-cascader_default-border-default: transparent; // 级联选择描边颜色
3
+ $color-cascader_default-border-default: transparent; // 级联选择描边颜色 - 默认
4
+ $color-cascader_default-border-hover: transparent; // 级联选择描边颜色 - 悬浮
5
+ $color-cascader_default-border-focus: var(--semi-color-focus-border); // 级联选择描边颜色 - 选中
4
6
  $color-cascader_default-bg-default: var(--semi-color-fill-0); // 级联选择菜单项背景颜色 - 默认
5
7
  $color-cascader_default-bg-hover: var(--semi-color-fill-1); // 级联选择菜单项背景颜色 - 悬浮
6
- $color-cascader_default-border-focus: var(--semi-color-focus-border); // 级联选择描边颜色 - 选中
7
8
  $color-cascader_option_list-border-default: var(--semi-color-fill-0); // 级联选择各级菜单分割线颜色
8
9
  $color-cascader_option_main-text-default: var(--semi-color-text-0); // 级联选择菜单项文字颜色
9
10
  $color-cascader_option-bg-hover: var(--semi-color-fill-0); // 级联选择菜单项背景颜色 - 悬浮
@@ -83,6 +84,7 @@ $width-cascader: 80px; // 级联选择触发器最小宽度
83
84
  $height-cascader_default: $height-control-default; // 级联选择触发器高度 - 默认
84
85
  $height-cascader_small: $height-control-small; // 级联选择触发器高度 - 小尺寸
85
86
  $height-cascader_large: $height-control-large; // 级联选择触发器高度 - 大尺寸
87
+ $width-cascader_hover-border: $width-cascader-border; // 级联选择触发器描边宽度 - 悬浮
86
88
  $width-cascader_focus-border: $border-thickness-control-focus; // 级联选择触发器描边宽度 - 选中态
87
89
  $width-cascader_search-border: 1px; // 级联选择触搜索描边宽度
88
90
  $width-cascader-icon: 16px; // 级联选择图标尺寸
@@ -4,7 +4,7 @@ declare const cssClasses: {
4
4
  DISABLED: string;
5
5
  };
6
6
  declare const strings: {
7
- POSITION_SET: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver"];
7
+ POSITION_SET: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver", "leftBottomOver", "rightBottomOver"];
8
8
  TRIGGER_SET: string[];
9
9
  DEFAULT_LEAVE_DELAY: number;
10
10
  ITEM_TYPE: string[];
@@ -5,7 +5,7 @@ declare const cssClasses: {
5
5
  };
6
6
  declare const strings: {
7
7
  readonly SIZE_SET: readonly ["small", "large", "default"];
8
- readonly POSITION_SET: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver"];
8
+ readonly POSITION_SET: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver", "leftBottomOver", "rightBottomOver"];
9
9
  readonly MODE_SELECT: "select";
10
10
  readonly MODE_AUTOCOMPLETE: "autoComplete";
11
11
  readonly STATUS: readonly ["default", "error", "warning", "success"];
@@ -17,5 +17,5 @@ export default class OptionFoundation extends BaseFoundation<OptionDefaultAdapte
17
17
  init(): void;
18
18
  destroy(): void;
19
19
  onOptionClick(option: BasicOptionProps): void;
20
- isDisbled_(): any;
20
+ _isDisabled(): any;
21
21
  }
@@ -26,14 +26,14 @@ class OptionFoundation extends _foundation.default {
26
26
  destroy() {}
27
27
 
28
28
  onOptionClick(option) {
29
- const isDisbled = this.isDisbled_();
29
+ const isDisabled = this._isDisabled();
30
30
 
31
- if (!isDisbled) {
31
+ if (!isDisabled) {
32
32
  this._adapter.notifyClick(option);
33
33
  }
34
34
  }
35
35
 
36
- isDisbled_() {
36
+ _isDisabled() {
37
37
  return this.getProp('disabled');
38
38
  }
39
39
 
@@ -162,7 +162,7 @@ class SliderFoundation extends _foundation.default {
162
162
 
163
163
  const scroll = node => regex.test(style(node, 'overflow') + style(node, 'overflow-y') + style(node, 'overflow-x'));
164
164
 
165
- const scrollParent = node => !node || node === document.body ? document.body : scroll(node) ? node : scrollParent(node.parentNode);
165
+ const scrollParent = node => !node || node === document.body || !(node instanceof Element) ? document.body : scroll(node) ? node : scrollParent(node.parentNode);
166
166
 
167
167
  return scrollParent(el);
168
168
  };
@@ -286,7 +286,7 @@ class SliderFoundation extends _foundation.default {
286
286
  }
287
287
 
288
288
  if (step !== 1) {
289
- // Find nearest step point
289
+ // Find nearest step point
290
290
  stepValue = Math.round(stepValue / step) * step;
291
291
  }
292
292
 
@@ -8,6 +8,7 @@ export interface BaseColumnProps<RecordType> {
8
8
  className?: string;
9
9
  colSpan?: number;
10
10
  dataIndex?: string;
11
+ defaultFilteredValue?: any[];
11
12
  defaultSortOrder?: BaseSortOrder;
12
13
  filterChildrenRecord?: boolean;
13
14
  filterDropdown?: any;
@@ -313,6 +314,7 @@ export interface BaseChangeInfoFilter<RecordType> {
313
314
  filters?: BaseFilter[];
314
315
  onFilter?: (filteredValue?: any, record?: RecordType) => boolean;
315
316
  filteredValue?: any[];
317
+ defaultFilteredValue?: any[];
316
318
  children?: BaseFilter[];
317
319
  filterChildrenRecord?: boolean;
318
320
  }
@@ -219,7 +219,17 @@ class TableFoundation extends _foundation.default {
219
219
 
220
220
 
221
221
  getFilteredSortedDataSource(dataSource, queries) {
222
- const filteredDataSource = this.filterDataSource(dataSource, (0, _filter2.default)(queries).call(queries, query => (0, _isFunction2.default)(query.onFilter) && (0, _isArray.default)(query.filters) && query.filters.length && (0, _isArray.default)(query.filteredValue) && query.filteredValue.length));
222
+ const filteredDataSource = this.filterDataSource(dataSource, (0, _filter2.default)(queries).call(queries, query => {
223
+ /**
224
+ * 这里无需判断 filteredValue 是否为数组,初始化时它是 `undefined`,点击选择空时为 `[]`
225
+ * 初始化时我们应该用 `defaultFilteredValue`,点击后我们应该用 `filteredValue`
226
+ *
227
+ * There is no need to judge whether `filteredValue` is an array here, because it is `undefined` when initialized, and `[]` when you click to select empty
228
+ * When initializing we should use `defaultFilteredValue`, after clicking we should use `filteredValue`
229
+ */
230
+ const currentFilteredValue = query.filteredValue ? query.filteredValue : query.defaultFilteredValue;
231
+ return (0, _isFunction2.default)(query.onFilter) && (0, _isArray.default)(query.filters) && query.filters.length && (0, _isArray.default)(currentFilteredValue) && currentFilteredValue.length;
232
+ }));
223
233
  const sortedDataSource = this.sortDataSource(filteredDataSource, (0, _filter2.default)(queries).call(queries, query => query && (0, _isFunction2.default)(query.sorter)));
224
234
  return sortedDataSource;
225
235
  }
@@ -375,10 +385,12 @@ class TableFoundation extends _foundation.default {
375
385
  const {
376
386
  onFilter,
377
387
  filteredValue,
378
- filterChildrenRecord
388
+ filterChildrenRecord,
389
+ defaultFilteredValue
379
390
  } = filterObj;
391
+ const currentFilteredValue = (0, _isArray.default)(filteredValue) ? filteredValue : defaultFilteredValue;
380
392
 
381
- if (typeof onFilter === 'function' && (0, _isArray.default)(filteredValue) && filteredValue.length) {
393
+ if (typeof onFilter === 'function' && (0, _isArray.default)(currentFilteredValue) && currentFilteredValue.length) {
382
394
  hasValidFilters = true;
383
395
 
384
396
  if (filteredData === null) {
@@ -388,7 +400,7 @@ class TableFoundation extends _foundation.default {
388
400
  filteredData = new _map.default();
389
401
  }
390
402
 
391
- (0, _each2.default)(filteredValue, value => {
403
+ (0, _each2.default)(currentFilteredValue, value => {
392
404
  (0, _each2.default)(dataSource, record => {
393
405
  const childrenRecords = (0, _get2.default)(record, childrenRecordName);
394
406
  const recordKey = this.getRecordKey(record);
@@ -2,7 +2,7 @@ declare const cssClasses: {
2
2
  readonly PREFIX: "semi-tooltip";
3
3
  };
4
4
  declare const strings: {
5
- readonly POSITION_SET: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver"];
5
+ readonly POSITION_SET: readonly ["top", "topLeft", "topRight", "left", "leftTop", "leftBottom", "right", "rightTop", "rightBottom", "bottom", "bottomLeft", "bottomRight", "leftTopOver", "rightTopOver", "leftBottomOver", "rightBottomOver"];
6
6
  readonly TRIGGER_SET: readonly ["hover", "focus", "click", "custom"];
7
7
  readonly STATUS_DISABLED: "disabled";
8
8
  readonly STATUS_LOADING: "loading";
@@ -15,7 +15,7 @@ const cssClasses = {
15
15
  };
16
16
  exports.cssClasses = cssClasses;
17
17
  const strings = {
18
- POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver'],
18
+ POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver', 'leftBottomOver', 'rightBottomOver'],
19
19
  TRIGGER_SET: ['hover', 'focus', 'click', 'custom'],
20
20
  STATUS_DISABLED: 'disabled',
21
21
  STATUS_LOADING: 'loading'
@@ -548,6 +548,19 @@ class Tooltip extends _foundation.default {
548
548
  translateX = -1;
549
549
  break;
550
550
 
551
+ case 'leftBottomOver':
552
+ left = triggerRect.left;
553
+ top = triggerRect.bottom;
554
+ translateY = -1;
555
+ break;
556
+
557
+ case 'rightBottomOver':
558
+ left = triggerRect.right;
559
+ top = triggerRect.bottom;
560
+ translateX = -1;
561
+ translateY = -1;
562
+ break;
563
+
551
564
  default:
552
565
  break;
553
566
  }
@@ -669,12 +682,16 @@ class Tooltip extends _foundation.default {
669
682
 
670
683
  const shouldReverseTop = clientTop < wrapperRect.height + spacing && restClientBottom > wrapperRect.height + spacing;
671
684
  const shouldReverseLeft = clientLeft < wrapperRect.width + spacing && restClientRight > wrapperRect.width + spacing;
672
- const sholdReverseBottom = restClientBottom < wrapperRect.height + spacing && clientTop > wrapperRect.height + spacing;
685
+ const shouldReverseBottom = restClientBottom < wrapperRect.height + spacing && clientTop > wrapperRect.height + spacing;
673
686
  const shouldReverseRight = restClientRight < wrapperRect.width + spacing && clientLeft > wrapperRect.width + spacing;
687
+ const shouldReverseTopOver = restClientTop < wrapperRect.height + spacing && clientBottom > wrapperRect.height + spacing;
688
+ const shouldReverseBottomOver = clientBottom < wrapperRect.height + spacing && restClientTop > wrapperRect.height + spacing;
674
689
  const shouldReverseTopSide = restClientTop < wrapperRect.height && clientBottom > wrapperRect.height;
675
690
  const shouldReverseBottomSide = clientBottom < wrapperRect.height && restClientTop > wrapperRect.height;
676
691
  const shouldReverseLeftSide = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
677
692
  const shouldReverseRightSide = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
693
+ const shouldReverseLeftOver = restClientLeft < wrapperRect.width && clientRight > wrapperRect.width;
694
+ const shouldReverseRightOver = clientRight < wrapperRect.width && restClientLeft > wrapperRect.width;
678
695
 
679
696
  switch (position) {
680
697
  case 'top':
@@ -736,14 +753,14 @@ class Tooltip extends _foundation.default {
736
753
  break;
737
754
 
738
755
  case 'bottom':
739
- if (sholdReverseBottom) {
756
+ if (shouldReverseBottom) {
740
757
  position = this._reversePos(position, true);
741
758
  }
742
759
 
743
760
  break;
744
761
 
745
762
  case 'bottomLeft':
746
- if (sholdReverseBottom) {
763
+ if (shouldReverseBottom) {
747
764
  position = this._reversePos(position, true);
748
765
  }
749
766
 
@@ -754,7 +771,7 @@ class Tooltip extends _foundation.default {
754
771
  break;
755
772
 
756
773
  case 'bottomRight':
757
- if (sholdReverseBottom) {
774
+ if (shouldReverseBottom) {
758
775
  position = this._reversePos(position, true);
759
776
  }
760
777
 
@@ -793,6 +810,50 @@ class Tooltip extends _foundation.default {
793
810
 
794
811
  break;
795
812
 
813
+ case 'leftTopOver':
814
+ if (shouldReverseTopOver) {
815
+ position = this._reversePos(position, true);
816
+ }
817
+
818
+ if (shouldReverseLeftOver) {
819
+ position = this._reversePos(position);
820
+ }
821
+
822
+ break;
823
+
824
+ case 'leftBottomOver':
825
+ if (shouldReverseBottomOver) {
826
+ position = this._reversePos(position, true);
827
+ }
828
+
829
+ if (shouldReverseLeftOver) {
830
+ position = this._reversePos(position);
831
+ }
832
+
833
+ break;
834
+
835
+ case 'rightTopOver':
836
+ if (shouldReverseTopOver) {
837
+ position = this._reversePos(position, true);
838
+ }
839
+
840
+ if (shouldReverseRightOver) {
841
+ position = this._reversePos(position);
842
+ }
843
+
844
+ break;
845
+
846
+ case 'rightBottomOver':
847
+ if (shouldReverseBottomOver) {
848
+ position = this._reversePos(position, true);
849
+ }
850
+
851
+ if (shouldReverseRightOver) {
852
+ position = this._reversePos(position);
853
+ }
854
+
855
+ break;
856
+
796
857
  default:
797
858
  break;
798
859
  }
@@ -128,6 +128,7 @@ export interface Virtualize {
128
128
  height?: number | string;
129
129
  width?: number | string;
130
130
  }
131
+ export declare type CheckRelation = 'related' | 'unRelated';
131
132
  export interface BasicTreeProps {
132
133
  autoExpandParent?: boolean;
133
134
  autoExpandWhenDragEnter?: boolean;
@@ -183,6 +184,7 @@ export interface BasicTreeProps {
183
184
  value?: BasicValue;
184
185
  virtualize?: Virtualize;
185
186
  icon?: any;
187
+ checkRelation?: CheckRelation;
186
188
  'aria-label'?: string;
187
189
  }
188
190
  export interface BasicTreeInnerData {
@@ -193,6 +195,7 @@ export interface BasicTreeInnerData {
193
195
  selectedKeys: string[];
194
196
  checkedKeys: Set<string>;
195
197
  halfCheckedKeys: Set<string>;
198
+ realCheckedKeys: Set<string>;
196
199
  motionKeys: Set<string>;
197
200
  motionType: string;
198
201
  expandedKeys: Set<string>;
@@ -242,7 +245,7 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
242
245
  getCopyFromState(items: string[] | string): Partial<BasicTreeInnerData>;
243
246
  getTreeNodeProps(key: string): BasicTreeNodeProps;
244
247
  notifyJsonChange(key: string[] | string, e: any): void;
245
- notifyMultipleChange(key: string[] | string, e: any): void;
248
+ notifyMultipleChange(key: string[], e: any): void;
246
249
  notifyChange(key: string[] | string, e: any): void;
247
250
  handleInputChange(sugInput: string): void;
248
251
  handleNodeSelect(e: any, treeNode: BasicTreeNodeProps): void;
@@ -112,6 +112,7 @@ class TreeFoundation extends _foundation.default {
112
112
  selectedKeys = [],
113
113
  checkedKeys = new _set.default([]),
114
114
  halfCheckedKeys = new _set.default([]),
115
+ realCheckedKeys = new _set.default([]),
115
116
  keyEntities = {},
116
117
  filteredKeys = new _set.default([]),
117
118
  inputValue = '',
@@ -121,13 +122,26 @@ class TreeFoundation extends _foundation.default {
121
122
  disabledKeys = new _set.default([])
122
123
  } = this.getStates();
123
124
  const {
124
- treeNodeFilterProp
125
+ treeNodeFilterProp,
126
+ checkRelation
125
127
  } = this.getProps();
126
128
  const entity = keyEntities[key];
127
129
  const notExist = !entity;
128
130
 
129
131
  if (notExist) {
130
132
  return null;
133
+ } // if checkRelation is invalid, the checked status of node will be false
134
+
135
+
136
+ let realChecked = false;
137
+ let realHalfChecked = false;
138
+
139
+ if (checkRelation === 'related') {
140
+ realChecked = checkedKeys.has(key);
141
+ realHalfChecked = halfCheckedKeys.has(key);
142
+ } else if (checkRelation === 'unRelated') {
143
+ realChecked = realCheckedKeys.has(key);
144
+ realHalfChecked = false;
131
145
  }
132
146
 
133
147
  const isSearching = Boolean(inputValue);
@@ -135,8 +149,8 @@ class TreeFoundation extends _foundation.default {
135
149
  eventKey: key,
136
150
  expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
137
151
  selected: (0, _includes.default)(selectedKeys).call(selectedKeys, key),
138
- checked: checkedKeys.has(key),
139
- halfChecked: halfCheckedKeys.has(key),
152
+ checked: realChecked,
153
+ halfChecked: realHalfChecked,
140
154
  pos: String(entity ? entity.pos : ''),
141
155
  level: entity.level,
142
156
  filtered: filteredKeys.has(key),
@@ -168,10 +182,17 @@ class TreeFoundation extends _foundation.default {
168
182
  keyEntities
169
183
  } = this.getStates();
170
184
  const {
171
- leafOnly
185
+ leafOnly,
186
+ checkRelation
172
187
  } = this.getProps();
173
188
  let value;
174
- const keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly);
189
+ let keyList = [];
190
+
191
+ if (checkRelation === 'related') {
192
+ keyList = (0, _treeUtil.normalizeKeyList)(key, keyEntities, leafOnly);
193
+ } else if (checkRelation === 'unRelated') {
194
+ keyList = key;
195
+ }
175
196
 
176
197
  if (this.getProp('onChangeWithObject')) {
177
198
  value = (0, _map.default)(keyList).call(keyList, itemKey => keyEntities[itemKey].data);
@@ -376,30 +397,58 @@ class TreeFoundation extends _foundation.default {
376
397
 
377
398
  handleMultipleSelect(e, treeNode) {
378
399
  const {
379
- disableStrictly
380
- } = this.getProps(); // eventKey: The key value of the currently clicked node
400
+ disableStrictly,
401
+ checkRelation
402
+ } = this.getProps();
403
+ const {
404
+ realCheckedKeys
405
+ } = this.getStates(); // eventKey: The key value of the currently clicked node
381
406
 
382
407
  const {
383
408
  checked,
384
409
  eventKey,
385
410
  data
386
- } = treeNode; // Find the checked state of the current node
411
+ } = treeNode;
387
412
 
388
- const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
389
- const {
390
- checkedKeys,
391
- halfCheckedKeys
392
- } = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
413
+ if (checkRelation === 'related') {
414
+ // Find the checked state of the current node
415
+ const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
416
+ const {
417
+ checkedKeys,
418
+ halfCheckedKeys
419
+ } = disableStrictly ? this.calcNonDisabedCheckedKeys(eventKey, targetStatus) : this.calcCheckedKeys(eventKey, targetStatus);
393
420
 
394
- this._adapter.notifySelect(eventKey, targetStatus, data);
421
+ this._adapter.notifySelect(eventKey, targetStatus, data);
395
422
 
396
- this.notifyChange([...checkedKeys], e);
423
+ this.notifyChange([...checkedKeys], e);
397
424
 
398
- if (!this._isControlledComponent()) {
399
- this._adapter.updateState({
400
- checkedKeys,
401
- halfCheckedKeys
402
- });
425
+ if (!this._isControlledComponent()) {
426
+ this._adapter.updateState({
427
+ checkedKeys,
428
+ halfCheckedKeys
429
+ });
430
+ }
431
+ } else if (checkRelation === 'unRelated') {
432
+ const newRealCheckedKeys = new _set.default(realCheckedKeys);
433
+ let targetStatus;
434
+
435
+ if (realCheckedKeys.has(eventKey)) {
436
+ newRealCheckedKeys.delete(eventKey);
437
+ targetStatus = false;
438
+ } else {
439
+ newRealCheckedKeys.add(eventKey);
440
+ targetStatus = true;
441
+ }
442
+
443
+ this._adapter.notifySelect(eventKey, targetStatus, data);
444
+
445
+ this.notifyChange([...newRealCheckedKeys], e);
446
+
447
+ if (!this._isControlledComponent()) {
448
+ this._adapter.updateState({
449
+ realCheckedKeys: newRealCheckedKeys
450
+ });
451
+ }
403
452
  }
404
453
  }
405
454
 
@@ -27,7 +27,7 @@ export interface BasicOnChange {
27
27
  (node: BasicTreeNodeData[] | BasicTreeNodeData, e: any): void;
28
28
  (value: BasicTreeNodeData['value'] | Array<BasicTreeNodeData['value']>, node: BasicTreeNodeData[] | BasicTreeNodeData, e: any): void;
29
29
  }
30
- export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize' | 'renderFullLabel' | 'renderLabel' | 'autoExpandParent' | 'className' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'defaultValue' | 'disabled' | 'emptyContent' | 'expandAction' | 'expandedKeys' | 'filterTreeNode' | 'labelEllipsis' | 'leafOnly' | 'multiple' | 'onChangeWithObject' | 'showClear' | 'showFilteredOnly' | 'style' | 'treeData' | 'treeNodeFilterProp' | 'value' | 'onExpand' | 'onSearch' | 'expandAll' | 'disableStrictly' | 'aria-label'> {
30
+ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize' | 'renderFullLabel' | 'renderLabel' | 'autoExpandParent' | 'className' | 'defaultExpandAll' | 'defaultExpandedKeys' | 'defaultValue' | 'disabled' | 'emptyContent' | 'expandAction' | 'expandedKeys' | 'filterTreeNode' | 'labelEllipsis' | 'leafOnly' | 'multiple' | 'onChangeWithObject' | 'showClear' | 'showFilteredOnly' | 'style' | 'treeData' | 'treeNodeFilterProp' | 'value' | 'onExpand' | 'onSearch' | 'expandAll' | 'disableStrictly' | 'aria-label' | 'checkRelation'> {
31
31
  motion?: Motion;
32
32
  mouseEnterDelay?: number;
33
33
  mouseLeaveDelay?: number;
@@ -68,7 +68,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps, 'virtualize'
68
68
  onVisibleChange?: (isVisible: boolean) => void;
69
69
  onLoad?: (keys: Set<string>, data: BasicTreeNodeData) => void;
70
70
  }
71
- export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys'> {
71
+ export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData, 'keyEntities' | 'treeData' | 'flattenNodes' | 'selectedKeys' | 'checkedKeys' | 'halfCheckedKeys' | 'motionKeys' | 'motionType' | 'expandedKeys' | 'filteredKeys' | 'filteredExpandedKeys' | 'filteredShownKeys' | 'cachedKeyValuePairs' | 'inputValue' | 'disabledKeys' | 'loadedKeys' | 'loadingKeys' | 'realCheckedKeys'> {
72
72
  inputTriggerFocus: boolean;
73
73
  isOpen: boolean;
74
74
  isInput: boolean;
@@ -82,7 +82,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
82
82
  registerClickOutsideHandler: (cb: (e: any) => void) => void;
83
83
  unregisterClickOutsideHandler: () => void;
84
84
  rePositionDropdown: () => void;
85
- updateState: (states: Pick<S, keyof S>) => void;
85
+ updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
86
86
  notifySelect: (selectedKeys: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
87
87
  notifySearch: (input: string) => void;
88
88
  cacheFlattenNodes: (bool: boolean) => void;