Sha256: 4a1f60d4a418908b294710e976158c64f5b4bb4e8e67c1feedc0d1d7a347f923
Contents?: true
Size: 1.21 KB
Versions: 3
Compression:
Stored size: 1.21 KB
Contents
import { CocoComponent } from "@assets/js/base/coco"; import { getComponent } from "@helpers/alpine"; export default CocoComponent("appToolbar", () => { return { ready: false, startSectionWidth: null, endSectionWidth: null, get startGroupEl() { return this.$refs.startSection.firstElementChild; }, get endGroupEl() { return this.$refs.endSection.firstElementChild; }, get groups() { return [this.startGroupEl, this.endGroupEl] .filter((g) => g) .map((el) => getComponent(el, false)); }, init() { const toolbarWidth = this.$el.offsetWidth; let startSectionWidth = 0; let endSectionWidth = 0; if (this.startGroupEl) { startSectionWidth = Math.ceil( (this.startGroupEl.offsetWidth / toolbarWidth) * 100 ); } if (this.endGroupEl) { endSectionWidth = Math.ceil( (this.endGroupEl.offsetWidth / toolbarWidth) * 100 ); } this.$nextTick(() => { this.startSectionWidth = `${startSectionWidth}%`; this.endSectionWidth = `${endSectionWidth}%`; this.groups.forEach((group) => group.onResize()); this.ready = true; }); }, }; });
Version data entries
3 entries across 3 versions & 1 rubygems