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(sheet): support range theme template #4369

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from

Conversation

VicKun4937
Copy link
Contributor

@VicKun4937 VicKun4937 commented Dec 26, 2024

  • support sheet range theme template
    Strategy:
  • the row style has high priority than col style, it means a row style has backgroud red, and column is blue, it will show red.
  • the style will merge different property
  • if two range is interestect , the fisrt one will effect.
  • the column has low proprity to row.
const fwb = univerAPI.getActiveWorkbook()
const fws = fwb.getActiveSheet()
// const fRange = fws.getRange('A1:D21');
// fRange.useThemeStyle('default');
// fRange.useThemeStyle('rowYellow');
let startRowoffset = 0;

const themes = fwb.getRegisteredRangeThemes();
const count = (themes.length -1) /3;
for(let i =0 ;i < count; i++){
     fws.getRange(startRowoffset, 0,   6 ,5 ).useThemeStyle(themes[i*3+1]);
     fws.getRange(startRowoffset, 6,   6 ,5 ).useThemeStyle(themes[i*3+2]);
     fws.getRange(startRowoffset, 12,   6 ,5 ).useThemeStyle(themes[i*3+3]);
    startRowoffset+= 7
}
企业微信截图_17355636852885

@VicKun4937 VicKun4937 marked this pull request as draft December 26, 2024 09:14
Copy link

github-actions bot commented Dec 26, 2024

View Deployment

📑 Examples 📚 Storybook
🔗 Preview link 🔗 Preview link

Copy link

github-actions bot commented Dec 26, 2024

Playwright test results

failed  15 failed
passed  6 passed

Details

stats  21 tests across 10 suites
duration  16 minutes, 58 seconds
commit  cdcf0c2
info  For more information, see full report

Failed tests

chromium › disposing/disposing.spec.ts › no error on constructing and disposing
chromium › disposing/disposing.spec.ts › no error on constructing and disposing sheet unit
chromium › disposing/disposing.spec.ts › no error when dispose a unit
chromium › smoking/mobile-s/mobile-s-smoking.spec.ts › ensure mobile-s boots up without errors
chromium › smoking/sheets-multi/sheets-multi-smoking.spec.ts › ensure sheets-multi boots up without errors
chromium › smoking/uni/uni-smoking.spec.ts › ensure uni boots up without errors
chromium › visual-comparison/sheets/sheets-gridlines.spec.ts › sheets no gridlines
chromium › visual-comparison/sheets/sheets-scroll.spec.ts › cells rendering after scrolling
chromium › visual-comparison/sheets/sheets-scroll.spec.ts › rendering after scrolling by API
chromium › visual-comparison/sheets/sheets-visual-comparison.spec.ts › diff default sheet toolbar
chromium › visual-comparison/sheets/sheets-visual-comparison.spec.ts › diff default sheet content
chromium › visual-comparison/sheets/sheets-visual-comparison.spec.ts › diff demo sheet content
chromium › visual-comparison/sheets/sheets-visual-comparison.spec.ts › diff merged cells rendering
chromium › visual-comparison/sheets/sheets-visual-comparison.spec.ts › diff sheet default style rendering
chromium › visual-comparison/sheets/sheets-visual-comparison.spec.ts › diff facade sheet hooks

Copy link

codecov bot commented Dec 26, 2024

Codecov Report

Attention: Patch coverage is 1.31868% with 449 lines in your changes missing coverage. Please review.

Project coverage is 33.22%. Comparing base (e909093) to head (8156334).
Report is 8 commits behind head on dev.

Files with missing lines Patch % Lines
packages/sheets/src/model/range-theme-util.ts 0.00% 183 Missing ⚠️
packages/sheets/src/model/range-theme-model.ts 0.00% 148 Missing ⚠️
...ds/mutations/add-worksheet-range-theme.mutation.ts 0.00% 15 Missing ⚠️
...mutations/delete-worksheet-range-theme.mutation.ts 0.00% 15 Missing ⚠️
...ackages/sheets/src/services/range-theme-service.ts 0.00% 14 Missing ⚠️
...ands/commands/add-worksheet-range-theme.command.ts 0.00% 11 Missing ⚠️
...s/commands/delete-worksheet-range-theme.command.ts 0.00% 11 Missing ⚠️
packages/sheets/src/facade/f-range.ts 0.00% 11 Missing ⚠️
packages/sheets/src/model/range-themes/blue.ts 0.00% 6 Missing ⚠️
packages/sheets/src/model/range-themes/green.ts 0.00% 6 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #4369      +/-   ##
==========================================
- Coverage   33.37%   33.22%   -0.16%     
==========================================
  Files        2529     2542      +13     
  Lines      130404   131072     +668     
  Branches    29103    29229     +126     
==========================================
+ Hits        43526    43545      +19     
- Misses      86878    87527     +649     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@VicKun4937 VicKun4937 force-pushed the feat-range-theme-template branch from 70bd910 to a77fb5b Compare December 28, 2024 09:15
@VicKun4937 VicKun4937 force-pushed the feat-range-theme-template branch from 22c0b27 to 26624fa Compare December 30, 2024 06:31
Copy link
Member

@wzhudev wzhudev left a comment

Choose a reason for hiding this comment

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

LGTM. cc @hexf00 If you are going to release this PR in a version, please make sure that corresponding transform functions are implemented in univer-pro as this PR introduces two new mutations. cc @yuhongz as collaboration owner.

@wzhudev wzhudev requested a review from yuhongz December 31, 2024 02:16
Copy link
Contributor

@yuhongz yuhongz left a comment

Choose a reason for hiding this comment

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

LGTM

@lumixraku lumixraku marked this pull request as ready for review December 31, 2024 06:46
@univer-bot
Copy link

univer-bot bot commented Dec 31, 2024

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: feat(sheet): support range theme template

Title: feat(sheet): support range theme template


  • support sheet range theme template
    Strategy:
  • the row style has high priority than col style, it means a row style has backgroud red, and column is blue, it will show red.
  • the style will merge different property
  • if two range is interestect , the fisrt one will effect.
  • the column has low proprity to row.
const fwb = univerAPI.getActiveWorkbook()
const fws = fwb.getActiveSheet()
// const fRange = fws.getRange('A1:D21');
// fRange.useThemeStyle('default');
// fRange.useThemeStyle('rowYellow');
let startRowoffset = 0;

const themes = fwb.getRegisteredRangeThemes();
const count = (themes.length -1) /3;
for(let i =0 ;i < count; i++){
     fws.getRange(startRowoffset, 0,   6 ,5 ).useThemeStyle(themes[i*3+1]);
     fws.getRange(startRowoffset, 6,   6 ,5 ).useThemeStyle(themes[i*3+2]);
     fws.getRange(startRowoffset, 12,   6 ,5 ).useThemeStyle(themes[i*3+3]);
    startRowoffset+= 7
}
企业微信截图_17355636852885

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.

3 participants