Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(comp:select): add 'overlay' to searchable #729

Merged
merged 1 commit into from
Jan 19, 2022

Conversation

sallerli1
Copy link
Contributor

input is now rendered within overlay when searchable is 'overlay'

fix(comp:selectable): fix selected options render when using IxSelectOption

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added/updated or not needed
  • Docs and demo have been added/updated or not needed

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Component style update
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

  1. searchable 不支持 ’overlay‘
  2. 使用 IxSelectOption渲染的option在选中时不显示

What is the new behavior?

  1. searchable支持 'overlay', 与 tree-select 保持一致
  2. 使用 IxSelectOption渲染的option在选中时可以正常显示

Other information

抽离label渲染的工具函数 renderOptionLabel

@idux-bot
Copy link

idux-bot bot commented Jan 17, 2022

This preview will be available after the AzureCI is passed.

@codecov
Copy link

codecov bot commented Jan 17, 2022

Codecov Report

Merging #729 (1bada18) into main (91f501a) will decrease coverage by 0.00%.
The diff coverage is 88.88%.

❗ Current head 1bada18 differs from pull request most recent head d3a6dfe. Consider uploading reports for the commit d3a6dfe to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##             main     #729      +/-   ##
==========================================
- Coverage   85.46%   85.46%   -0.01%     
==========================================
  Files         420      421       +1     
  Lines       10673    10688      +15     
  Branches     2507     2516       +9     
==========================================
+ Hits         9122     9134      +12     
- Misses       1551     1554       +3     
Impacted Files Coverage Δ
packages/components/select/src/content/Option.tsx 100.00% <ø> (ø)
packages/components/select/src/types.ts 100.00% <ø> (ø)
packages/components/select/src/content/Content.tsx 86.36% <66.66%> (-3.64%) ⬇️
...ackages/components/select/src/trigger/Selector.tsx 96.22% <88.23%> (-3.78%) ⬇️
packages/components/select/src/content/ListBox.tsx 100.00% <100.00%> (ø)
packages/components/select/src/trigger/Input.tsx 100.00% <100.00%> (ø)
packages/components/select/src/trigger/Trigger.tsx 77.58% <100.00%> (ø)
...s/components/select/src/utils/renderOptionLabel.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91f501a...d3a6dfe. Read the comment docs.

const labelRender = rawOption.customLabel ?? 'optionLabel'
const labelSlot = isString(labelRender) ? slots[labelRender] : labelRender

return slots.label?.(rawOption) ?? labelSlot?.(rawOption) ?? label
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return slots.label?.(rawOption) ?? labelSlot?.(rawOption) ?? label
return labelSlot? labelSlot(rawOption) : label

if (isMax) {
labelNode = slots.maxLabel?.(item.value) ?? label
} else {
labelNode = slots.label?.(item.rawOption) ?? rawOption.slots?.default?.() ?? label
labelNode = slots.label?.(rawOption) ?? renderOptionLabel(slots, rawOption, label)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
labelNode = slots.label?.(rawOption) ?? renderOptionLabel(slots, rawOption, label)
labelNode = slots.label ? slots.label(rawOption) : renderOptionLabel(slots, rawOption, label)

@sallerli1 sallerli1 force-pushed the feat-select-searchable-saller branch from cc8923a to be59d57 Compare January 18, 2022 14:03
input is now rendered within overlay when searchable is 'overlay'

fix(comp:selectable): fix selected options render when using IxOption

refactor(comp:selectable): replace slot label with selectedLabel
replace slot maxLabel with overflowedLabel
@sallerli1 sallerli1 force-pushed the feat-select-searchable-saller branch from be59d57 to d3a6dfe Compare January 18, 2022 14:14
@danranVm danranVm merged commit 68c6adc into IDuxFE:main Jan 19, 2022
@sallerli1 sallerli1 deleted the feat-select-searchable-saller branch February 20, 2023 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants