2020-02-03 21:22:14 +08:00
|
|
|
import { oneWay, readOnly } from "@ember/object/computed";
|
2023-10-18 18:07:09 +08:00
|
|
|
import I18n from "discourse-i18n";
|
2023-10-11 02:38:59 +08:00
|
|
|
import DropdownSelectBoxComponent from "select-kit/components/dropdown-select-box";
|
2018-01-15 18:55:16 +08:00
|
|
|
|
|
|
|
export default DropdownSelectBoxComponent.extend({
|
|
|
|
classNames: ["period-chooser"],
|
2020-09-12 02:53:44 +08:00
|
|
|
classNameBindings: ["showPeriods::hidden"],
|
2019-11-09 00:32:20 +08:00
|
|
|
content: oneWay("site.periods"),
|
2020-02-03 21:22:14 +08:00
|
|
|
value: readOnly("period"),
|
|
|
|
valueProperty: null,
|
|
|
|
nameProperty: null,
|
2020-09-12 02:53:44 +08:00
|
|
|
showPeriods: true,
|
2020-02-03 21:22:14 +08:00
|
|
|
|
|
|
|
modifyComponentForRow() {
|
|
|
|
return "period-chooser/period-chooser-row";
|
|
|
|
},
|
2018-01-15 18:55:16 +08:00
|
|
|
|
2020-02-03 21:22:14 +08:00
|
|
|
selectKitOptions: {
|
|
|
|
filterable: false,
|
|
|
|
autoFilterable: false,
|
|
|
|
fullDay: "fullDay",
|
2021-05-20 14:00:45 +08:00
|
|
|
customStyle: true,
|
2020-02-03 21:22:14 +08:00
|
|
|
headerComponent: "period-chooser/period-chooser-header",
|
2021-09-24 23:52:07 +08:00
|
|
|
headerAriaLabel: I18n.t("period_chooser.aria_label"),
|
2018-05-09 16:05:40 +08:00
|
|
|
},
|
|
|
|
|
2018-01-15 18:55:16 +08:00
|
|
|
actions: {
|
2020-02-03 21:22:14 +08:00
|
|
|
onChange(value) {
|
2019-01-10 18:06:01 +08:00
|
|
|
if (this.action) {
|
2020-02-03 21:22:14 +08:00
|
|
|
this.action(value);
|
|
|
|
} else {
|
|
|
|
this.attrs.onChange && this.attrs.onChange(value);
|
2019-01-10 18:06:01 +08:00
|
|
|
}
|
2018-01-15 18:55:16 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|