Line data Source code
1 : // @ts-check 2 : 3 : import Vue from "vue"; 4 : import { isEmpty } from "lodash"; 5 : 6 : import { isCSS } from "@cern/ssvg-engine"; 7 : import SVGSelector from "../SVGSelector.vue"; 8 : 9 : import RelationEdit from "./RelationEdit.vue"; 10 : import TransformEditValues from "./TransformEditValues.vue"; 11 : import Card from "../Card.vue"; 12 : import RelationCodeEditor from "./RelationCodeEditor.vue"; 13 : 14 : 15 : export default /** @type {V.Constructor<any, any>} */ (Vue).extend({ 16 : name: "TransformEdit", 17 : components: { SVGSelector, TransformEditValues, Card, RelationCodeEditor }, 18 : extends: RelationEdit, 19 : methods: { 20 : /** 21 : * @return {string} 22 : */ 23 : getAttributeName() { 24 0 : return isEmpty(this.attributeName) ? "transform" : this.attributeName; 25 : }, 26 : getAttributeType() { 27 0 : if (!this.attributeType || this.attributeType === "auto") { 28 : /* FIXME: current implementation targets DOM by default */ 29 0 : if (!this.attributeName || this.attributeName === "transform") { 30 0 : return "XML"; 31 : } 32 0 : return isCSS(this.getAttributeName()) ? "CSS" : "XML"; 33 : } 34 : else { 35 0 : return this.attributeType; 36 : } 37 : } 38 : } 39 : });