Sha256: e213f3eb66ac70c1f5a68dea8151e6b4017e02f184685fd47d993d300d60f361
Contents?: true
Size: 927 Bytes
Versions: 21
Compression:
Stored size: 927 Bytes
Contents
import Component from "@ember/component"; import { computed } from "@ember/object"; import { equal } from "@ember/object/computed"; export default Component.extend({ classNames: ["nav-controls"], classNameBindings: ["extraClasses"], disableBackButtons: equal("position", 0), disableForwardButtons: computed("position", "list.length", function() { return this.position === this.get("list.length") - 1; }), displayNumber: computed("position", function() { return this.position + 1; }), actions: { takeStep(dir) { const amount = dir === "back" ? -1 : 1; if (amount === 1 && this.disableForwardButtons) return; if (amount === -1 && this.disableBackButtons) return; const newPos = this.position + amount; this.navigate(newPos); }, bigJump(dir) { const newPos = dir === "back" ? 0 : this.get("list.length") - 1; this.navigate(newPos); } } });
Version data entries
21 entries across 21 versions & 1 rubygems