Skip to content

Commit

Permalink
Remove ember render modifiers (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkszepp authored May 6, 2024
1 parent 57877b1 commit d36c068
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 28 deletions.
1 change: 0 additions & 1 deletion ember-power-calendar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"@embroider/addon-shim": "^1.8.7",
"decorator-transforms": "^1.0.1",
"@embroider/util": "^1.13.0",
"@ember/render-modifiers": "^2.1.0",
"@embroider/macros": "^1.15.0",
"ember-assign-helper": "^0.5.0",
"ember-element-helper": "^0.8.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Days=(component (ensure-safe-component (or @daysComponent this.daysComponent)) calendar=(readonly this.publicAPI))
)) as |calendar|}}
{{#let (element this.tagWithDefault) as |Tag|}}
<Tag class="ember-power-calendar" ...attributes id={{calendar.uniqueId}}
{{will-destroy this.destroyElement}}
>
<Tag class="ember-power-calendar" ...attributes id={{calendar.uniqueId}}>
{{#if (has-block)}}
{{yield calendar}}
{{else}}
Expand Down
10 changes: 5 additions & 5 deletions ember-power-calendar/src/components/power-calendar-multiple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ export default class PowerCalendarMultipleComponent extends Component<PowerCalen
}
}

willDestroy(): void {
super.willDestroy();
this.unregisterCalendar();
}

get publicActions(): PowerCalendarActions {
return publicActionsObject(
this.args.onSelect,
Expand Down Expand Up @@ -183,11 +188,6 @@ export default class PowerCalendarMultipleComponent extends Component<PowerCalen
}
}

@action
destroyElement() {
this.unregisterCalendar();
}

// Methods
_buildCollection(days: PowerCalendarDay[]): NormalizeMultipleActionValue {
let selected = this.selected || [];
Expand Down
4 changes: 1 addition & 3 deletions ember-power-calendar/src/components/power-calendar-range.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Days=(component (ensure-safe-component (or @daysComponent this.daysComponent)) calendar=(readonly this.publicAPI))
)) as |calendar|}}
{{#let (element this.tagWithDefault) as |Tag|}}
<Tag class="ember-power-calendar" ...attributes id={{calendar.uniqueId}}
{{will-destroy this.destroyElement}}
>
<Tag class="ember-power-calendar" ...attributes id={{calendar.uniqueId}}>
{{#if (has-block)}}
{{yield calendar}}
{{else}}
Expand Down
10 changes: 5 additions & 5 deletions ember-power-calendar/src/components/power-calendar-range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export default class PowerCalendarRangeComponent extends Component<PowerCalendar
}
}

willDestroy(): void {
super.willDestroy();
this.unregisterCalendar();
}

get publicActions(): PowerCalendarActions {
return publicActionsObject(
this.args.onSelect,
Expand Down Expand Up @@ -229,11 +234,6 @@ export default class PowerCalendarRangeComponent extends Component<PowerCalendar
}
}

@action
destroyElement() {
this.unregisterCalendar();
}

_formatRange(v: number | undefined) {
if (typeof v === 'number') {
return v * DAY_IN_MS;
Expand Down
4 changes: 1 addition & 3 deletions ember-power-calendar/src/components/power-calendar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Days=(component (ensure-safe-component (or @daysComponent this.daysComponent)) calendar=(readonly this.publicAPI))
)) as |calendar|}}
{{#let (element this.tagWithDefault) as |Tag|}}
<Tag class="ember-power-calendar" ...attributes id={{calendar.uniqueId}}
{{will-destroy this.destroyElement}}
>
<Tag class="ember-power-calendar" ...attributes id={{calendar.uniqueId}}>
{{#if (has-block)}}
{{yield calendar}}
{{else}}
Expand Down
10 changes: 5 additions & 5 deletions ember-power-calendar/src/components/power-calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ export default class PowerCalendarComponent extends Component<PowerCalendarSigna
}
}

willDestroy(): void {
super.willDestroy();
this.unregisterCalendar();
}

get publicActions(): PowerCalendarActions {
return publicActionsObject(
this.args.onSelect,
Expand Down Expand Up @@ -194,11 +199,6 @@ export default class PowerCalendarComponent extends Component<PowerCalendarSigna
}
}

@action
destroyElement() {
this.unregisterCalendar();
}

// Methods
registerCalendar() {
if (window) {
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

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

0 comments on commit d36c068

Please sign in to comment.