@douyinfe/semi-ui 2.56.3 → 2.56.4-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -367,15 +367,17 @@ class TreeSelect extends _baseComponent.default {
367
367
  leafOnly,
368
368
  searchPosition,
369
369
  triggerRender,
370
- borderless
370
+ borderless,
371
+ checkRelation
371
372
  } = _a,
372
- rest = __rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless"]);
373
+ rest = __rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless", "checkRelation"]);
373
374
  const {
374
375
  inputValue,
375
376
  selectedKeys,
376
377
  checkedKeys,
377
378
  keyEntities,
378
- isFocus
379
+ isFocus,
380
+ realCheckedKeys
379
381
  } = this.state;
380
382
  const filterable = Boolean(filterTreeNode);
381
383
  const useCustomTrigger = typeof triggerRender === 'function';
@@ -403,31 +405,45 @@ class TreeSelect extends _baseComponent.default {
403
405
  [`${prefixcls}-with-suffix`]: suffix,
404
406
  [`${prefixcls}-with-suffix`]: suffix
405
407
  }, className);
406
- const triggerRenderKeys = multiple ? (0, _treeUtil.normalizeKeyList)([...checkedKeys], keyEntities, leafOnly, true) : selectedKeys;
407
- const inner = useCustomTrigger ? /*#__PURE__*/_react.default.createElement(_trigger.default, {
408
- inputValue: inputValue,
409
- value: triggerRenderKeys.map(key => (0, _get2.default)(keyEntities, [key, 'data'])),
410
- disabled: disabled,
411
- placeholder: placeholder,
412
- onClear: this.handleClear,
413
- componentName: 'TreeSelect',
414
- triggerRender: triggerRender,
415
- componentProps: Object.assign({}, this.props),
416
- onSearch: this.search,
417
- onRemove: this.removeTag
418
- }) : [/*#__PURE__*/_react.default.createElement(_react.Fragment, {
419
- key: 'prefix'
420
- }, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
421
- key: 'selection'
422
- }, /*#__PURE__*/_react.default.createElement("div", {
423
- className: `${prefixcls}-selection`
424
- }, this.renderSelectContent())), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
425
- key: 'suffix'
426
- }, suffix ? this.renderSuffix() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
427
- key: 'clearBtn'
428
- }, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
429
- key: 'arrow'
430
- }, this.renderArrow())];
408
+ let inner;
409
+ if (useCustomTrigger) {
410
+ let triggerRenderKeys = [];
411
+ if (multiple) {
412
+ if (checkRelation === 'related') {
413
+ triggerRenderKeys = (0, _treeUtil.normalizeKeyList)(checkedKeys, keyEntities, leafOnly, true);
414
+ } else if (checkRelation === 'unRelated') {
415
+ triggerRenderKeys = [...realCheckedKeys];
416
+ }
417
+ } else {
418
+ triggerRenderKeys = selectedKeys;
419
+ }
420
+ inner = /*#__PURE__*/_react.default.createElement(_trigger.default, {
421
+ inputValue: inputValue,
422
+ value: triggerRenderKeys.map(key => (0, _get2.default)(keyEntities, [key, 'data'])),
423
+ disabled: disabled,
424
+ placeholder: placeholder,
425
+ onClear: this.handleClear,
426
+ componentName: 'TreeSelect',
427
+ triggerRender: triggerRender,
428
+ componentProps: Object.assign({}, this.props),
429
+ onSearch: this.search,
430
+ onRemove: this.removeTag
431
+ });
432
+ } else {
433
+ inner = [/*#__PURE__*/_react.default.createElement(_react.Fragment, {
434
+ key: 'prefix'
435
+ }, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
436
+ key: 'selection'
437
+ }, /*#__PURE__*/_react.default.createElement("div", {
438
+ className: `${prefixcls}-selection`
439
+ }, this.renderSelectContent())), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
440
+ key: 'suffix'
441
+ }, suffix ? this.renderSuffix() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
442
+ key: 'clearBtn'
443
+ }, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/_react.default.createElement(_react.Fragment, {
444
+ key: 'arrow'
445
+ }, this.renderArrow())];
446
+ }
431
447
  const tabIndex = disabled ? null : 0;
432
448
  /**
433
449
  * Reasons for disabling the a11y eslint rule:
@@ -358,15 +358,17 @@ class TreeSelect extends BaseComponent {
358
358
  leafOnly,
359
359
  searchPosition,
360
360
  triggerRender,
361
- borderless
361
+ borderless,
362
+ checkRelation
362
363
  } = _a,
363
- rest = __rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless"]);
364
+ rest = __rest(_a, ["disabled", "multiple", "filterTreeNode", "validateStatus", "prefix", "suffix", "style", "size", "insetLabel", "className", "placeholder", "showClear", "leafOnly", "searchPosition", "triggerRender", "borderless", "checkRelation"]);
364
365
  const {
365
366
  inputValue,
366
367
  selectedKeys,
367
368
  checkedKeys,
368
369
  keyEntities,
369
- isFocus
370
+ isFocus,
371
+ realCheckedKeys
370
372
  } = this.state;
371
373
  const filterable = Boolean(filterTreeNode);
372
374
  const useCustomTrigger = typeof triggerRender === 'function';
@@ -394,31 +396,45 @@ class TreeSelect extends BaseComponent {
394
396
  [`${prefixcls}-with-suffix`]: suffix,
395
397
  [`${prefixcls}-with-suffix`]: suffix
396
398
  }, className);
397
- const triggerRenderKeys = multiple ? normalizeKeyList([...checkedKeys], keyEntities, leafOnly, true) : selectedKeys;
398
- const inner = useCustomTrigger ? /*#__PURE__*/React.createElement(Trigger, {
399
- inputValue: inputValue,
400
- value: triggerRenderKeys.map(key => _get(keyEntities, [key, 'data'])),
401
- disabled: disabled,
402
- placeholder: placeholder,
403
- onClear: this.handleClear,
404
- componentName: 'TreeSelect',
405
- triggerRender: triggerRender,
406
- componentProps: Object.assign({}, this.props),
407
- onSearch: this.search,
408
- onRemove: this.removeTag
409
- }) : [/*#__PURE__*/React.createElement(Fragment, {
410
- key: 'prefix'
411
- }, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/React.createElement(Fragment, {
412
- key: 'selection'
413
- }, /*#__PURE__*/React.createElement("div", {
414
- className: `${prefixcls}-selection`
415
- }, this.renderSelectContent())), /*#__PURE__*/React.createElement(Fragment, {
416
- key: 'suffix'
417
- }, suffix ? this.renderSuffix() : null), /*#__PURE__*/React.createElement(Fragment, {
418
- key: 'clearBtn'
419
- }, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/React.createElement(Fragment, {
420
- key: 'arrow'
421
- }, this.renderArrow())];
399
+ let inner;
400
+ if (useCustomTrigger) {
401
+ let triggerRenderKeys = [];
402
+ if (multiple) {
403
+ if (checkRelation === 'related') {
404
+ triggerRenderKeys = normalizeKeyList(checkedKeys, keyEntities, leafOnly, true);
405
+ } else if (checkRelation === 'unRelated') {
406
+ triggerRenderKeys = [...realCheckedKeys];
407
+ }
408
+ } else {
409
+ triggerRenderKeys = selectedKeys;
410
+ }
411
+ inner = /*#__PURE__*/React.createElement(Trigger, {
412
+ inputValue: inputValue,
413
+ value: triggerRenderKeys.map(key => _get(keyEntities, [key, 'data'])),
414
+ disabled: disabled,
415
+ placeholder: placeholder,
416
+ onClear: this.handleClear,
417
+ componentName: 'TreeSelect',
418
+ triggerRender: triggerRender,
419
+ componentProps: Object.assign({}, this.props),
420
+ onSearch: this.search,
421
+ onRemove: this.removeTag
422
+ });
423
+ } else {
424
+ inner = [/*#__PURE__*/React.createElement(Fragment, {
425
+ key: 'prefix'
426
+ }, prefix || insetLabel ? this.renderPrefix() : null), /*#__PURE__*/React.createElement(Fragment, {
427
+ key: 'selection'
428
+ }, /*#__PURE__*/React.createElement("div", {
429
+ className: `${prefixcls}-selection`
430
+ }, this.renderSelectContent())), /*#__PURE__*/React.createElement(Fragment, {
431
+ key: 'suffix'
432
+ }, suffix ? this.renderSuffix() : null), /*#__PURE__*/React.createElement(Fragment, {
433
+ key: 'clearBtn'
434
+ }, showClear || isTriggerPositionSearch && inputValue ? this.renderClearBtn() : null), /*#__PURE__*/React.createElement(Fragment, {
435
+ key: 'arrow'
436
+ }, this.renderArrow())];
437
+ }
422
438
  const tabIndex = disabled ? null : 0;
423
439
  /**
424
440
  * Reasons for disabling the a11y eslint rule:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.56.3",
3
+ "version": "2.56.4-alpha.0",
4
4
  "description": "A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -20,12 +20,12 @@
20
20
  "@dnd-kit/core": "^6.0.8",
21
21
  "@dnd-kit/sortable": "^7.0.2",
22
22
  "@dnd-kit/utilities": "^3.2.1",
23
- "@douyinfe/semi-animation": "2.56.3",
24
- "@douyinfe/semi-animation-react": "2.56.3",
25
- "@douyinfe/semi-foundation": "2.56.3",
26
- "@douyinfe/semi-icons": "2.56.3",
27
- "@douyinfe/semi-illustrations": "2.56.3",
28
- "@douyinfe/semi-theme-default": "2.56.3",
23
+ "@douyinfe/semi-animation": "2.56.4-alpha.0",
24
+ "@douyinfe/semi-animation-react": "2.56.4-alpha.0",
25
+ "@douyinfe/semi-foundation": "2.56.4-alpha.0",
26
+ "@douyinfe/semi-icons": "2.56.4-alpha.0",
27
+ "@douyinfe/semi-illustrations": "2.56.4-alpha.0",
28
+ "@douyinfe/semi-theme-default": "2.56.4-alpha.0",
29
29
  "async-validator": "^3.5.0",
30
30
  "classnames": "^2.2.6",
31
31
  "copy-text-to-clipboard": "^2.1.1",
@@ -75,7 +75,7 @@
75
75
  ],
76
76
  "author": "",
77
77
  "license": "MIT",
78
- "gitHead": "933e2bf0c8d66a690b83d0410656ba4cdf265537",
78
+ "gitHead": "79899fabc7a45725c58a2c62dcc12d76a62039ec",
79
79
  "devDependencies": {
80
80
  "@babel/plugin-proposal-decorators": "^7.15.8",
81
81
  "@babel/plugin-transform-runtime": "^7.15.8",