{"version":3,"file":"list_controller-D7HuhxYZ.js","sources":["../../../app/javascript/controllers/property/list_controller.js"],"sourcesContent":["import {get, post} from \"@rails/request.js\";\n\nimport TagsController from \"./tags_controller\"\n\nexport default class extends TagsController {\n static values = {\n key: { type: String, default: \"list\" }\n }\n\n static targets = [\"list\", \"attachedList\", \"tag\"]\n\n async save({currentTarget: label}) {\n const options = {\n responseKind: \"turbo-stream\",\n body: {\n id: label.dataset.value,\n mode: this.element.closest('[data-mode]')?.dataset.mode\n }\n }\n\n const url = this.persistedValue ? this.labelingUrlValue : this.urlValue\n post(url, options)\n }\n\n async saveNewList({currentTarget: newList}) {\n const options = {\n responseKind: \"turbo-stream\",\n body: {\n [this.keyValue]: { name: newList.dataset.value },\n mode: this.element.closest('[data-mode]')?.dataset.mode\n }\n }\n\n await post(this.urlValue, options)\n\n this.menuTarget.innerHTML = ''\n }\n\n removeItem(e) {\n super.removeItem(e, '[data-property--list-target=\"item\"]')\n }\n\n resetTargetConnected() {\n this.inputTarget.value = \"\"\n this.inputTarget.focus()\n\n if(this.hasResetTarget) {\n this.resetTarget.remove()\n }\n }\n\n async onInputEnter() {\n const options = {\n responseKind: \"turbo-stream\",\n body: {\n [this.keyValue]: { name: this.inputTarget.value },\n mode: this.element.closest('[data-mode]')?.dataset.mode\n }\n }\n\n await post(this.urlValue, options)\n this.refocus()\n }\n\n tagTargetDisconnected() {\n this.inputTarget.value = ''\n this.inputTarget.focus()\n }\n}\n"],"names":["list_controller","TagsController","label","options","_a","url","post","newList","__publicField"],"mappings":"8PAIe,MAAKA,UAASC,CAAe,CAO1C,MAAM,KAAK,CAAC,cAAeC,CAAK,EAAG,OACjC,MAAMC,EAAU,CACd,aAAc,eACd,KAAM,CACJ,GAAID,EAAM,QAAQ,MAClB,MAAME,EAAA,KAAK,QAAQ,QAAQ,aAAa,IAAlC,YAAAA,EAAqC,QAAQ,IAC3D,CACA,EAEUC,EAAM,KAAK,eAAiB,KAAK,iBAAmB,KAAK,SAC/DC,EA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