LCOV - code coverage report
Current view: top level - src/components/SSVGPropEdit - PropertyEdit.vue.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 1 7 14.3 %
Date: 2025-06-29 02:18:36 Functions: 1 4 25.0 %

          Line data    Source code
       1             : // @ts-check
       2             : 
       3             : import Vue from "vue";
       4             : import { mapState } from "vuex";
       5             : import Card from "../Card.vue";
       6             : import PropertyCodeEditor from "./PropertyCodeEditor.vue";
       7             : import { BaseKeyboardEventMixin as KBMixin } from "@cern/base-vue";
       8             : import { noop } from "lodash";
       9             : 
      10             : /** @typedef {{ card: V.Instance<Card>, cm: V.Instance<PropertyCodeEditor>}} Refs */
      11             : 
      12             : export default /** @type {V.Constructor<any, Refs>} */ (Vue).extend({
      13             :   name: "PropertyEdit",
      14             :   components: { Card, PropertyCodeEditor },
      15             :   mixins: [ KBMixin({ local: true }) ],
      16             :   props: { title: { type: String, default: "Property" } },
      17             :   computed: {
      18             :     .../** @type {{ property(): Element|null }} */(mapState("selection", [ "property" ])),
      19             :     .../** @type {{ showKeyHints(): boolean }} */(mapState("ui", [ "showKeyHints" ]))
      20             :   },
      21             :   mounted() {
      22           1 :     this.onKey("ctrl-s-keydown", (/** @type {Event} */e) => {
      23           0 :       if (this.$refs.card?.isFocused) {
      24           0 :         e.preventDefault(); this.doApply();
      25             :       }
      26             :     });
      27             :   },
      28             :   methods: {
      29             :     async doApply() {
      30           0 :       if (!this.property) { return; }
      31           0 :       this.$refs.cm?.doApply();
      32             :     },
      33             :     doDelete() {
      34           0 :       if (!this.property) { return; }
      35           0 :       this.$store.dispatch("remove", "property").catch(noop);
      36             :     }
      37             :   }
      38             : });

Generated by: LCOV version 1.16