@douyinfe/semi-foundation 2.1.3 → 2.2.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 (106) hide show
  1. package/cascader/cascader.scss +1 -1
  2. package/cascader/constants.ts +4 -0
  3. package/cascader/foundation.ts +29 -15
  4. package/cascader/util.ts +13 -0
  5. package/checkbox/checkbox.scss +25 -1
  6. package/checkbox/checkboxFoundation.ts +15 -4
  7. package/checkbox/variables.scss +6 -1
  8. package/datePicker/datePicker.scss +18 -0
  9. package/datePicker/monthsGridFoundation.ts +101 -8
  10. package/lib/cjs/cascader/cascader.css +2 -2
  11. package/lib/cjs/cascader/cascader.scss +1 -1
  12. package/lib/cjs/cascader/constants.d.ts +3 -0
  13. package/lib/cjs/cascader/constants.js +6 -1
  14. package/lib/cjs/cascader/foundation.d.ts +4 -1
  15. package/lib/cjs/cascader/foundation.js +24 -11
  16. package/lib/cjs/cascader/util.d.ts +1 -0
  17. package/lib/cjs/cascader/util.js +17 -0
  18. package/lib/cjs/checkbox/checkbox.css +21 -2
  19. package/lib/cjs/checkbox/checkbox.scss +25 -1
  20. package/lib/cjs/checkbox/checkboxFoundation.d.ts +11 -4
  21. package/lib/cjs/checkbox/checkboxFoundation.js +7 -0
  22. package/lib/cjs/checkbox/variables.scss +6 -1
  23. package/lib/cjs/datePicker/datePicker.css +6 -0
  24. package/lib/cjs/datePicker/datePicker.scss +18 -0
  25. package/lib/cjs/datePicker/monthsGridFoundation.d.ts +35 -3
  26. package/lib/cjs/datePicker/monthsGridFoundation.js +139 -6
  27. package/lib/cjs/modal/modal.css +1 -1
  28. package/lib/cjs/modal/modalFoundation.d.ts +2 -2
  29. package/lib/cjs/modal/variables.scss +1 -1
  30. package/lib/cjs/radio/radio.css +33 -2
  31. package/lib/cjs/radio/radio.scss +44 -1
  32. package/lib/cjs/radio/variables.scss +12 -2
  33. package/lib/cjs/rating/rating.css +3 -0
  34. package/lib/cjs/rating/rating.scss +4 -0
  35. package/lib/cjs/select/select.scss +1 -1
  36. package/lib/cjs/sideSheet/sideSheet.css +1 -1
  37. package/lib/cjs/sideSheet/variables.scss +1 -1
  38. package/lib/cjs/table/table.css +2 -2
  39. package/lib/cjs/table/table.scss +2 -2
  40. package/lib/cjs/table/variables.scss +3 -0
  41. package/lib/cjs/timeline/timeline.css +3 -0
  42. package/lib/cjs/timeline/timeline.scss +5 -1
  43. package/lib/cjs/tree/treeUtil.js +14 -14
  44. package/lib/cjs/upload/foundation.d.ts +1 -0
  45. package/lib/cjs/upload/foundation.js +106 -0
  46. package/lib/cjs/upload/rtl.scss +0 -4
  47. package/lib/cjs/upload/upload.css +31 -19
  48. package/lib/cjs/upload/upload.scss +31 -8
  49. package/lib/cjs/upload/variables.scss +6 -2
  50. package/lib/es/cascader/cascader.css +2 -2
  51. package/lib/es/cascader/cascader.scss +1 -1
  52. package/lib/es/cascader/constants.d.ts +3 -0
  53. package/lib/es/cascader/constants.js +6 -1
  54. package/lib/es/cascader/foundation.d.ts +4 -1
  55. package/lib/es/cascader/foundation.js +24 -12
  56. package/lib/es/cascader/util.d.ts +1 -0
  57. package/lib/es/cascader/util.js +14 -0
  58. package/lib/es/checkbox/checkbox.css +21 -2
  59. package/lib/es/checkbox/checkbox.scss +25 -1
  60. package/lib/es/checkbox/checkboxFoundation.d.ts +11 -4
  61. package/lib/es/checkbox/checkboxFoundation.js +7 -0
  62. package/lib/es/checkbox/variables.scss +6 -1
  63. package/lib/es/datePicker/datePicker.css +6 -0
  64. package/lib/es/datePicker/datePicker.scss +18 -0
  65. package/lib/es/datePicker/monthsGridFoundation.d.ts +35 -3
  66. package/lib/es/datePicker/monthsGridFoundation.js +139 -6
  67. package/lib/es/modal/modal.css +1 -1
  68. package/lib/es/modal/modalFoundation.d.ts +2 -2
  69. package/lib/es/modal/variables.scss +1 -1
  70. package/lib/es/radio/radio.css +33 -2
  71. package/lib/es/radio/radio.scss +44 -1
  72. package/lib/es/radio/variables.scss +12 -2
  73. package/lib/es/rating/rating.css +3 -0
  74. package/lib/es/rating/rating.scss +4 -0
  75. package/lib/es/select/select.scss +1 -1
  76. package/lib/es/sideSheet/sideSheet.css +1 -1
  77. package/lib/es/sideSheet/variables.scss +1 -1
  78. package/lib/es/table/table.css +2 -2
  79. package/lib/es/table/table.scss +2 -2
  80. package/lib/es/table/variables.scss +3 -0
  81. package/lib/es/timeline/timeline.css +3 -0
  82. package/lib/es/timeline/timeline.scss +5 -1
  83. package/lib/es/tree/treeUtil.js +13 -12
  84. package/lib/es/upload/foundation.d.ts +1 -0
  85. package/lib/es/upload/foundation.js +107 -0
  86. package/lib/es/upload/rtl.scss +0 -4
  87. package/lib/es/upload/upload.css +31 -19
  88. package/lib/es/upload/upload.scss +31 -8
  89. package/lib/es/upload/variables.scss +6 -2
  90. package/modal/modalFoundation.ts +2 -2
  91. package/modal/variables.scss +1 -1
  92. package/package.json +3 -3
  93. package/radio/radio.scss +44 -1
  94. package/radio/variables.scss +12 -2
  95. package/rating/rating.scss +4 -0
  96. package/select/select.scss +1 -1
  97. package/sideSheet/variables.scss +1 -1
  98. package/table/table.scss +2 -2
  99. package/table/variables.scss +3 -0
  100. package/timeline/timeline.scss +5 -1
  101. package/tree/treeUtil.ts +6 -2
  102. package/tsconfig.json +2 -1
  103. package/upload/foundation.ts +81 -0
  104. package/upload/rtl.scss +0 -4
  105. package/upload/upload.scss +31 -8
  106. package/upload/variables.scss +6 -2
@@ -73,6 +73,8 @@
73
73
  display: flex;
74
74
  flex-wrap: wrap;
75
75
  flex-shrink: 0;
76
+ gap: 8px;
77
+ margin-bottom: 8px;
76
78
  }
77
79
  .semi-upload-file-list-main p {
78
80
  display: flex;
@@ -99,8 +101,6 @@
99
101
  justify-content: space-between;
100
102
  height: 52px;
101
103
  width: 250px;
102
- margin-right: 8px;
103
- margin-bottom: 8px;
104
104
  background-color: var(--semi-color-fill-0);
105
105
  cursor: pointer;
106
106
  }
@@ -235,16 +235,16 @@
235
235
  flex-direction: column;
236
236
  }
237
237
  .semi-upload-picture[x-prompt-pos=bottom] .semi-upload-prompt {
238
- order: 2;
238
+ order: 1;
239
239
  }
240
240
  .semi-upload-picture[x-prompt-pos=bottom] .semi-upload-add {
241
- order: 1;
241
+ order: 0;
242
242
  }
243
243
  .semi-upload-picture[x-prompt-pos=right] .semi-upload-prompt {
244
- order: 2;
244
+ order: 1;
245
245
  }
246
246
  .semi-upload-picture[x-prompt-pos=right] .semi-upload-add {
247
- order: 1;
247
+ order: 0;
248
248
  }
249
249
  .semi-upload-picture-add {
250
250
  background-color: var(--semi-color-fill-0);
@@ -281,11 +281,14 @@
281
281
  margin-bottom: 0;
282
282
  }
283
283
  .semi-upload-picture-file-card {
284
+ display: flex;
285
+ align-items: center;
286
+ justify-content: center;
284
287
  height: 96px;
285
288
  width: 96px;
289
+ border-radius: var(--semi-border-radius-small);
286
290
  position: relative;
287
- margin-right: 8px;
288
- margin-bottom: 8px;
291
+ overflow: hidden;
289
292
  }
290
293
  .semi-upload-picture-file-card img {
291
294
  height: 96px;
@@ -296,7 +299,7 @@
296
299
  .semi-upload-picture-file-card-close {
297
300
  width: 16px;
298
301
  height: 16px;
299
- background-color: var(--semi-overlay-bg);
302
+ background-color: var(--semi-color-overlay-bg);
300
303
  position: absolute;
301
304
  top: 8px;
302
305
  right: 8px;
@@ -350,6 +353,22 @@
350
353
  color: var(--semi-color-white);
351
354
  transform: translate3D(-50%, -50%, 0);
352
355
  }
356
+ .semi-upload-picture-file-card-pic-info {
357
+ display: inline-flex;
358
+ box-sizing: border-box;
359
+ justify-content: space-between;
360
+ align-items: center;
361
+ position: absolute;
362
+ width: 100%;
363
+ height: 24px;
364
+ padding: 0 10px;
365
+ bottom: 0;
366
+ left: 0;
367
+ color: var(--semi-color-white);
368
+ font-size: 12px;
369
+ font-weight: 600;
370
+ background: linear-gradient(0deg, rgba(22, 22, 26, 0.3) 0%, rgba(22, 22, 26, 0) 77.08%);
371
+ }
353
372
  .semi-upload-picture-file-card-icon-loading, .semi-upload-picture-file-card-icon-error {
354
373
  position: absolute;
355
374
  bottom: 6px;
@@ -362,6 +381,9 @@
362
381
  .semi-upload-picture-file-card-show-pointer {
363
382
  cursor: pointer;
364
383
  }
384
+ .semi-upload-picture-file-card-error {
385
+ outline: 1px solid var(--semi-color-danger);
386
+ }
365
387
  .semi-upload-drag-area {
366
388
  border-radius: var(--semi-border-radius-small);
367
389
  border: 2px dashed var(--semi-color-border);
@@ -442,11 +464,6 @@
442
464
  .semi-portal-rtl .semi-upload-file-list-title-clear {
443
465
  display: inline-block;
444
466
  }
445
- .semi-rtl .semi-upload-file-card,
446
- .semi-portal-rtl .semi-upload-file-card {
447
- margin-right: 0;
448
- margin-left: 8px;
449
- }
450
467
  .semi-rtl .semi-upload-file-card-info-size,
451
468
  .semi-portal-rtl .semi-upload-file-card-info-size {
452
469
  margin-left: 0;
@@ -463,11 +480,6 @@
463
480
  margin-right: 0;
464
481
  margin-left: 2px;
465
482
  }
466
- .semi-rtl .semi-upload-picture-file-card,
467
- .semi-portal-rtl .semi-upload-picture-file-card {
468
- margin-right: 0;
469
- margin-left: 8px;
470
- }
471
483
  .semi-rtl .semi-upload-picture-file-card-close,
472
484
  .semi-portal-rtl .semi-upload-picture-file-card-close {
473
485
  right: auto;
@@ -99,6 +99,8 @@ $module: #{$prefix}-upload;
99
99
  display: flex;
100
100
  flex-wrap: wrap;
101
101
  flex-shrink: 0;
102
+ gap: $spacing-upload_picture_file_card-gap;
103
+ margin-bottom: $spacing-upload_picture_file_card-marginBottom;
102
104
 
103
105
  p {
104
106
  @include ver-center;
@@ -130,8 +132,6 @@ $module: #{$prefix}-upload;
130
132
  justify-content: space-between;
131
133
  height: $height-upload_file_card;
132
134
  width: $width-upload_file_card;
133
- margin-right: $spacing-tight;
134
- margin-bottom: $spacing-tight;
135
135
  background-color: $color-upload_card-bg;
136
136
  cursor: pointer;
137
137
 
@@ -292,21 +292,21 @@ $module: #{$prefix}-upload;
292
292
  flex-direction: column;
293
293
 
294
294
  .#{$module}-prompt {
295
- order: 2;
295
+ order: 1;
296
296
  }
297
297
 
298
298
  .#{$module}-add {
299
- order: 1;
299
+ order: 0;
300
300
  }
301
301
  }
302
302
 
303
303
  &[x-prompt-pos="right"] {
304
304
  .#{$module}-prompt {
305
- order: 2;
305
+ order: 1;
306
306
  }
307
307
 
308
308
  .#{$module}-add {
309
- order: 1;
309
+ order: 0;
310
310
  }
311
311
  }
312
312
 
@@ -353,11 +353,14 @@ $module: #{$prefix}-upload;
353
353
  }
354
354
 
355
355
  &-file-card {
356
+ display: flex;
357
+ align-items: center;
358
+ justify-content: center;
356
359
  height: $height-upload_file_pic_card;
357
360
  width: $width-upload_file_pic_card;
361
+ border-radius: $radius-upload_picture_file_card_img;
358
362
  position: relative;
359
- margin-right: $spacing-upload_picture_file_card-marginRight;
360
- margin-bottom: $spacing-upload_picture_file_card-marginBottom;
363
+ overflow: hidden;
361
364
 
362
365
  img {
363
366
  height: $width-upload_picture_file_card_img;
@@ -429,6 +432,22 @@ $module: #{$prefix}-upload;
429
432
  color: $color-upload_replace-text;
430
433
  transform: translate3D(-50%, -50%, 0);
431
434
  }
435
+ &-pic-info {
436
+ display: inline-flex;
437
+ box-sizing: border-box;
438
+ justify-content: space-between;
439
+ align-items: center;
440
+ position: absolute;
441
+ width: 100%;
442
+ height: 24px;
443
+ padding: 0 10px;
444
+ bottom: 0;
445
+ left: 0;
446
+ color: $color-upload_picture_file_card_pic_info-text;
447
+ font-size: $font-upload_picture_file_card_pic_info-fontSize;
448
+ font-weight: $font-upload_picture_file_card_pic_info-fontWeight;
449
+ background: linear-gradient(0deg, rgba(22, 22, 26, 0.3) 0%, rgba(22, 22, 26, 0) 77.08%);
450
+ }
432
451
 
433
452
  &-icon-loading,
434
453
  &-icon-error {
@@ -445,6 +464,10 @@ $module: #{$prefix}-upload;
445
464
  &-show-pointer {
446
465
  cursor: pointer;
447
466
  }
467
+
468
+ &-error {
469
+ outline: 1px solid $color-upload_picture_file_card_error-border;
470
+ }
448
471
  }
449
472
  }
450
473
 
@@ -22,8 +22,10 @@ $color-upload-icon: var(--semi-color-tertiary); // 图片墙上传图标加号
22
22
  $color-upload_pic_add-bg-active: var(--semi-color-fill-2); // 图片墙上传背景色 - 按下
23
23
  $color-upload_pic_add-bg-hover: var(--semi-color-fill-1); // 图片墙上传背景色 - 悬浮
24
24
  $color-upload_pic_add-bg: var(--semi-color-fill-0); // 图片墙上传背景色 - 默认
25
- $color-upload_pic_remove-bg: var(--semi-overlay-bg); // 图片墙上传移除图标颜色
25
+ $color-upload_pic_remove-bg: var(--semi-color-overlay-bg); // 图片墙上传移除图标颜色
26
26
  $color-upload_picture_file_card_loading_error-icon: var(--semi-color-danger); // 图片墙上传移除图标颜色
27
+ $color-upload_picture_file_card_error-border: var(--semi-color-danger); // 图片墙上传移除图标颜色
28
+ $color-upload_picture_file_card_pic_info-text: var(--semi-color-white); // 图片墙图片信息(序号)文字颜色
27
29
  $color-upload_preview-icon: var(--semi-color-text-2); // 上传文件卡片文本颜色
28
30
  $color-upload_retry-text: var(--semi-color-primary); // 上传文件卡片重新上传按钮文本颜色
29
31
  $color-upload_replace-text: var(--semi-color-white); // 上传文件卡片重新替换按钮文本颜色
@@ -56,7 +58,7 @@ $spacing-upload_file_card_info_progress-marginTop: 4px; // 上传文件卡片进
56
58
  $spacing-upload_file_card_close-marginLeft: $spacing-tight; // 上传文件卡片删除按钮左侧外边距
57
59
  $spacing-upload_file_card_close-marginRight: $spacing-tight; // 上传文件卡片删除按钮右侧外边距
58
60
  $spacing-upload_file_card_icon-marginRight: $spacing-super-tight; // 上传文件卡片图标右侧外边距
59
- $spacing-upload_picture_file_card-marginRight: $spacing-tight; // 图片墙上传卡片右侧外边距
61
+ $spacing-upload_picture_file_card-gap: $spacing-tight; // 图片墙卡片之间边距
60
62
  $spacing-upload_picture_file_card-marginBottom: $spacing-tight; // 图片墙上传卡片底部外边距
61
63
  $spacing-upload_picture_file_card_close-top: 8px; // 图片墙上传卡片删除按钮顶部位置
62
64
  $spacing-upload_picture_file_card_close-right: 8px; // 图片墙上传卡片删除右侧位置
@@ -79,3 +81,5 @@ $radius-upload_drag_area: var(--semi-border-radius-small); // 可拖拽上传拖
79
81
  $font-upload_file_card_info_name-fontWeight: $font-weight-bold; // 上传文件卡片文件名字重
80
82
  $font-upload_file_card_info_size-fontWeight: $font-weight-regular; // 上传文件卡片文件尺寸字重
81
83
  $font-upload_drag_area_tips-fontWeight: 600; // 可拖拽上传提示文本字重
84
+ $font-upload_picture_file_card_pic_info-fontSize: 12px; // 图片墙图片信息字体大小
85
+ $font-upload_picture_file_card_pic_info-fontWeight: 600; // 图片墙图片信息文本字重
@@ -99,11 +99,11 @@
99
99
  .semi-cascader-selection-tag:first-child {
100
100
  margin-left: 0;
101
101
  }
102
- .semi-cascader-selection-tag-disabled {
102
+ .semi-cascader-selection-tag-disabled.semi-tag {
103
103
  color: var(--semi-color-disabled-text);
104
104
  cursor: not-allowed;
105
105
  }
106
- .semi-cascader-selection-tag-disabled .semi-tag-close {
106
+ .semi-cascader-selection-tag-disabled.semi-tag .semi-tag-close {
107
107
  color: var(--semi-color-disabled-text);
108
108
  cursor: not-allowed;
109
109
  pointer-events: none;
@@ -116,7 +116,7 @@ $module: #{$prefix}-cascader;
116
116
  margin-left: 0;
117
117
  }
118
118
 
119
- &-disabled {
119
+ &-disabled.#{$prefix}-tag {
120
120
  color: $color-cascader_input_disabled-text-default;
121
121
  cursor: not-allowed;
122
122
 
@@ -9,6 +9,9 @@ declare const strings: {
9
9
  readonly IS_VALUE: "isValue";
10
10
  readonly SHOW_NEXT_BY_CLICK: "click";
11
11
  readonly SHOW_NEXT_BY_HOVER: "hover";
12
+ readonly LEAF_ONLY_MERGE_TYPE: "leafOnly";
13
+ readonly AUTO_MERGE_VALUE_MERGE_TYPE: "autoMergeValue";
14
+ readonly NONE_MERGE_TYPE: "none";
12
15
  };
13
16
  declare const numbers: {};
14
17
  export { cssClasses, strings, numbers };
@@ -9,7 +9,12 @@ const strings = {
9
9
  IS_KEY: 'isKey',
10
10
  IS_VALUE: 'isValue',
11
11
  SHOW_NEXT_BY_CLICK: 'click',
12
- SHOW_NEXT_BY_HOVER: 'hover'
12
+ SHOW_NEXT_BY_HOVER: 'hover',
13
+
14
+ /* Merge Type */
15
+ LEAF_ONLY_MERGE_TYPE: 'leafOnly',
16
+ AUTO_MERGE_VALUE_MERGE_TYPE: 'autoMergeValue',
17
+ NONE_MERGE_TYPE: 'none'
13
18
  };
14
19
  const numbers = {};
15
20
  export { cssClasses, strings, numbers };
@@ -57,6 +57,7 @@ export interface BasicScrollPanelProps {
57
57
  export interface BasicCascaderProps {
58
58
  mouseEnterDelay?: number;
59
59
  mouseLeaveDelay?: number;
60
+ separator?: string;
60
61
  arrowIcon?: any;
61
62
  changeOnSelect?: boolean;
62
63
  multiple?: boolean;
@@ -96,6 +97,8 @@ export interface BasicCascaderProps {
96
97
  topSlot?: any;
97
98
  showNext?: ShowNextType;
98
99
  disableStrictly?: boolean;
100
+ leafOnly?: boolean;
101
+ enableLeafClick?: boolean;
99
102
  onClear?: () => void;
100
103
  triggerRender?: (props: BasicTriggerRenderProps) => any;
101
104
  onListScroll?: (e: any, panel: BasicScrollPanelProps) => void;
@@ -125,7 +128,7 @@ export interface BasicCascaderInnerData {
125
128
  isHovering: boolean;
126
129
  checkedKeys: Set<string>;
127
130
  halfCheckedKeys: Set<string>;
128
- mergedCheckedKeys: Set<string>;
131
+ resolvedCheckedKeys: Set<string>;
129
132
  loadedKeys: Set<string>;
130
133
  loadingKeys: Set<string>;
131
134
  loading: boolean;
@@ -22,7 +22,8 @@ import _sortInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
22
22
  import _parseInt from "@babel/runtime-corejs3/core-js-stable/parse-int";
23
23
  import BaseFoundation from '../base/foundation';
24
24
  import { filter, findAncestorKeys, calcCheckedKeysForUnchecked, calcCheckedKeysForChecked, calcCheckedKeys, findDescendantKeys, normalizeKeyList } from '../tree/treeUtil';
25
- import { convertDataToEntities, findKeysForValues, normalizedArr, isValid } from './util'; // eslint-disable-next-line max-len
25
+ import { convertDataToEntities, findKeysForValues, normalizedArr, isValid, calcMergeType } from './util';
26
+ import { strings } from './constants'; // eslint-disable-next-line max-len
26
27
 
27
28
  export default class CascaderFoundation extends BaseFoundation {
28
29
  constructor(adapter) {
@@ -535,10 +536,12 @@ export default class CascaderFoundation extends BaseFoundation {
535
536
  }
536
537
 
537
538
  _defaultRenderText(path, displayRender) {
539
+ const separator = this.getProp('separator');
540
+
538
541
  if (displayRender && typeof displayRender === 'function') {
539
542
  return displayRender(path);
540
543
  } else {
541
- return path.join(' / ');
544
+ return path.join(separator);
542
545
  }
543
546
  }
544
547
 
@@ -612,7 +615,8 @@ export default class CascaderFoundation extends BaseFoundation {
612
615
  const {
613
616
  changeOnSelect: allowChange,
614
617
  filterLeafOnly,
615
- multiple
618
+ multiple,
619
+ enableLeafClick
616
620
  } = this.getProps();
617
621
  const {
618
622
  keyEntities,
@@ -646,6 +650,10 @@ export default class CascaderFoundation extends BaseFoundation {
646
650
  this._adapter.updateStates({
647
651
  activeKeys: new _Set(activeKeys)
648
652
  });
653
+
654
+ if (isLeaf && enableLeafClick) {
655
+ this.onItemCheckboxClick(item);
656
+ }
649
657
  } else {
650
658
  this._adapter.notifySelect(data.value);
651
659
 
@@ -695,12 +703,13 @@ export default class CascaderFoundation extends BaseFoundation {
695
703
  const {
696
704
  checkedKeys,
697
705
  keyEntities,
698
- mergedCheckedKeys
706
+ resolvedCheckedKeys
699
707
  } = this.getStates();
700
708
  const {
701
709
  autoMergeValue,
702
710
  max,
703
- disableStrictly
711
+ disableStrictly,
712
+ leafOnly
704
713
  } = this.getProps(); // prev checked status
705
714
 
706
715
  const prevCheckedStatus = checkedKeys.has(key); // next checked status
@@ -711,16 +720,19 @@ export default class CascaderFoundation extends BaseFoundation {
711
720
  checkedKeys: curCheckedKeys,
712
721
  halfCheckedKeys: curHalfCheckedKeys
713
722
  } = disableStrictly ? this.calcNonDisabedCheckedKeys(key, curCheckedStatus) : this.calcCheckedKeys(key, curCheckedStatus);
714
- const curMergedCheckedKeys = new _Set(normalizeKeyList(curCheckedKeys, keyEntities));
715
- const curRealCheckedKeys = autoMergeValue ? curMergedCheckedKeys : curCheckedKeys;
723
+ const mergeType = calcMergeType(autoMergeValue, leafOnly);
724
+ const isLeafOnlyMerge = mergeType === strings.LEAF_ONLY_MERGE_TYPE;
725
+ const isNoneMerge = mergeType === strings.NONE_MERGE_TYPE;
726
+ const curResolvedCheckedKeys = new _Set(normalizeKeyList(curCheckedKeys, keyEntities, isLeafOnlyMerge));
727
+ const curRealCheckedKeys = isNoneMerge ? curCheckedKeys : curResolvedCheckedKeys;
716
728
 
717
729
  if (_isNumber(max)) {
718
- if (autoMergeValue) {
730
+ if (!isNoneMerge) {
719
731
  // When it exceeds max, the quantity is allowed to be reduced, and no further increase is allowed
720
- if (mergedCheckedKeys.size < curMergedCheckedKeys.size && curMergedCheckedKeys.size > max) {
732
+ if (resolvedCheckedKeys.size < curResolvedCheckedKeys.size && curResolvedCheckedKeys.size > max) {
721
733
  const checkedEntities = [];
722
734
 
723
- _forEachInstanceProperty(curMergedCheckedKeys).call(curMergedCheckedKeys, itemKey => {
735
+ _forEachInstanceProperty(curResolvedCheckedKeys).call(curResolvedCheckedKeys, itemKey => {
724
736
  checkedEntities.push(keyEntities[itemKey]);
725
737
  });
726
738
 
@@ -748,7 +760,7 @@ export default class CascaderFoundation extends BaseFoundation {
748
760
  this._adapter.updateStates({
749
761
  checkedKeys: curCheckedKeys,
750
762
  halfCheckedKeys: curHalfCheckedKeys,
751
- mergedCheckedKeys: curMergedCheckedKeys
763
+ resolvedCheckedKeys: curResolvedCheckedKeys
752
764
  });
753
765
  } // The click event during multiple selection will definitely cause the checked state of node to change,
754
766
  // so there is no need to judge the value to change.
@@ -911,7 +923,7 @@ export default class CascaderFoundation extends BaseFoundation {
911
923
  newState.halfCheckedKeys = new _Set([]);
912
924
  newState.selectedKeys = new _Set([]);
913
925
  newState.activeKeys = new _Set([]);
914
- newState.mergedCheckedKeys = new _Set([]);
926
+ newState.resolvedCheckedKeys = new _Set([]);
915
927
 
916
928
  this._adapter.notifyChange([]);
917
929
  } else {
@@ -2,3 +2,4 @@ export declare function isValid(val: any): boolean;
2
2
  export declare function normalizedArr(val: any): any[];
3
3
  export declare function convertDataToEntities(dataNodes: any): any;
4
4
  export declare function findKeysForValues(value: any, keyEntities: any): any[];
5
+ export declare function calcMergeType(autoMergeValue: boolean, leafOnly: boolean): string;
@@ -8,6 +8,7 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
8
8
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
9
9
  import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
10
10
  import _Object$values from "@babel/runtime-corejs3/core-js-stable/object/values";
11
+ import { strings } from './constants';
11
12
 
12
13
  function getPosition(level, index) {
13
14
  var _context;
@@ -88,4 +89,17 @@ export function findKeysForValues(value, keyEntities) {
88
89
  const res = _mapInstanceProperty(_context2 = _filterInstanceProperty(_context3 = _Object$values(keyEntities)).call(_context3, item => _isEqual(item.valuePath, valuePath))).call(_context2, item => item.key);
89
90
 
90
91
  return res;
92
+ }
93
+ export function calcMergeType(autoMergeValue, leafOnly) {
94
+ let mergeType;
95
+
96
+ if (leafOnly) {
97
+ mergeType = strings.LEAF_ONLY_MERGE_TYPE;
98
+ } else if (autoMergeValue) {
99
+ mergeType = strings.AUTO_MERGE_VALUE_MERGE_TYPE;
100
+ } else {
101
+ mergeType = strings.NONE_MERGE_TYPE;
102
+ }
103
+
104
+ return mergeType;
91
105
  }
@@ -36,12 +36,14 @@
36
36
  }
37
37
  .semi-checkbox:hover .semi-checkbox-inner-checked .semi-checkbox-inner-display {
38
38
  background: var(--semi-color-primary-hover);
39
+ box-shadow: none;
39
40
  }
40
41
  .semi-checkbox:active .semi-checkbox-inner-display {
41
42
  background: var(--semi-color-fill-1);
42
43
  }
43
44
  .semi-checkbox:active .semi-checkbox-inner-checked .semi-checkbox-inner-display {
44
45
  background: var(--semi-color-primary-active);
46
+ box-shadow: none;
45
47
  }
46
48
  .semi-checkbox.semi-checkbox-disabled:hover .semi-checkbox-inner-display, .semi-checkbox.semi-checkbox-disabled:active .semi-checkbox-inner-display {
47
49
  background: var(--semi-color-disabled-fill);
@@ -49,6 +51,7 @@
49
51
  }
50
52
  .semi-checkbox.semi-checkbox-disabled:hover .semi-checkbox-inner-checked .semi-checkbox-inner-display, .semi-checkbox.semi-checkbox-disabled:active .semi-checkbox-inner-checked .semi-checkbox-inner-display {
51
53
  background: var(--semi-color-primary-disabled);
54
+ box-shadow: none;
52
55
  }
53
56
  .semi-checkbox-inner {
54
57
  position: relative;
@@ -89,7 +92,7 @@
89
92
  }
90
93
  .semi-checkbox:hover.semi-checkbox-indeterminate .semi-checkbox-inner-display {
91
94
  background: var(--semi-color-primary-hover);
92
- box-shadow: inset 0 0 0 1px var(--semi-color-focus-border);
95
+ box-shadow: none;
93
96
  color: var(--semi-color-white);
94
97
  }
95
98
  .semi-checkbox:hover .semi-checkbox-inner-checked .semi-checkbox-inner-display {
@@ -107,6 +110,7 @@
107
110
  background: var(--semi-color-primary-active);
108
111
  border-color: var(--semi-color-primary-active);
109
112
  color: var(--semi-color-white);
113
+ box-shadow: none;
110
114
  }
111
115
  .semi-checkbox:active .semi-checkbox-inner-checked .semi-checkbox-inner-display {
112
116
  background: var(--semi-color-primary-active);
@@ -158,10 +162,18 @@
158
162
  }
159
163
  .semi-checkbox-cardType_checked {
160
164
  background: var(--semi-color-primary-light-default);
161
- border: 1px solid var(--semi-color-focus-border);
165
+ border: 1px solid var(--semi-color-primary);
162
166
  }
163
167
  .semi-checkbox-cardType_checked:hover {
164
168
  background: var(--semi-color-primary-light-default);
169
+ border-color: var(--semi-color-primary-hover);
170
+ }
171
+ .semi-checkbox-cardType_checked:hover .semi-checkbox-inner-checked .semi-checkbox-inner-display {
172
+ box-shadow: none;
173
+ }
174
+ .semi-checkbox-cardType_checked:active {
175
+ background: var(--semi-color-primary-light-default);
176
+ border-color: var(--semi-color-primary-active);
165
177
  }
166
178
  .semi-checkbox-cardType_disabled:active {
167
179
  background: transparent;
@@ -169,6 +181,13 @@
169
181
  .semi-checkbox-cardType_disabled:hover {
170
182
  background: transparent;
171
183
  }
184
+ .semi-checkbox-cardType_checked_disabled.semi-checkbox-cardType {
185
+ background: var(--semi-color-primary-light-default);
186
+ border: 1px solid var(--semi-color-primary-disabled);
187
+ }
188
+ .semi-checkbox-cardType_checked_disabled.semi-checkbox-cardType:hover .semi-checkbox-inner-checked .semi-checkbox-inner-display {
189
+ box-shadow: none;
190
+ }
172
191
  .semi-checkbox-indeterminate .semi-checkbox-inner-display, .semi-checkbox-checked .semi-checkbox-inner-display {
173
192
  background: var(--semi-color-primary);
174
193
  color: var(--semi-color-white);
@@ -44,6 +44,7 @@ $module: #{$prefix}-checkbox;
44
44
  .#{$module}-inner-checked {
45
45
  .#{$module}-inner-display {
46
46
  background: $color-checkbox_checked-bg-hover;
47
+ box-shadow: none;
47
48
  }
48
49
  }
49
50
  }
@@ -56,6 +57,7 @@ $module: #{$prefix}-checkbox;
56
57
  .#{$module}-inner-checked {
57
58
  .#{$module}-inner-display {
58
59
  background: $color-checkbox_checked-bg-active;
60
+ box-shadow: none;
59
61
  }
60
62
  }
61
63
  }
@@ -70,6 +72,7 @@ $module: #{$prefix}-checkbox;
70
72
  .#{$module}-inner-checked {
71
73
  .#{$module}-inner-display {
72
74
  background: $color-checkbox_checked-bg-disabled;
75
+ box-shadow: none;
73
76
  }
74
77
  }
75
78
  }
@@ -125,7 +128,7 @@ $module: #{$prefix}-checkbox;
125
128
 
126
129
  &.#{$module}-indeterminate .#{$module}-inner-display {
127
130
  background: $color-checkbox_checked-bg-hover;
128
- box-shadow: inset 0 0 0 $size-checkbox_inner-shadow $color-checkbox_default-border-hover;
131
+ box-shadow: none;
129
132
  color: $color-checkbox_checked-icon-hover;
130
133
  }
131
134
 
@@ -153,6 +156,7 @@ $module: #{$prefix}-checkbox;
153
156
  background: $color-checkbox_checked-bg-active;
154
157
  border-color: $color-checkbox_checked-border-active;
155
158
  color: $color-checkbox_checked-icon-active;
159
+ box-shadow: none;
156
160
  }
157
161
 
158
162
  .#{$module}-inner-checked {
@@ -222,6 +226,15 @@ $module: #{$prefix}-checkbox;
222
226
 
223
227
  &:hover {
224
228
  background: $color-checkbox_cardType_checked-bg;
229
+ border-color: $color-checkbox_cardType_checked_border-hover;
230
+ .#{$module}-inner-checked .#{$module}-inner-display {
231
+ box-shadow: none;
232
+ }
233
+ }
234
+
235
+ &:active {
236
+ background: $color-checkbox_cardType_checked-bg;
237
+ border-color: $color-checkbox_cardType_checked_border-active;
225
238
  }
226
239
  }
227
240
 
@@ -233,6 +246,17 @@ $module: #{$prefix}-checkbox;
233
246
  background: transparent;
234
247
  }
235
248
  }
249
+
250
+ &_checked_disabled.#{$module}-cardType {
251
+ background: $color-checkbox_cardType_checked_disabled-bg;
252
+ border: $width-checkbox_cardType_checked_disabled-border solid $color-checkbox_cardType_checked_disabled_border-default;
253
+
254
+ &:hover {
255
+ .#{$module}-inner-checked .#{$module}-inner-display {
256
+ box-shadow: none;
257
+ }
258
+ }
259
+ }
236
260
  }
237
261
 
238
262
  &-indeterminate,
@@ -7,6 +7,9 @@ export interface BasicCheckboxEvent {
7
7
  target: BasicTargetObject;
8
8
  stopPropagation: () => void;
9
9
  preventDefault: () => void;
10
+ nativeEvent: {
11
+ stopImmediatePropagation: () => void;
12
+ };
10
13
  }
11
14
  export interface CheckboxAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
12
15
  getIsInGroup: () => boolean;
@@ -20,18 +23,22 @@ export interface CheckboxAdapter<P = Record<string, any>, S = Record<string, any
20
23
  declare class CheckboxFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<CheckboxAdapter<P, S>, P, S> {
21
24
  constructor(adapter: CheckboxAdapter<P, S>);
22
25
  init(): void;
23
- getEvent(checked: boolean, e: MouseEvent): {
26
+ getEvent(checked: boolean, e: any): {
24
27
  target: any;
25
28
  stopPropagation: () => void;
26
29
  preventDefault: () => void;
30
+ nativeEvent: {
31
+ stopImmediatePropagation: () => void;
32
+ };
27
33
  };
28
- notifyChange(checked: boolean, e: MouseEvent): void;
29
- handleChange(e: MouseEvent): void;
30
- handleChangeInGroup(e: MouseEvent): void;
34
+ notifyChange(checked: boolean, e: any): void;
35
+ handleChange(e: any): void;
36
+ handleChangeInGroup(e: any): void;
31
37
  setChecked(checked: boolean): void;
32
38
  destroy(): void;
33
39
  }
34
40
  export interface BaseCheckboxProps {
41
+ id?: string;
35
42
  autoFocus?: boolean;
36
43
  checked?: boolean;
37
44
  defaultChecked?: boolean;
@@ -21,6 +21,13 @@ class CheckboxFoundation extends BaseFoundation {
21
21
  },
22
22
  preventDefault: () => {
23
23
  e.preventDefault();
24
+ },
25
+ nativeEvent: {
26
+ stopImmediatePropagation: () => {
27
+ if (e.nativeEvent && typeof e.nativeEvent.stopImmediatePropagation === 'function') {
28
+ e.nativeEvent.stopImmediatePropagation();
29
+ }
30
+ }
24
31
  }
25
32
  };
26
33
  return cbValue;
@@ -19,9 +19,13 @@ $color-checkbox_checked-border-default: var(--semi-color-primary); // 选框选
19
19
  $color-checkbox_checked-border-hover: var(--semi-color-primary-hover); // 选框选中态描边颜色 - 悬浮
20
20
  $color-checkbox_checked-border-active: var(--semi-color-primary-active); // 选框选中态描边颜色 - 按下
21
21
  $color-checkbox_cardType_checked-bg: var(--semi-color-primary-light-default); // 卡片类型复选框选中时的背景颜色 - 默认
22
+ $color-checkbox_cardType_checked_disabled-bg: var(--semi-color-primary-light-default); // 卡片类型复选框选中且禁用时的背景颜色 - 默认
22
23
  $color-checkbox_cardType-bg-hover: var(--semi-color-fill-0); // 卡片类型复选框选中时的背景颜色 - 悬浮
23
24
  $color-checkbox_cardType-bg-active: var(--semi-color-fill-1); // 卡片类型复选框选中时的背景颜色 - 按下
24
- $color-checkbox_cardType_checked_border-default: var(--semi-color-focus-border); //卡片类型复选框选中时的边框颜色 - 默认
25
+ $color-checkbox_cardType_checked_border-default: var(--semi-color-primary); //卡片类型复选框选中时的边框颜色 - 默认
26
+ $color-checkbox_cardType_checked_border-hover: var(--semi-color-primary-hover); //卡片类型复选框选中时的边框颜色 - 悬浮
27
+ $color-checkbox_cardType_checked_border-active: var(--semi-color-primary-active); //卡片类型复选框选中时的边框颜色 - 按下
28
+ $color-checkbox_cardType_checked_disabled_border-default: var(--semi-color-primary-disabled); //卡片类型复选框选中且禁用时的边框颜色 - 默认
25
29
  $color-checkbox_cardType_addon-text-default: var(--semi-color-text-0); // 卡片类型复选框 addon 的文字颜色 - 默认
26
30
  $color-checkbox_cardType_extra-text-default: var(--semi-color-text-2); // 卡片类型复选框 extra 的文字颜色 - 默认
27
31
  $color-checkbox_cardType_inner-bg-hover: var(--semi-color-white); // 卡片类型复选框 inner 的背景颜色 - 悬浮
@@ -37,6 +41,7 @@ $size-checkbox_inner-shadow: $border-thickness-control; // 选框内描边宽度
37
41
  $width-checkbox_inner: $width-icon-medium; // 选框对勾 icon 宽度
38
42
  $height-checkbox_inner: 20px; // 选框对勾 icon 高度
39
43
  $width-checkbox_cardType_checked-border: 1px; // 卡片类型复选框的边框宽度
44
+ $width-checkbox_cardType_checked_disabled-border: 1px; // 卡片类型复选框选中且禁用的边框宽度
40
45
 
41
46
  $radius-checkbox_cardType: 3px; // 卡片类型复选框的圆角大小
42
47
  $radius-checkbox_inner: var(--semi-border-radius-extra-small); // 选框圆角