Skip to content

Commit

Permalink
Merge pull request #20492 from apache/feat/calendar-label-silent
Browse files Browse the repository at this point in the history
feat(calendar): add `silent` option for `dayLabel`/`monthLabel`/`yearLabel`
  • Loading branch information
Ovilia authored Nov 15, 2024
2 parents 23efa66 + 61f2e84 commit 2576fc2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
13 changes: 10 additions & 3 deletions src/component/calendar/CalendarView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ class CalendarView extends ComponentView {
z2: 30,
style: createTextStyle(yearLabel, {
text: content
})
}),
silent: yearLabel.get('silent')
});
yearText.attr(this._yearTextPositionControl(yearText, posPoints[pos], orient, pos, margin));

Expand Down Expand Up @@ -422,6 +423,8 @@ class CalendarView extends ComponentView {
margin = pos === 'start' ? -margin : margin;
const isCenter = (align === 'center');

const labelSilent = monthLabel.get('silent');

for (let i = 0; i < termPoints[idx].length - 1; i++) {

const tmp = termPoints[idx][i].slice();
Expand Down Expand Up @@ -449,7 +452,8 @@ class CalendarView extends ComponentView {
style: extend(
createTextStyle(monthLabel, {text: content}),
this._monthTextPositionControl(tmp, isCenter, orient, pos, margin)
)
),
silent: labelSilent
});

group.add(monthText);
Expand Down Expand Up @@ -533,6 +537,8 @@ class CalendarView extends ComponentView {
margin = -margin;
}

const labelSilent = dayLabel.get('silent');

for (let i = 0; i < 7; i++) {

const tmpD = coordSys.getNextNDay(start, i);
Expand All @@ -544,7 +550,8 @@ class CalendarView extends ComponentView {
style: extend(
createTextStyle(dayLabel, {text: nameMap[day]}),
this._weekTextPositionControl(point, orient, pos, margin, cellSize)
)
),
silent: labelSilent
});

group.add(weekText);
Expand Down
11 changes: 10 additions & 1 deletion test/calendar-simple.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2576fc2

Please sign in to comment.