Skip to content

Commit

Permalink
feat(calendar): add silent option for dayLabel/monthLabel/yearL…
Browse files Browse the repository at this point in the history
…abel`.
  • Loading branch information
plainheart committed Nov 9, 2024
1 parent 18f8ea3 commit 61f2e84
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 61f2e84

Please sign in to comment.