mirror of
https://github.com/discourse/discourse.git
synced 2024-12-22 14:33:47 +08:00
32665cf9dd
Enables our new eslint rules which enforce consistent i18n imports. For more info, see 0d58b40cd7
39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
import { action } from "@ember/object";
|
|
import { oneWay, readOnly } from "@ember/object/computed";
|
|
import { classNameBindings, classNames } from "@ember-decorators/component";
|
|
import { i18n } from "discourse-i18n";
|
|
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
|
import { selectKitOptions } from "select-kit/components/select-kit";
|
|
|
|
@classNames("period-chooser")
|
|
@classNameBindings("showPeriods::hidden")
|
|
@selectKitOptions({
|
|
filterable: false,
|
|
autoFilterable: false,
|
|
fullDay: "fullDay",
|
|
customStyle: true,
|
|
headerComponent: "period-chooser/period-chooser-header",
|
|
headerAriaLabel: i18n("period_chooser.aria_label"),
|
|
})
|
|
export default class PeriodChooser extends DropdownSelectBoxComponent {
|
|
@oneWay("site.periods") content;
|
|
@readOnly("period") value;
|
|
|
|
valueProperty = null;
|
|
nameProperty = null;
|
|
showPeriods = true;
|
|
|
|
modifyComponentForRow() {
|
|
return "period-chooser/period-chooser-row";
|
|
}
|
|
|
|
@action
|
|
_onChange(value) {
|
|
if (this.action) {
|
|
this.action(value);
|
|
} else {
|
|
this.onChange?.(value);
|
|
}
|
|
}
|
|
}
|