@douyinfe/semi-foundation 2.4.1 → 2.6.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 (112) hide show
  1. package/button/button.scss +11 -0
  2. package/button/variables.scss +4 -0
  3. package/cascader/cascader.scss +3 -2
  4. package/cascader/foundation.ts +19 -0
  5. package/cascader/variables.scss +6 -3
  6. package/datePicker/foundation.ts +16 -4
  7. package/datePicker/inputFoundation.ts +0 -1
  8. package/datePicker/monthFoundation.ts +1 -0
  9. package/form/form.scss +7 -1
  10. package/form/foundation.ts +40 -36
  11. package/form/interface.ts +1 -1
  12. package/input/input.scss +2 -1
  13. package/lib/cjs/autoComplete/constants.d.ts +1 -1
  14. package/lib/cjs/button/button.css +9 -0
  15. package/lib/cjs/button/button.scss +11 -0
  16. package/lib/cjs/button/variables.scss +4 -0
  17. package/lib/cjs/cascader/cascader.css +2 -1
  18. package/lib/cjs/cascader/cascader.scss +3 -2
  19. package/lib/cjs/cascader/foundation.d.ts +19 -0
  20. package/lib/cjs/cascader/foundation.js +22 -0
  21. package/lib/cjs/cascader/variables.scss +6 -3
  22. package/lib/cjs/datePicker/foundation.d.ts +9 -4
  23. package/lib/cjs/datePicker/foundation.js +18 -0
  24. package/lib/cjs/datePicker/inputFoundation.d.ts +0 -1
  25. package/lib/cjs/datePicker/monthFoundation.d.ts +1 -0
  26. package/lib/cjs/dropdown/constants.d.ts +1 -1
  27. package/lib/cjs/form/form.css +4 -0
  28. package/lib/cjs/form/form.scss +7 -1
  29. package/lib/cjs/form/foundation.d.ts +6 -6
  30. package/lib/cjs/form/foundation.js +51 -52
  31. package/lib/cjs/form/interface.d.ts +1 -1
  32. package/lib/cjs/input/input.css +1 -0
  33. package/lib/cjs/input/input.scss +2 -1
  34. package/lib/cjs/select/constants.d.ts +1 -1
  35. package/lib/cjs/select/foundation.d.ts +1 -1
  36. package/lib/cjs/select/foundation.js +2 -1
  37. package/lib/cjs/select/optionFoundation.d.ts +1 -1
  38. package/lib/cjs/select/optionFoundation.js +3 -3
  39. package/lib/cjs/slider/foundation.js +2 -2
  40. package/lib/cjs/table/foundation.d.ts +2 -0
  41. package/lib/cjs/table/foundation.js +16 -4
  42. package/lib/cjs/table/table.css +1 -2
  43. package/lib/cjs/table/table.scss +4 -5
  44. package/lib/cjs/table/utils.js +4 -1
  45. package/lib/cjs/table/variables.scss +1 -0
  46. package/lib/cjs/tooltip/constants.d.ts +1 -1
  47. package/lib/cjs/tooltip/constants.js +1 -1
  48. package/lib/cjs/tooltip/foundation.js +65 -4
  49. package/lib/cjs/tree/foundation.d.ts +4 -1
  50. package/lib/cjs/tree/foundation.js +69 -20
  51. package/lib/cjs/treeSelect/foundation.d.ts +3 -3
  52. package/lib/cjs/treeSelect/foundation.js +103 -35
  53. package/lib/cjs/upload/upload.css +49 -27
  54. package/lib/cjs/upload/upload.scss +66 -41
  55. package/lib/cjs/upload/variables.scss +3 -1
  56. package/lib/es/autoComplete/constants.d.ts +1 -1
  57. package/lib/es/button/button.css +9 -0
  58. package/lib/es/button/button.scss +11 -0
  59. package/lib/es/button/variables.scss +4 -0
  60. package/lib/es/cascader/cascader.css +2 -1
  61. package/lib/es/cascader/cascader.scss +3 -2
  62. package/lib/es/cascader/foundation.d.ts +19 -0
  63. package/lib/es/cascader/foundation.js +22 -1
  64. package/lib/es/cascader/variables.scss +6 -3
  65. package/lib/es/datePicker/foundation.d.ts +9 -4
  66. package/lib/es/datePicker/foundation.js +18 -0
  67. package/lib/es/datePicker/inputFoundation.d.ts +0 -1
  68. package/lib/es/datePicker/monthFoundation.d.ts +1 -0
  69. package/lib/es/dropdown/constants.d.ts +1 -1
  70. package/lib/es/form/form.css +4 -0
  71. package/lib/es/form/form.scss +7 -1
  72. package/lib/es/form/foundation.d.ts +6 -6
  73. package/lib/es/form/foundation.js +51 -52
  74. package/lib/es/form/interface.d.ts +1 -1
  75. package/lib/es/input/input.css +1 -0
  76. package/lib/es/input/input.scss +2 -1
  77. package/lib/es/select/constants.d.ts +1 -1
  78. package/lib/es/select/foundation.d.ts +1 -1
  79. package/lib/es/select/foundation.js +2 -1
  80. package/lib/es/select/optionFoundation.d.ts +1 -1
  81. package/lib/es/select/optionFoundation.js +3 -3
  82. package/lib/es/slider/foundation.js +2 -2
  83. package/lib/es/table/foundation.d.ts +2 -0
  84. package/lib/es/table/foundation.js +16 -4
  85. package/lib/es/table/table.css +1 -2
  86. package/lib/es/table/table.scss +4 -5
  87. package/lib/es/table/utils.js +4 -1
  88. package/lib/es/table/variables.scss +1 -0
  89. package/lib/es/tooltip/constants.d.ts +1 -1
  90. package/lib/es/tooltip/constants.js +1 -1
  91. package/lib/es/tooltip/foundation.js +65 -4
  92. package/lib/es/tree/foundation.d.ts +4 -1
  93. package/lib/es/tree/foundation.js +69 -20
  94. package/lib/es/treeSelect/foundation.d.ts +3 -3
  95. package/lib/es/treeSelect/foundation.js +102 -35
  96. package/lib/es/upload/upload.css +49 -27
  97. package/lib/es/upload/upload.scss +66 -41
  98. package/lib/es/upload/variables.scss +3 -1
  99. package/package.json +3 -3
  100. package/select/foundation.ts +3 -2
  101. package/select/optionFoundation.ts +3 -3
  102. package/slider/foundation.ts +2 -2
  103. package/table/foundation.ts +23 -10
  104. package/table/table.scss +4 -5
  105. package/table/utils.ts +3 -1
  106. package/table/variables.scss +1 -0
  107. package/tooltip/constants.ts +2 -0
  108. package/tooltip/foundation.ts +52 -4
  109. package/tree/foundation.ts +56 -17
  110. package/treeSelect/foundation.ts +89 -41
  111. package/upload/upload.scss +66 -41
  112. package/upload/variables.scss +3 -1
@@ -178,6 +178,8 @@ export interface Virtualize {
178
178
  width?: number | string;
179
179
  }
180
180
 
181
+ export type CheckRelation = 'related' | 'unRelated';
182
+
181
183
  export interface BasicTreeProps {
182
184
  autoExpandParent?: boolean;
183
185
  autoExpandWhenDragEnter?: boolean;
@@ -233,6 +235,7 @@ export interface BasicTreeProps {
233
235
  value?: BasicValue;
234
236
  virtualize?: Virtualize;
235
237
  icon?: any;
238
+ checkRelation?: CheckRelation;
236
239
  'aria-label'?: string;
237
240
  }
238
241
 
@@ -252,6 +255,8 @@ export interface BasicTreeInnerData {
252
255
  checkedKeys: Set<string>;
253
256
  /* Half-selected node when multiple selection */
254
257
  halfCheckedKeys: Set<string>;
258
+ /* real selected nodes in multiple selection */
259
+ realCheckedKeys: Set<string>;
255
260
  /* Animation node */
256
261
  motionKeys: Set<string>;
257
262
  /* Animation type */
@@ -358,6 +363,7 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
358
363
  selectedKeys = [],
359
364
  checkedKeys = new Set([]),
360
365
  halfCheckedKeys = new Set([]),
366
+ realCheckedKeys = new Set([]),
361
367
  keyEntities = {},
362
368
  filteredKeys = new Set([]),
363
369
  inputValue = '',
@@ -366,19 +372,29 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
366
372
  filteredExpandedKeys = new Set([]),
367
373
  disabledKeys = new Set([]),
368
374
  } = this.getStates();
369
- const { treeNodeFilterProp } = this.getProps();
375
+ const { treeNodeFilterProp, checkRelation } = this.getProps();
370
376
  const entity = keyEntities[key];
371
377
  const notExist = !entity;
372
378
  if (notExist) {
373
379
  return null;
374
380
  }
381
+ // if checkRelation is invalid, the checked status of node will be false
382
+ let realChecked = false;
383
+ let realHalfChecked = false;
384
+ if (checkRelation === 'related') {
385
+ realChecked = checkedKeys.has(key);
386
+ realHalfChecked = halfCheckedKeys.has(key);
387
+ } else if (checkRelation === 'unRelated') {
388
+ realChecked = realCheckedKeys.has(key);
389
+ realHalfChecked = false;
390
+ }
375
391
  const isSearching = Boolean(inputValue);
376
392
  const treeNodeProps: BasicTreeNodeProps = {
377
393
  eventKey: key,
378
394
  expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
379
395
  selected: selectedKeys.includes(key),
380
- checked: checkedKeys.has(key),
381
- halfChecked: halfCheckedKeys.has(key),
396
+ checked: realChecked,
397
+ halfChecked: realHalfChecked,
382
398
  pos: String(entity ? entity.pos : ''),
383
399
  level: entity.level,
384
400
  filtered: filteredKeys.has(key),
@@ -402,11 +418,16 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
402
418
  this._adapter.notifyChange(value as BasicValue);
403
419
  }
404
420
 
405
- notifyMultipleChange(key: string[] | string, e: any) {
421
+ notifyMultipleChange(key: string[], e: any) {
406
422
  const { keyEntities } = this.getStates();
407
- const { leafOnly } = this.getProps();
423
+ const { leafOnly, checkRelation } = this.getProps();
408
424
  let value;
409
- const keyList = normalizeKeyList(key, keyEntities, leafOnly);
425
+ let keyList = [];
426
+ if (checkRelation === 'related') {
427
+ keyList = normalizeKeyList(key, keyEntities, leafOnly);
428
+ } else if (checkRelation === 'unRelated') {
429
+ keyList = key;
430
+ }
410
431
  if (this.getProp('onChangeWithObject')) {
411
432
  value = keyList.map((itemKey: string) => keyEntities[itemKey].data);
412
433
  } else {
@@ -421,7 +442,7 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
421
442
  if (this.getProp('treeDataSimpleJson')) {
422
443
  this.notifyJsonChange(key, e);
423
444
  } else if (isMultiple) {
424
- this.notifyMultipleChange(key, e);
445
+ this.notifyMultipleChange(key as string[], e);
425
446
  } else {
426
447
  let value;
427
448
  if (this.getProp('onChangeWithObject')) {
@@ -565,18 +586,36 @@ export default class TreeFoundation extends BaseFoundation<TreeAdapter, BasicTre
565
586
  * Handle the selection event in the case of multiple selection
566
587
  */
567
588
  handleMultipleSelect(e: any, treeNode: BasicTreeNodeProps) {
568
- const { disableStrictly } = this.getProps();
589
+ const { disableStrictly, checkRelation } = this.getProps();
590
+ const { realCheckedKeys } = this.getStates();
569
591
  // eventKey: The key value of the currently clicked node
570
592
  const { checked, eventKey, data } = treeNode;
571
- // Find the checked state of the current node
572
- const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
573
- const { checkedKeys, halfCheckedKeys } = disableStrictly ?
574
- this.calcNonDisabedCheckedKeys(eventKey, targetStatus) :
575
- this.calcCheckedKeys(eventKey, targetStatus);
576
- this._adapter.notifySelect(eventKey, targetStatus, data);
577
- this.notifyChange([...checkedKeys], e);
578
- if (!this._isControlledComponent()) {
579
- this._adapter.updateState({ checkedKeys, halfCheckedKeys });
593
+ if (checkRelation === 'related') {
594
+ // Find the checked state of the current node
595
+ const targetStatus = disableStrictly ? this.calcChekcedStatus(!checked, eventKey) : !checked;
596
+ const { checkedKeys, halfCheckedKeys } = disableStrictly ?
597
+ this.calcNonDisabedCheckedKeys(eventKey, targetStatus) :
598
+ this.calcCheckedKeys(eventKey, targetStatus);
599
+ this._adapter.notifySelect(eventKey, targetStatus, data);
600
+ this.notifyChange([...checkedKeys], e);
601
+ if (!this._isControlledComponent()) {
602
+ this._adapter.updateState({ checkedKeys, halfCheckedKeys });
603
+ }
604
+ } else if (checkRelation === 'unRelated') {
605
+ const newRealCheckedKeys: Set<string> = new Set(realCheckedKeys);
606
+ let targetStatus: boolean;
607
+ if (realCheckedKeys.has(eventKey)) {
608
+ newRealCheckedKeys.delete(eventKey);
609
+ targetStatus = false;
610
+ } else {
611
+ newRealCheckedKeys.add(eventKey);
612
+ targetStatus = true;
613
+ }
614
+ this._adapter.notifySelect(eventKey, targetStatus, data);
615
+ this.notifyChange([...newRealCheckedKeys], e);
616
+ if (!this._isControlledComponent()) {
617
+ this._adapter.updateState({ realCheckedKeys: newRealCheckedKeys });
618
+ }
580
619
  }
581
620
  }
582
621
 
@@ -31,9 +31,9 @@ export type ValidateStatus = 'error' | 'warning' | 'default';
31
31
  export type Size = 'small' | 'large' | 'default';
32
32
 
33
33
  export type BasicRenderSelectedItemInMultiple = (
34
- treeNode: BasicTreeNodeData,
34
+ treeNode: BasicTreeNodeData,
35
35
  otherProps: { index: number | string; onClose: (tagContent: any, e: any) => void }
36
- )=> {
36
+ ) => {
37
37
  isRenderInTag: boolean;
38
38
  content: any;
39
39
  };
@@ -95,6 +95,7 @@ export interface BasicTreeSelectProps extends Pick<BasicTreeProps,
95
95
  | 'expandAll'
96
96
  | 'disableStrictly'
97
97
  | 'aria-label'
98
+ | 'checkRelation'
98
99
  > {
99
100
  motion?: Motion;
100
101
  mouseEnterDelay?: number;
@@ -156,6 +157,7 @@ export interface BasicTreeSelectInnerData extends Pick<BasicTreeInnerData,
156
157
  | 'disabledKeys'
157
158
  | 'loadedKeys'
158
159
  | 'loadingKeys'
160
+ | 'realCheckedKeys'
159
161
  > {
160
162
  inputTriggerFocus: boolean;
161
163
  isOpen: boolean;
@@ -171,7 +173,7 @@ export interface TreeSelectAdapter<P = Record<string, any>, S = Record<string, a
171
173
  registerClickOutsideHandler: (cb: (e: any) => void) => void;
172
174
  unregisterClickOutsideHandler: () => void;
173
175
  rePositionDropdown: () => void;
174
- updateState: (states: Pick<S, keyof S>) => void;
176
+ updateState: (states: Partial<BasicTreeSelectInnerData>) => void;
175
177
  notifySelect: (selectedKeys: string, selected: boolean, selectedNode: BasicTreeNodeData) => void;
176
178
  notifySearch: (input: string) => void;
177
179
  cacheFlattenNodes: (bool: boolean) => void;
@@ -272,6 +274,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
272
274
  selectedKeys = [],
273
275
  checkedKeys = new Set([]),
274
276
  halfCheckedKeys = new Set([]),
277
+ realCheckedKeys = new Set([]),
275
278
  keyEntities = {},
276
279
  filteredKeys = new Set([]),
277
280
  inputValue = '',
@@ -280,19 +283,29 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
280
283
  filteredExpandedKeys = new Set([]),
281
284
  disabledKeys = new Set([]),
282
285
  } = this.getStates();
283
- const { treeNodeFilterProp } = this.getProps();
286
+ const { treeNodeFilterProp, checkRelation } = this.getProps();
284
287
  const entity = keyEntities[key];
285
288
  const notExist = !entity;
286
289
  if (notExist) {
287
290
  return null;
288
291
  }
292
+ // if checkRelation is invalid, the checked status of node will be false
293
+ let realChecked = false;
294
+ let realHalfChecked = false;
295
+ if (checkRelation === 'related') {
296
+ realChecked = checkedKeys.has(key);
297
+ realHalfChecked = halfCheckedKeys.has(key);
298
+ } else if (checkRelation === 'unRelated') {
299
+ realChecked = realCheckedKeys.has(key);
300
+ realHalfChecked = false;
301
+ }
289
302
  const isSearching = Boolean(inputValue);
290
303
  const treeNodeProps: BasicTreeNodeProps = {
291
304
  eventKey: key,
292
305
  expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
293
306
  selected: selectedKeys.includes(key),
294
- checked: checkedKeys.has(key),
295
- halfChecked: halfCheckedKeys.has(key),
307
+ checked: realChecked,
308
+ halfChecked: realHalfChecked,
296
309
  pos: String(entity ? entity.pos : ''),
297
310
  level: entity.level,
298
311
  filtered: filteredKeys.has(key),
@@ -327,7 +340,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
327
340
  if (!this._isLoadControlled()) {
328
341
  this._adapter.updateState({
329
342
  loadedKeys: newLoadedKeys,
330
- } as any);
343
+ });
331
344
  }
332
345
  this._adapter.setState({
333
346
  loadingKeys: newLoadingKeys,
@@ -345,8 +358,13 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
345
358
 
346
359
  _notifyMultipleChange(key: string[], e: any) {
347
360
  const { keyEntities } = this.getStates();
348
- const { leafOnly } = this.getProps();
349
- const keyList = normalizeKeyList(key, keyEntities, leafOnly);
361
+ const { leafOnly, checkRelation } = this.getProps();
362
+ let keyList = [];
363
+ if (checkRelation === 'related') {
364
+ keyList = normalizeKeyList(key, keyEntities, leafOnly);
365
+ } else if (checkRelation === 'unRelated') {
366
+ keyList = key as string[];
367
+ }
350
368
  const nodes = keyList.map(i => keyEntities[i].data);
351
369
  if (this.getProp('onChangeWithObject')) {
352
370
  this._adapter.notifyChangeWithObject(nodes, e);
@@ -402,7 +420,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
402
420
  this._adapter.unregisterClickOutsideHandler();
403
421
  this._notifyBlur(e);
404
422
  if (this.getProp('motionExpand')) {
405
- this._adapter.updateState({ motionKeys: new Set([]) } as any);
423
+ this._adapter.updateState({ motionKeys: new Set([]) });
406
424
  }
407
425
  }
408
426
 
@@ -442,7 +460,8 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
442
460
  selectedKeys: [],
443
461
  checkedKeys: new Set(),
444
462
  halfCheckedKeys: new Set(),
445
- } as any);
463
+ realCheckedKeys: new Set([]),
464
+ });
446
465
  }
447
466
  // When triggerSearch, clicking the clear button will trigger to clear Input
448
467
  if (filterTreeNode && searchPosition === strings.SEARCH_POSITION_TRIGGER) {
@@ -466,18 +485,29 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
466
485
  }
467
486
 
468
487
  removeTag(eventKey: BasicTreeNodeData['key']) {
469
- const { disableStrictly } = this.getProps();
470
- const { keyEntities, disabledKeys } = this.getStates();
488
+ const { disableStrictly, checkRelation } = this.getProps();
489
+ const { keyEntities, disabledKeys, realCheckedKeys } = this.getStates();
471
490
  const item = keyEntities[eventKey].data;
472
491
  if (item.disabled || (disableStrictly && disabledKeys.has(eventKey))) {
473
492
  return;
474
493
  }
475
- const { checkedKeys, halfCheckedKeys } = this.calcCheckedKeys(eventKey, false);
476
- this._notifyChange([...checkedKeys], null);
477
- if (!this._isControlledComponent()) {
478
- this._adapter.updateState({ checkedKeys, halfCheckedKeys } as any);
479
- this._adapter.rePositionDropdown();
494
+ if (checkRelation === 'unRelated') {
495
+ const newRealCheckedKeys = new Set(realCheckedKeys);
496
+ newRealCheckedKeys.delete(eventKey);
497
+ this._notifyChange([...newRealCheckedKeys], null);
498
+ if (!this._isControlledComponent()) {
499
+ this._adapter.updateState({ realCheckedKeys: newRealCheckedKeys } as any);
500
+ this._adapter.rePositionDropdown();
501
+ }
502
+ } else if (checkRelation === 'related') {
503
+ const { checkedKeys, halfCheckedKeys } = this.calcCheckedKeys(eventKey, false);
504
+ this._notifyChange([...checkedKeys], null);
505
+ if (!this._isControlledComponent()) {
506
+ this._adapter.updateState({ checkedKeys, halfCheckedKeys });
507
+ this._adapter.rePositionDropdown();
508
+ }
480
509
  }
510
+
481
511
  this._adapter.notifySelect(eventKey, false, item);
482
512
 
483
513
  // reposition dropdown when selected values change
@@ -498,7 +528,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
498
528
  filteredKeys: new Set([]),
499
529
  filteredExpandedKeys: new Set(expandedOptsKeys),
500
530
  filteredShownKeys: new Set([])
501
- } as any);
531
+ });
502
532
  }
503
533
 
504
534
  handleInputChange(sugInput: string) {
@@ -534,7 +564,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
534
564
  filteredKeys: new Set(filteredOptsKeys),
535
565
  filteredExpandedKeys: new Set(expandedOptsKeys),
536
566
  filteredShownKeys,
537
- } as any);
567
+ });
538
568
  }
539
569
 
540
570
  handleNodeSelect(e: any, treeNode: BasicTreeNodeProps) {
@@ -559,7 +589,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
559
589
  selectedKeys = [eventKey];
560
590
  this._notifyChange(eventKey, e);
561
591
  if (!this._isControlledComponent()) {
562
- this._adapter.updateState({ selectedKeys } as any);
592
+ this._adapter.updateState({ selectedKeys });
563
593
  }
564
594
  }
565
595
  if (clickToHide && (this._isSelectToClose() || !data.children)) {
@@ -581,24 +611,42 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
581
611
  }
582
612
 
583
613
  handleMultipleSelect(e: any, treeNode: BasicTreeNodeProps) {
584
- const { searchPosition, disableStrictly } = this.getProps();
585
- const { inputValue } = this.getStates();
614
+ const { searchPosition, disableStrictly, checkRelation } = this.getProps();
615
+ const { inputValue, realCheckedKeys } = this.getStates();
586
616
  const { checked, eventKey, data } = treeNode;
587
- const targetStatus = disableStrictly ?
588
- this.calcChekcedStatus(!checked, eventKey) :
589
- !checked;
590
-
591
- const { checkedKeys, halfCheckedKeys } = disableStrictly ?
592
- this.calcNonDisabedCheckedKeys(eventKey, targetStatus) :
593
- this.calcCheckedKeys(eventKey, targetStatus);
594
- this._adapter.notifySelect(eventKey, targetStatus, data);
595
- this._notifyChange([...checkedKeys], e);
596
- if (searchPosition === strings.SEARCH_POSITION_TRIGGER && inputValue !== '') {
597
- this._adapter.updateState({ inputValue: '' } as any);
617
+ if (checkRelation === 'related') {
618
+ const targetStatus = disableStrictly ?
619
+ this.calcChekcedStatus(!checked, eventKey) :
620
+ !checked;
621
+
622
+ const { checkedKeys, halfCheckedKeys } = disableStrictly ?
623
+ this.calcNonDisabedCheckedKeys(eventKey, targetStatus) :
624
+ this.calcCheckedKeys(eventKey, targetStatus);
625
+ this._adapter.notifySelect(eventKey, targetStatus, data);
626
+ this._notifyChange([...checkedKeys], e);
627
+ if (!this._isControlledComponent()) {
628
+ this._adapter.updateState({ checkedKeys, halfCheckedKeys });
629
+ this._adapter.rePositionDropdown();
630
+ }
631
+ } else if (checkRelation === 'unRelated') {
632
+ const newRealCheckedKeys: Set<string> = new Set(realCheckedKeys);
633
+ let targetStatus: boolean;
634
+ if (realCheckedKeys.has(eventKey)) {
635
+ newRealCheckedKeys.delete(eventKey);
636
+ targetStatus = false;
637
+ } else {
638
+ newRealCheckedKeys.add(eventKey);
639
+ targetStatus = true;
640
+ }
641
+ this._adapter.notifySelect(eventKey, targetStatus, data);
642
+ this._notifyChange([...newRealCheckedKeys], e);
643
+ if (!this._isControlledComponent()) {
644
+ this._adapter.updateState({ realCheckedKeys: newRealCheckedKeys });
645
+ this._adapter.rePositionDropdown();
646
+ }
598
647
  }
599
- if (!this._isControlledComponent()) {
600
- this._adapter.updateState({ checkedKeys, halfCheckedKeys } as any);
601
- this._adapter.rePositionDropdown();
648
+ if (searchPosition === strings.SEARCH_POSITION_TRIGGER && inputValue !== '') {
649
+ this._adapter.updateState({ inputValue: '' });
602
650
  }
603
651
  }
604
652
 
@@ -659,7 +707,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
659
707
  motionType,
660
708
  };
661
709
 
662
- this._adapter.updateState(newState as any);
710
+ this._adapter.updateState(newState);
663
711
  }
664
712
 
665
713
  this._adapter.notifyExpand(filteredExpandedKeys, {
@@ -703,7 +751,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
703
751
  motionKeys: new Set(motionKeys),
704
752
  motionType,
705
753
  };
706
- this._adapter.updateState(newState as any);
754
+ this._adapter.updateState(newState);
707
755
  }
708
756
 
709
757
  this._adapter.notifyExpand(expandedKeys, {
@@ -734,7 +782,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
734
782
  handleInputTriggerBlur() {
735
783
  this._adapter.updateState({
736
784
  inputTriggerFocus: false
737
- } as any);
785
+ });
738
786
  }
739
787
 
740
788
  /**
@@ -744,7 +792,7 @@ export default class TreeSelectFoundation<P = Record<string, any>, S = Record<st
744
792
  this.clearInput();
745
793
  this._adapter.updateState({
746
794
  inputTriggerFocus: true
747
- } as any);
795
+ });
748
796
  }
749
797
 
750
798
  setLoadKeys(data: BasicTreeNodeData, resolve: (value?: any) => void) {
@@ -1,4 +1,4 @@
1
- @import "./variables.scss";
1
+ @import './variables.scss';
2
2
 
3
3
  $module: #{$prefix}-upload;
4
4
 
@@ -47,7 +47,7 @@ $module: #{$prefix}-upload;
47
47
  align-items: center;
48
48
  }
49
49
 
50
- &[x-prompt-pos="right"] {
50
+ &[x-prompt-pos='right'] {
51
51
  .#{$module}-add {
52
52
  display: inline-flex;
53
53
  }
@@ -57,7 +57,7 @@ $module: #{$prefix}-upload;
57
57
  }
58
58
  }
59
59
 
60
- &[x-prompt-pos="bottom"] {
60
+ &[x-prompt-pos='bottom'] {
61
61
  .#{$module}-add {
62
62
  display: flex;
63
63
  }
@@ -72,15 +72,14 @@ $module: #{$prefix}-upload;
72
72
  }
73
73
  }
74
74
 
75
- &[x-prompt-pos="left"] {
75
+ &[x-prompt-pos='left'] {
76
76
  .#{$module}-add {
77
77
  display: inline-flex;
78
- order: 2;
79
78
  }
80
79
 
81
80
  .#{$module}-prompt {
82
81
  display: inline-flex;
83
- order: 1;
82
+ order: -1;
84
83
  }
85
84
 
86
85
  .#{$module}-file-list {
@@ -247,7 +246,6 @@ $module: #{$prefix}-upload;
247
246
  }
248
247
 
249
248
  &-icon {
250
-
251
249
  &-loading,
252
250
  &-error {
253
251
  font-size: $width-upload_file_card-icon;
@@ -275,7 +273,6 @@ $module: #{$prefix}-upload;
275
273
  }
276
274
 
277
275
  .#{$module}-file-card {
278
-
279
276
  &-info-validate-message {
280
277
  color: $color-upload_file_card_fail_info-text;
281
278
  }
@@ -288,26 +285,18 @@ $module: #{$prefix}-upload;
288
285
  &-picture {
289
286
  display: flex;
290
287
 
291
- &[x-prompt-pos="bottom"] {
288
+ &[x-prompt-pos='bottom'] {
292
289
  flex-direction: column;
293
290
 
294
291
  .#{$module}-prompt {
295
292
  order: 1;
296
293
  }
297
-
298
- .#{$module}-add {
299
- order: 0;
300
- }
301
294
  }
302
295
 
303
- &[x-prompt-pos="right"] {
296
+ &[x-prompt-pos='right'] {
304
297
  .#{$module}-prompt {
305
298
  order: 1;
306
299
  }
307
-
308
- .#{$module}-add {
309
- order: 0;
310
- }
311
300
  }
312
301
 
313
302
  &-add {
@@ -321,7 +310,6 @@ $module: #{$prefix}-upload;
321
310
  border: $width-upload_picture_add-border dashed $color-upload-border;
322
311
  color: $color-upload-icon;
323
312
  border-radius: $radius-upload_picture_add;
324
- order: 2;
325
313
  cursor: pointer;
326
314
 
327
315
  &:hover {
@@ -370,38 +358,32 @@ $module: #{$prefix}-upload;
370
358
  }
371
359
 
372
360
  &-close {
373
- width: $width-upload_picture_file_card_close;
374
- height: $width-upload_picture_file_card_close;
375
- background-color: $color-upload_pic_remove-bg;
361
+ visibility: hidden;
362
+ display: inline-flex;
376
363
  position: absolute;
377
364
  top: $spacing-upload_picture_file_card_close-top;
378
365
  right: $spacing-upload_picture_file_card_close-right;
379
- @include all-center;
380
- display: none;
381
366
  border-radius: $radius-upload_picture_file_card_close;
382
- color: white;
383
367
  cursor: pointer;
384
368
  transition: all 0s;
385
369
  }
386
-
387
- &:hover {
388
- .#{$module}-picture-file-card-close {
389
- display: flex;
390
- }
391
-
392
- .#{$module}-picture-file-card-replace {
393
- visibility: visible;
394
- }
370
+ &-icon-close {
371
+ font-size: $width-upload_picture_file_card_close;
372
+ color: $color-upload_picture_file_card_close-icon;
395
373
  }
396
374
 
397
- .#{$prefix}-progress-circle {
375
+ &::before {
376
+ visibility: hidden;
377
+ background-color: $color-upload_picture_file_card_hover-bg;
378
+ content: '';
398
379
  position: absolute;
399
- top: 50%;
400
- left: 50%;
401
- transform: translate(-50%, -50%);
380
+ left: 0;
381
+ right: 0;
382
+ top: 0;
383
+ bottom: 0;
402
384
  }
403
-
404
385
  &-retry {
386
+ visibility: hidden;
405
387
  background-color: $color-upload_file_card_retry-bg;
406
388
  width: $width-upload_file_card_retry;
407
389
  height: $width-upload_file_card_retry;
@@ -416,7 +398,6 @@ $module: #{$prefix}-upload;
416
398
  justify-content: center;
417
399
  cursor: pointer;
418
400
  }
419
-
420
401
  &-icon-retry {
421
402
  transform: scale(-1, 1);
422
403
  font-size: $width-upload_file_card_retry-icon;
@@ -432,6 +413,17 @@ $module: #{$prefix}-upload;
432
413
  color: $color-upload_replace-text;
433
414
  transform: translate3D(-50%, -50%, 0);
434
415
  }
416
+
417
+ &-preview {
418
+ visibility: hidden;
419
+ display: inline-flex;
420
+ position: absolute;
421
+ cursor: pointer;
422
+ top: 50%;
423
+ left: 50%;
424
+ transform: translate3D(-50%, -50%, 0);
425
+ }
426
+
435
427
  &-pic-info {
436
428
  display: inline-flex;
437
429
  box-sizing: border-box;
@@ -468,6 +460,39 @@ $module: #{$prefix}-upload;
468
460
  &-error {
469
461
  outline: 1px solid $color-upload_picture_file_card_error-border;
470
462
  }
463
+
464
+ &:hover {
465
+ &::before {
466
+ visibility: visible;
467
+ }
468
+
469
+ .#{$module}-picture-file-card-close {
470
+ visibility: visible;
471
+ }
472
+ .#{$module}-picture-file-card-replace {
473
+ visibility: visible;
474
+ }
475
+
476
+ .#{$module}-picture-file-card-retry {
477
+ visibility: visible;
478
+ }
479
+ .#{$module}-picture-file-card-preview {
480
+ visibility: visible;
481
+ }
482
+ }
483
+
484
+ &-uploading {
485
+ &::before {
486
+ visibility: visible;
487
+ }
488
+ }
489
+
490
+ .#{$prefix}-progress-circle {
491
+ position: absolute;
492
+ top: 50%;
493
+ left: 50%;
494
+ transform: translate(-50%, -50%);
495
+ }
471
496
  }
472
497
  }
473
498
 
@@ -542,4 +567,4 @@ $module: #{$prefix}-upload;
542
567
  }
543
568
  }
544
569
 
545
- @import "./rtl.scss";
570
+ @import './rtl.scss';
@@ -16,7 +16,7 @@ $color-upload_drag_area_tips-text: var(--semi-color-primary); // 上传可拖拽
16
16
  $color-upload_file_card_fail_info-text: var(--semi-color-danger); // 上传文件卡片失败提示信息文本颜色
17
17
  $color-upload_file_card_preview_placeholder-bg: rgba(var(--semi-grey-3), 1); // 文件卡片默认预览背景颜色
18
18
  $color-upload_file_card_preview_placeholder-text: rgba(var(--semi-white), 1); // 文件卡片默认预览图颜色
19
- $color-upload_file_card_retry-bg: #fff; // 重新上传按钮背景颜色
19
+ $color-upload_file_card_retry-bg: var(--semi-color-white); // 重新上传按钮背景颜色
20
20
  $color-upload_file_card_retry-text: var(--semi-color-primary); // 重新上传按钮文本颜色
21
21
  $color-upload-icon: var(--semi-color-tertiary); // 图片墙上传图标加号颜色
22
22
  $color-upload_pic_add-bg-active: var(--semi-color-fill-2); // 图片墙上传背景色 - 按下
@@ -26,6 +26,8 @@ $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
27
  $color-upload_picture_file_card_error-border: var(--semi-color-danger); // 图片墙上传移除图标颜色
28
28
  $color-upload_picture_file_card_pic_info-text: var(--semi-color-white); // 图片墙图片信息(序号)文字颜色
29
+ $color-upload_picture_file_card_close-icon: var(--semi-color-white); // 图片墙关闭图标颜色
30
+ $color-upload_picture_file_card_hover-bg: var(--semi-color-overlay-bg); // 图片墙预览悬浮背景色
29
31
  $color-upload_preview-icon: var(--semi-color-text-2); // 上传文件卡片文本颜色
30
32
  $color-upload_retry-text: var(--semi-color-primary); // 上传文件卡片重新上传按钮文本颜色
31
33
  $color-upload_replace-text: var(--semi-color-white); // 上传文件卡片重新替换按钮文本颜色