{"version":3,"sources":["webpack:///./src/components/course_tree/node/TopicNode.vue?9ed3","webpack:///./src/components/course_tree/node/TopicNode.vue","webpack:///./src/components/course_tree/node/TopicNode.vue?2fcf"],"names":["_hoisted_1","class","_hoisted_2","_hoisted_3","key","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","render","_ctx","_cache","$props","$setup","$data","$options","_component_Btn","_component_CourseTreeNode","_component_draggable","_component_Spinner","_component_VueEternalLoading","isDraggable","node","name","canEdit","onClick","$event","$emit","variant","outline","tooltip","$t","default","_","children","length","disabled","modelValue","handle","onStart","onNodeDragStart","onEnd","onNodeDragEnd","animation","item","element","onEditNode","onDeleteNode","initialFetch","load","onLoadMore","loading","props","type","Object","required","emits","mixins","created","Promise","resolve","reject","fromFirstPage","resolveFn","rejectFn","data","draggingChild","methods","event","courseId","oldIndex","newIndex","loaded","noMore","error","console","log","moreResults","computed","this","mainStore","paginatedChildrenByNodeId","id","components","draggable","CourseTreeNode","Btn","VueEternalLoading","Spinner","__exports__"],"mappings":"mJAEMA,EAAa,CAAEC,MAAO,QACtBC,EAAa,CAAED,MAAO,6EACtBE,EAAa,CACjBC,IAAK,EACLH,MAAO,oLAEHI,EAAa,CAAEJ,MAAO,QACtBK,EAAa,CACjBF,IAAK,EACLH,MAAO,oCAEHM,EAA0B,gCAAoB,OAAQ,CAAEN,MAAO,kBAAoB,QAAS,GAC5FO,EAA0B,gCAAoB,OAAQ,CAAEP,MAAO,0BAA4B,YAAa,GACxGQ,EAAa,CAAER,MAAO,uBAEtB,SAAUS,EAAOC,EAAUC,EAAYC,EAAYC,EAAYC,EAAWC,GAC9E,IAAMC,EAAiB,8BAAkB,OACnCC,EAA4B,8BAAkB,kBAC9CC,EAAuB,8BAAkB,aACzCC,EAAqB,8BAAkB,WACvCC,EAA+B,8BAAkB,qBAEvD,OAAQ,yBAAc,gCAAoB,MAAOrB,EAAY,CAC3D,gCAAoB,MAAOE,EAAY,CACpCS,EAAKW,aACD,yBAAc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iB8C,2KAAnCsB,EAAmC,EAAnCA,OAAQC,EAA2B,EAA3BA,OAAQC,EAAmB,EAAnBA,MAClCC,QAAQC,IAAI,oBADyC,kBAGjB,IAAIjB,SAAQ,SAACC,EAASC,GAAV,OAE9C,EAAKlC,MAAM,eAAgB,CAC1BL,KAAM,EAAKA,KACXwC,eAAe,EACfC,UAAWH,EACXI,SAAUH,OATwC,OAG9CgB,EAH8C,OAY/CA,EAGJL,IAFAC,IAbmD,mDAkBpD,kCAAqB,EAAD,IACpBC,IAnBoD,6DAuBvDI,SAAU,iCACN,eAAU,oBADN,IAEP5C,SAFS,WAED,QACP,2BAAO6C,KAAKC,UAAUC,0BAA0BF,KAAKzD,KAAK4D,WAA1D,aAAO,EAAwDjB,YAA/D,QAAuE,MAGzEkB,WAAY,CAAEC,UAAA,IAAWC,iBAAA,KAAgBC,MAAA,KAAKC,oBAAA,KAAmBC,UAAA,Q,qBCxFlE,MAAMC,EAA2B,IAAgB,EAAQ,CAAC,CAAC,SAAShF,KAErD","file":"js/chunk-2d0c0881.a5f0abb4.js","sourcesContent":["import { openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, createBlock as _createBlock, createTextVNode as _createTextVNode } from \"vue\"\n\nconst _hoisted_1 = { class: \"my-8\" }\nconst _hoisted_2 = { class: \"group py-2 relative px-6 mb-2 flex items-center roudned-sm bg-light group\" }\nconst _hoisted_3 = {\n key: 0,\n class: \"opacity-0 group-hover:opacity-50 transition-opacity duration-100 ease absolute top-1/2 transform -translate-y-1/2 left-0 text-lg cursor-move drag-handle material-icons-outlined\"\n}\nconst _hoisted_4 = { class: \"mb-0\" }\nconst _hoisted_5 = {\n key: 1,\n class: \"ml-2 flex flex-grow items-center\"\n}\nconst _hoisted_6 = /*#__PURE__*/_createElementVNode(\"span\", { class: \"material-icons\" }, \"edit\", -1)\nconst _hoisted_7 = /*#__PURE__*/_createElementVNode(\"span\", { class: \"text-xl material-icons\" }, \" delete \", -1)\nconst _hoisted_8 = { class: \"my-2 md:mx-2.5 mx-1\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_Btn = _resolveComponent(\"Btn\")!\n const _component_CourseTreeNode = _resolveComponent(\"CourseTreeNode\")!\n const _component_draggable = _resolveComponent(\"draggable\")!\n const _component_Spinner = _resolveComponent(\"Spinner\")!\n const _component_VueEternalLoading = _resolveComponent(\"VueEternalLoading\")!\n\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createElementVNode(\"div\", _hoisted_2, [\n (_ctx.isDraggable)\n ? (_openBlock(), _createElementBlock(\"span\", _hoisted_3, \" drag_indicator \"))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"h3\", _hoisted_4, _toDisplayString(_ctx.node.name), 1),\n (_ctx.canEdit)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_5, [\n _createVNode(_component_Btn, {\n class: \"icon-btn-primary opacity-50 group-hover:opacity-100 transition-opacity duration-100 ease\",\n onClick: _cache[0] || (_cache[0] = ($event: any) => (_ctx.$emit('editNode', _ctx.node))),\n variant: 'icon',\n outline: true,\n tooltip: _ctx.$t('misc.edit')\n }, {\n default: _withCtx(() => [\n _hoisted_6\n ]),\n _: 1\n }, 8, [\"tooltip\"]),\n (_ctx.canEdit)\n ? (_openBlock(), _createBlock(_component_Btn, {\n key: 0,\n class: \"ml-auto opacity-50 group-hover:opacity-100 transition-opacity duration-100 ease\",\n onClick: _cache[1] || (_cache[1] = ($event: any) => (\n\t\t\t\t\t\t_ctx.children.length === 0 &&\n\t\t\t\t\t\t\t_ctx.$emit('deleteNode', _ctx.node) /* TODO shouldn't emit when disabled */\n\t\t\t\t\t)),\n disabled: _ctx.children.length > 0,\n variant: 'icon',\n outline: true,\n tooltip: \n\t\t\t\t\t\t_ctx.children.length > 0\n\t\t\t\t\t\t\t? _ctx.$t('course_tree.cannot_delete_nonempty_topic')\n\t\t\t\t\t\t\t: _ctx.$t('misc.delete')\n\t\t\t\t\t\n }, {\n default: _withCtx(() => [\n _hoisted_7\n ]),\n _: 1\n }, 8, [\"disabled\", \"tooltip\"]))\n : _createCommentVNode(\"\", true)\n ]))\n : _createCommentVNode(\"\", true)\n ]),\n _createVNode(_component_draggable, {\n \"ghost-class\": \"drag-ghost\",\n \"drag-class\": \"dragging-element\",\n modelValue: _ctx.children,\n handle: \".drag-handle\",\n \"item-key\": \"id\",\n onStart: _cache[4] || (_cache[4] = ($event: any) => (_ctx.onNodeDragStart($event))),\n onEnd: _cache[5] || (_cache[5] = ($event: any) => (_ctx.onNodeDragEnd($event))),\n animation: \"200\",\n class: \"hidden-in-dragging-element\"\n }, {\n item: _withCtx(({ element }) => [\n _createElementVNode(\"div\", _hoisted_8, [\n _createVNode(_component_CourseTreeNode, {\n isDraggable: _ctx.canEdit,\n onEditNode: _cache[2] || (_cache[2] = ($event: any) => (_ctx.$emit('editNode', $event))),\n onDeleteNode: _cache[3] || (_cache[3] = ($event: any) => (_ctx.$emit('deleteNode', $event))),\n canEdit: _ctx.canEdit,\n node: element\n }, null, 8, [\"isDraggable\", \"canEdit\", \"node\"])\n ])\n ]),\n _: 1\n }, 8, [\"modelValue\"]),\n (!_ctx.initialFetch)\n ? (_openBlock(), _createBlock(_component_VueEternalLoading, {\n key: 0,\n load: _ctx.onLoadMore\n }, {\n loading: _withCtx(() => [\n _createVNode(_component_Spinner)\n ]),\n \"no-more\": _withCtx(() => [\n _createTextVNode(\"   \")\n ]),\n _: 1\n }, 8, [\"load\"]))\n : _createCommentVNode(\"\", true),\n (_ctx.initialFetch)\n ? (_openBlock(), _createBlock(_component_Spinner, { key: 1 }))\n : _createCommentVNode(\"\", true)\n ]))\n}","\nimport draggable from \"vuedraggable\";\n\nimport { TopicNode } from \"@/models\";\nimport { defineComponent, PropType } from \"@vue/runtime-core\";\nimport CourseTreeNode from \"./CourseTreeNode.vue\";\nimport { nodeEmits, nodeProps } from \"../shared\";\nimport { mapStores } from \"pinia\";\nimport { useMainStore } from \"@/stores/mainStore\";\nimport Btn from \"@/components/ui/Btn.vue\";\nimport VueEternalLoading from \"@ts-pro/vue-eternal-loading/src/components/VueEternalLoading/VueEternalLoading.vue\";\nimport { LoadAction } from \"@ts-pro/vue-eternal-loading\";\nimport { setErrorNotification } from \"@/utils\";\nimport Spinner from \"@/components/ui/Spinner.vue\";\nimport { courseIdMixin } from \"@/mixins\";\nimport { onChangeNodePosition } from \"@/components/course_tree/shared\";\n\nexport default defineComponent({\n\tname: \"TopicNode\",\n\tprops: {\n\t\tnode: {\n\t\t\ttype: Object as PropType,\n\t\t\trequired: true,\n\t\t},\n\t\t...nodeProps,\n\t},\n\temits: {\n\t\t...nodeEmits,\n\t},\n\tmixins: [courseIdMixin],\n\tasync created() {\n\t\tawait new Promise((resolve, reject) =>\n\t\t\tthis.$emit(\"loadChildren\", {\n\t\t\t\tnode: this.node,\n\t\t\t\tfromFirstPage: true,\n\t\t\t\tresolveFn: resolve,\n\t\t\t\trejectFn: reject,\n\t\t\t}),\n\t\t);\n\t\tthis.initialFetch = false;\n\t},\n\tdata() {\n\t\treturn {\n\t\t\tinitialFetch: true,\n\t\t\tdraggingChild: false,\n\t\t};\n\t},\n\tmethods: {\n\t\tasync onNodeDragStart() {\n\t\t\tthis.draggingChild = true;\n\t\t},\n\t\tasync onNodeDragEnd(event: { oldIndex: number; newIndex: number }) {\n\t\t\tthis.draggingChild = false;\n\t\t\ttry {\n\t\t\t\tawait onChangeNodePosition(\n\t\t\t\t\tthis.courseId,\n\t\t\t\t\tthis.children,\n\t\t\t\t\tevent.oldIndex,\n\t\t\t\t\tevent.newIndex,\n\t\t\t\t);\n\t\t\t} catch (e) {\n\t\t\t\tsetErrorNotification(e);\n\t\t\t}\n\t\t},\n\t\tasync onLoadMore({ loaded, noMore, error }: LoadAction) {\n\t\t\tconsole.log(\"loading children\");\n\t\t\ttry {\n\t\t\t\tconst moreResults: boolean = await new Promise((resolve, reject) =>\n\t\t\t\t\t// pass resolve/reject to parent and wait for resolution\n\t\t\t\t\tthis.$emit(\"loadChildren\", {\n\t\t\t\t\t\tnode: this.node,\n\t\t\t\t\t\tfromFirstPage: false,\n\t\t\t\t\t\tresolveFn: resolve,\n\t\t\t\t\t\trejectFn: reject,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t\tif (!moreResults) {\n\t\t\t\t\tnoMore();\n\t\t\t\t} else {\n\t\t\t\t\tloaded();\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tsetErrorNotification(e);\n\t\t\t\terror();\n\t\t\t}\n\t\t},\n\t},\n\tcomputed: {\n\t\t...mapStores(useMainStore),\n\t\tchildren() {\n\t\t\treturn this.mainStore.paginatedChildrenByNodeId[this.node.id]?.data ?? [];\n\t\t},\n\t},\n\tcomponents: { draggable, CourseTreeNode, Btn, VueEternalLoading, Spinner },\n});\n","import { render } from \"./TopicNode.vue?vue&type=template&id=091192fa&ts=true\"\nimport script from \"./TopicNode.vue?vue&type=script&lang=ts\"\nexport * from \"./TopicNode.vue?vue&type=script&lang=ts\"\n\nimport exportComponent from \"/tmp/build/node_modules/vue-loader-v16/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__"],"sourceRoot":""}