@vc-shell/framework 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/apl-B2DGVGxc.js +76 -0
  3. package/dist/asciiarmor-2LVJmxlE.js +34 -0
  4. package/dist/asn1-jKiBa2Ya.js +95 -0
  5. package/dist/asterisk-DS281yxp.js +271 -0
  6. package/dist/brainfuck-C_p9pTT8.js +34 -0
  7. package/dist/clike-BUuHEmgZ.js +620 -0
  8. package/dist/clojure-CCKyeQKf.js +800 -0
  9. package/dist/cmake-CuaCgAKt.js +28 -0
  10. package/dist/cobol-BlTKFDRj.js +72 -0
  11. package/dist/coffeescript-BVCvwO8I.js +179 -0
  12. package/dist/commonlisp-D_kxz07b.js +75 -0
  13. package/dist/crystal-D309uH6_.js +217 -0
  14. package/dist/css-bIlmDBTK.js +1560 -0
  15. package/dist/cypher-BMq4Fwjl.js +68 -0
  16. package/dist/d-BZcgY6La.js +127 -0
  17. package/dist/diff-Cg9d_RX2.js +18 -0
  18. package/dist/{assets/dockerfile-D0MivFIF.js → dockerfile-DIy8NleC.js} +36 -41
  19. package/dist/dtd-CtLokQ-U.js +84 -0
  20. package/dist/dylan-QYeExnWK.js +234 -0
  21. package/dist/ebnf-DUPDuY4r.js +78 -0
  22. package/dist/ecl-CiXN-g_D.js +121 -0
  23. package/dist/eiffel-yQhjl4T1.js +110 -0
  24. package/dist/elm-CNT9vbN0.js +108 -0
  25. package/dist/erlang-CFOYdy9e.js +487 -0
  26. package/dist/factor-DDOC7X6P.js +65 -0
  27. package/dist/fcl-CPC2WYrI.js +103 -0
  28. package/dist/forth-BmxRyE9S.js +60 -0
  29. package/dist/fortran-9bvPyrOW.js +442 -0
  30. package/dist/framework.js +288 -29
  31. package/dist/gas-BdfkXJT_.js +183 -0
  32. package/dist/gherkin-CJuwpceU.js +34 -0
  33. package/dist/groovy-DZeT_VM-.js +146 -0
  34. package/dist/haskell-Bvt3Qq1t.js +375 -0
  35. package/dist/haxe-70NVW1pR.js +359 -0
  36. package/dist/http-D9LttvKF.js +44 -0
  37. package/dist/idl-B6TRFYjl.js +947 -0
  38. package/dist/{assets/index-BKF-A58l.js → index-BBYKbiRX.js} +79 -92
  39. package/dist/index-BDm0tcWn.js +145680 -0
  40. package/dist/{assets/index-CeeaNa4F.js → index-BDqUaIyQ.js} +136 -167
  41. package/dist/index-BdflTsg6.js +308 -0
  42. package/dist/{assets/index-CtmpJVwa.js → index-BpBTtmQ6.js} +270 -312
  43. package/dist/index-Br0y2YMn.js +58 -0
  44. package/dist/index-CIcET-ZI.js +71 -0
  45. package/dist/index-CYAMpxnu.js +341 -0
  46. package/dist/index-Cf2H7YZ1.js +98 -0
  47. package/dist/{assets/index-Bv_z_qRq.js → index-Ck055pN8.js} +121 -124
  48. package/dist/index-D-fPN3yf.js +75 -0
  49. package/dist/{assets/index-BT8o9-M5.js → index-DJOis7Nc.js} +267 -386
  50. package/dist/index-DKtQMsy4.js +538 -0
  51. package/dist/{assets/index-DMTL7O1s.js → index-DWTsz5bC.js} +570 -586
  52. package/dist/{assets/index-C7zlEJy8.js → index-DuY7BIGm.js} +229 -302
  53. package/dist/{assets/index-B1srGfDb.js → index-o6aSdNED.js} +119 -165
  54. package/dist/index-wfv8ehcx.js +249 -0
  55. package/dist/index.css +9 -18
  56. package/dist/javascript-WMWNx-Vj.js +690 -0
  57. package/dist/jinja2-DnB6dQmV.js +154 -0
  58. package/dist/julia-DpvXAuO6.js +241 -0
  59. package/dist/livescript-CanGTf8u.js +272 -0
  60. package/dist/lua-XplVlWi_.js +217 -0
  61. package/dist/mathematica-jaRHnSxC.js +35 -0
  62. package/dist/mbox-BctzC1hL.js +76 -0
  63. package/dist/mirc-CFBPAOaF.js +72 -0
  64. package/dist/mllike-BSnXJBGA.js +272 -0
  65. package/dist/modelica-vUgVs--1.js +93 -0
  66. package/dist/mscgen-Cpl0NYLN.js +104 -0
  67. package/dist/mumps-CQoS1kWX.js +25 -0
  68. package/dist/nginx-zDPm3Z74.js +89 -0
  69. package/dist/nsis-fePjrhq7.js +62 -0
  70. package/dist/ntriples-CsNjv2QF.js +79 -0
  71. package/dist/octave-C8PmmSRH.js +143 -0
  72. package/dist/oz-Ce8aN8oE.js +151 -0
  73. package/dist/pascal-De0D6mP7.js +77 -0
  74. package/dist/perl-B4bSCe1C.js +915 -0
  75. package/dist/pig-D24Z8EXi.js +54 -0
  76. package/dist/powershell-DkYVfTzP.js +249 -0
  77. package/dist/properties-Dn9wna3M.js +26 -0
  78. package/dist/protobuf-BPIjwpzm.js +49 -0
  79. package/dist/pug-BqUR2bBq.js +248 -0
  80. package/dist/puppet-nyd4dhjf.js +45 -0
  81. package/dist/python-B5QdSKoL.js +313 -0
  82. package/dist/q-DXjKs-tC.js +83 -0
  83. package/dist/r-LKEuhEGI.js +104 -0
  84. package/dist/rpm-IznJm2Xc.js +57 -0
  85. package/dist/ruby-CcYfvIk6.js +228 -0
  86. package/dist/sas-7E8yHoCW.js +105 -0
  87. package/dist/scheme-DjibxsNh.js +124 -0
  88. package/dist/shell-C0C2sNA_.js +182 -0
  89. package/dist/sieve-Bwz7vjP5.js +72 -0
  90. package/dist/simple-mode-B0dvCdAA.js +89 -0
  91. package/dist/smalltalk-Bhddl2pB.js +48 -0
  92. package/dist/solr-BNlsLglM.js +41 -0
  93. package/dist/sparql-FarWu_Gb.js +197 -0
  94. package/dist/spreadsheet-C-cy4P5N.js +49 -0
  95. package/dist/sql-mMre1Bo3.js +282 -0
  96. package/dist/stex-92raWT1r.js +129 -0
  97. package/dist/stylus-CAdqWld3.js +250 -0
  98. package/dist/swift-DSxqR9R6.js +230 -0
  99. package/dist/tcl-xfoLljhY.js +81 -0
  100. package/dist/textile-D1AWE-pc.js +295 -0
  101. package/dist/tiddlywiki-5wqsXtSk.js +155 -0
  102. package/dist/tiki-__Kn3CeS.js +181 -0
  103. package/dist/toml-BHiuTcfn.js +49 -0
  104. package/dist/troff-D2UO-fKf.js +35 -0
  105. package/dist/tsconfig.tsbuildinfo +1 -1
  106. package/dist/ttcn-Bsa4sfRm.js +123 -0
  107. package/dist/ttcn-cfg-Bac_acMi.js +88 -0
  108. package/dist/turtle-xwJUxoPV.js +80 -0
  109. package/dist/ui/components/atoms/vc-widget/vc-widget.vue.d.ts.map +1 -1
  110. package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts.map +1 -1
  111. package/dist/vb-c2kQGd6-.js +74 -0
  112. package/dist/vbscript-Dz1TtKsy.js +324 -0
  113. package/dist/velocity-DJd0pTTC.js +96 -0
  114. package/dist/verilog-C4VGD9n1.js +263 -0
  115. package/dist/vhdl-T9HkrbI2.js +106 -0
  116. package/dist/webidl-CjfDENEo.js +155 -0
  117. package/dist/xquery-BUQdORAS.js +422 -0
  118. package/dist/yacas-C0absKBh.js +73 -0
  119. package/dist/z80-C8rPtw-0.js +61 -0
  120. package/package.json +4 -4
  121. package/ui/components/atoms/vc-widget/vc-widget.vue +2 -0
  122. package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +65 -32
  123. package/dist/assets/apl-NdZ6-T1z.js +0 -142
  124. package/dist/assets/asciiarmor-CmJEbAuq.js +0 -56
  125. package/dist/assets/asn1-Ctc8K72v.js +0 -192
  126. package/dist/assets/asterisk-D6r__RMF.js +0 -187
  127. package/dist/assets/brainfuck-COwWCBpq.js +0 -70
  128. package/dist/assets/clike-C-PtfL50.js +0 -1019
  129. package/dist/assets/clojure-C2XPrGCa.js +0 -274
  130. package/dist/assets/cmake-BGrEgXCL.js +0 -81
  131. package/dist/assets/cobol-DShPmpZe.js +0 -234
  132. package/dist/assets/coffeescript-BG8vTfSz.js +0 -329
  133. package/dist/assets/commonlisp-8oE2EpEe.js +0 -108
  134. package/dist/assets/core-api-BMLS9FrT.js +0 -8288
  135. package/dist/assets/core-composables-DYxpIWyY.js +0 -1799
  136. package/dist/assets/core-constants-DiKDBbnD.js +0 -83
  137. package/dist/assets/core-directives-QhJx9kWh.js +0 -41
  138. package/dist/assets/core-interceptors-CSjUvxQ0.js +0 -78
  139. package/dist/assets/core-plugins-wv2bDZ0l.js +0 -4919
  140. package/dist/assets/core-services-CAfJRsjs.js +0 -4
  141. package/dist/assets/core-utilities-BTktq_a-.js +0 -33
  142. package/dist/assets/crystal--rIRMl16.js +0 -419
  143. package/dist/assets/css/core-directives-FL4vIIkN.css +0 -73
  144. package/dist/assets/css/fonts-M1mtyV8L.css +0 -305
  145. package/dist/assets/css/icons-css-DbCVsovz.css +0 -41
  146. package/dist/assets/css/shared-components-bnLHdCtf.css +0 -429
  147. package/dist/assets/css/shared-modules-CNOICmYQ.css +0 -45
  148. package/dist/assets/css/styles-C62nDZwV.css +0 -4096
  149. package/dist/assets/css/ui-app-Bh9hmlIB.css +0 -1287
  150. package/dist/assets/css/ui-content-B29jsmK7.css +0 -1187
  151. package/dist/assets/css/ui-controls-CRtfFczw.css +0 -387
  152. package/dist/assets/css/ui-data-CYLxfdUa.css +0 -1555
  153. package/dist/assets/css/ui-form-C3WrWfVl.css +0 -71
  154. package/dist/assets/css/ui-form-fields-DOtHhDeM.css +0 -1360
  155. package/dist/assets/css/ui-helpers-bOoNv5dS.css +0 -37
  156. package/dist/assets/css/ui-indicators-CybQnCoU.css +0 -628
  157. package/dist/assets/css/ui-layout-DyGKgizy.css +0 -251
  158. package/dist/assets/css/ui-media-TWYep8js.css +0 -298
  159. package/dist/assets/css/ui-media-advanced-BGxy3VSB.css +0 -183
  160. package/dist/assets/css/ui-navigation-DcPRn8SB.css +0 -1693
  161. package/dist/assets/css-C_ZeEwz2.js +0 -847
  162. package/dist/assets/cypher-Bayei42D.js +0 -122
  163. package/dist/assets/d-B0hhz6be.js +0 -205
  164. package/dist/assets/diff-DQutOIXs.js +0 -30
  165. package/dist/assets/dtd-C1CeYVnM.js +0 -121
  166. package/dist/assets/dylan-Dm9-uD-A.js +0 -337
  167. package/dist/assets/ebnf-jWG_1Yly.js +0 -151
  168. package/dist/assets/ecl-CgJPA6z9.js +0 -190
  169. package/dist/assets/eiffel-lj7uLahq.js +0 -146
  170. package/dist/assets/elm-Cz7o1ijk.js +0 -230
  171. package/dist/assets/erlang-CyL5QOyR.js +0 -581
  172. package/dist/assets/factor-BVWHwYpu.js +0 -65
  173. package/dist/assets/fcl-DiozYjc8.js +0 -154
  174. package/dist/assets/forth-B7vn5ze0.js +0 -164
  175. package/dist/assets/fortran-D2XNEnBT.js +0 -172
  176. package/dist/assets/gas-B_Tj57Ve.js +0 -343
  177. package/dist/assets/gherkin-CJ6Qk4EZ.js +0 -147
  178. package/dist/assets/groovy-ioGz2WSV.js +0 -228
  179. package/dist/assets/haskell-BHnm1B83.js +0 -239
  180. package/dist/assets/haxe-Bn6Yo6N3.js +0 -490
  181. package/dist/assets/http-BOd5SYCT.js +0 -89
  182. package/dist/assets/idl-FSFk8_xX.js +0 -274
  183. package/dist/assets/index--5fKpGeN.js +0 -792
  184. package/dist/assets/index-0lME64YH.js +0 -342
  185. package/dist/assets/index-B6Ip0FgO.js +0 -437
  186. package/dist/assets/index-BmV05E5M.js +0 -479
  187. package/dist/assets/index-C6MavZDA.js +0 -131
  188. package/dist/assets/index-CwKpgcYl.js +0 -85
  189. package/dist/assets/index-DRUmDL0J.js +0 -59
  190. package/dist/assets/index-DgFC-M9G.js +0 -96
  191. package/dist/assets/javascript-DGrAs70C.js +0 -922
  192. package/dist/assets/jinja2-D9k5QrXv.js +0 -171
  193. package/dist/assets/julia-DM42tOPB.js +0 -369
  194. package/dist/assets/livescript-Dci8HnOi.js +0 -259
  195. package/dist/assets/lua-CByQu4v6.js +0 -137
  196. package/dist/assets/lucide-icons-af0BY3bi.js +0 -34555
  197. package/dist/assets/mathematica-Dkv0uCYF.js +0 -153
  198. package/dist/assets/mbox-CYTvs5kC.js +0 -114
  199. package/dist/assets/mirc-DpgP3GCo.js +0 -176
  200. package/dist/assets/mllike-C6tNn2Yt.js +0 -343
  201. package/dist/assets/modelica-CR6hTSce.js +0 -192
  202. package/dist/assets/mscgen-D0GXtzMS.js +0 -149
  203. package/dist/assets/mumps-Bf1EyDa6.js +0 -129
  204. package/dist/assets/nginx-By9Phklj.js +0 -163
  205. package/dist/assets/nsis-B5ggMLQ9.js +0 -80
  206. package/dist/assets/ntriples-C7VJ7pnm.js +0 -141
  207. package/dist/assets/octave-6yR_ix15.js +0 -112
  208. package/dist/assets/oz-CEUnktiQ.js +0 -235
  209. package/dist/assets/pascal-Dksf1EyF.js +0 -124
  210. package/dist/assets/perl-B99DUQQt.js +0 -819
  211. package/dist/assets/pig-DFeDRta6.js +0 -149
  212. package/dist/assets/powershell-DhwsNWMx.js +0 -381
  213. package/dist/assets/properties-o21uErwC.js +0 -62
  214. package/dist/assets/protobuf-YxlANsmD.js +0 -54
  215. package/dist/assets/pug-bUgjeODZ.js +0 -504
  216. package/dist/assets/puppet-B8WICGYE.js +0 -205
  217. package/dist/assets/python-D3FFx1Id.js +0 -389
  218. package/dist/assets/q-D2Hjhl2C.js +0 -123
  219. package/dist/assets/r-D73k5lac.js +0 -174
  220. package/dist/assets/rpm-Duv_WH0z.js +0 -89
  221. package/dist/assets/ruby-DGCVqZDt.js +0 -287
  222. package/dist/assets/sas-XjPv1Vy5.js +0 -268
  223. package/dist/assets/scheme-DeaA28vt.js +0 -263
  224. package/dist/assets/shared-components-CfAt2hC6.js +0 -1501
  225. package/dist/assets/shared-composables-v9NkNuAe.js +0 -35
  226. package/dist/assets/shared-modules-CDP-H5ZB.js +0 -3588
  227. package/dist/assets/shared-pages-BGRRA5WB.js +0 -20
  228. package/dist/assets/shell-Bx6QZTgx.js +0 -145
  229. package/dist/assets/sieve-CWCD62sW.js +0 -178
  230. package/dist/assets/simple-mode-BAO9cD7H.js +0 -136
  231. package/dist/assets/smalltalk-DSQbF4MF.js +0 -153
  232. package/dist/assets/solr-v_XRf31C.js +0 -80
  233. package/dist/assets/sparql-BrfDqf0-.js +0 -170
  234. package/dist/assets/spreadsheet-Csn84Pef.js +0 -98
  235. package/dist/assets/sql-D4utlq1l.js +0 -480
  236. package/dist/assets/stex-DBkktma-.js +0 -246
  237. package/dist/assets/stylus-ByG-Fd6f.js +0 -750
  238. package/dist/assets/swift-CHbTprt3.js +0 -202
  239. package/dist/assets/tcl-BRlMUELr.js +0 -125
  240. package/dist/assets/textile-CqfTUjd4.js +0 -441
  241. package/dist/assets/tiddlywiki-BrsoM8KB.js +0 -278
  242. package/dist/assets/tiki-D-ivWPkc.js +0 -289
  243. package/dist/assets/toml-t_IhJu83.js +0 -75
  244. package/dist/assets/troff-DckGF2AE.js +0 -64
  245. package/dist/assets/ttcn-B8TAFbRR.js +0 -253
  246. package/dist/assets/ttcn-cfg-NHh25oCM.js +0 -197
  247. package/dist/assets/turtle-D9Js0BlL.js +0 -141
  248. package/dist/assets/ui-app-D31Pr1WY.js +0 -1993
  249. package/dist/assets/ui-content-B7SxH8y9.js +0 -52887
  250. package/dist/assets/ui-controls-nmDJYLmC.js +0 -348
  251. package/dist/assets/ui-data-Ci3b1ye0.js +0 -22901
  252. package/dist/assets/ui-form-Cs5ooOo7.js +0 -159
  253. package/dist/assets/ui-form-fields-DFQi31jT.js +0 -40575
  254. package/dist/assets/ui-helpers-CF-EUlOg.js +0 -1736
  255. package/dist/assets/ui-indicators-mIQeEqha.js +0 -199
  256. package/dist/assets/ui-layout-v2XBQky3.js +0 -320
  257. package/dist/assets/ui-media-WWYrwmZw.js +0 -1259
  258. package/dist/assets/ui-media-advanced-T8ibi153.js +0 -492
  259. package/dist/assets/ui-modals-BdZXzI85.js +0 -2
  260. package/dist/assets/ui-navigation-BtHa6ovW.js +0 -24269
  261. package/dist/assets/utils-DZK5fu48.js +0 -17216
  262. package/dist/assets/vb-CbIGLrpY.js +0 -249
  263. package/dist/assets/vbscript-8ANWle9n.js +0 -320
  264. package/dist/assets/velocity-D6hz3Hzw.js +0 -186
  265. package/dist/assets/verilog-DIV442at.js +0 -565
  266. package/dist/assets/vhdl-BlTiZo_v.js +0 -174
  267. package/dist/assets/vueuse-CTQm4Zh0.js +0 -9308
  268. package/dist/assets/webidl-Cp3tcqdk.js +0 -179
  269. package/dist/assets/xquery-Dd4TBzXv.js +0 -411
  270. package/dist/assets/yacas-DQ1WucF0.js +0 -182
  271. package/dist/assets/z80-P1j44jDI.js +0 -102
@@ -1,1501 +0,0 @@
1
- import { defineComponent, computed, createElementBlock, openBlock, createBlock, createVNode, normalizeStyle, unref, Transition, withCtx, withDirectives, createElementVNode, toDisplayString, vShow, Fragment, renderList, resolveDynamicComponent, mergeProps, createCommentVNode, withModifiers, ref, normalizeClass, renderSlot, resolveComponent, normalizeProps, createTextVNode, inject, onMounted, onUnmounted, watch, resolveDirective } from 'vue';
2
- import { l as useSettingsMenu, b as _sfc_main$b, j as useDashboard } from './ui-app-D31Pr1WY.js';
3
- import { e as useUser } from './ui-navigation-BtHa6ovW.js';
4
- import { u as useNotifications } from './core-composables-DYxpIWyY.js';
5
- import 'vee-validate';
6
- import './ui-indicators-mIQeEqha.js';
7
- import { _ as _sfc_main$a } from './ui-media-WWYrwmZw.js';
8
- import './ui-controls-nmDJYLmC.js';
9
- import { d as _sfc_main$d } from './ui-layout-v2XBQky3.js';
10
- import './ui-helpers-CF-EUlOg.js';
11
- import { i as _sfc_main$c } from './ui-content-B7SxH8y9.js';
12
- import './ui-form-Cs5ooOo7.js';
13
- import { u as useI18n, m as hooks } from './ui-form-fields-DFQi31jT.js';
14
- import { u as useMenuExpanded } from './shared-composables-v9NkNuAe.js';
15
- import './core-plugins-wv2bDZ0l.js';
16
- import 'vue-router';
17
- import './shared-modules-CDP-H5ZB.js';
18
- import { N as NotificationTemplatesSymbol } from './ui-data-Ci3b1ye0.js';
19
- import './ui-media-advanced-T8ibi153.js';
20
- import { m as useLocalStorage } from './vueuse-CTQm4Zh0.js';
21
-
22
- const _hoisted_1$4 = { class: "vc-user-info" };
23
- const _hoisted_2$2 = { class: "vc-user-info__info" };
24
- const _hoisted_3$2 = { class: "vc-user-info__name" };
25
- const _hoisted_4$2 = { class: "vc-user-info__role" };
26
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
27
- __name: "user-info",
28
- props: {
29
- avatarUrl: {},
30
- name: {},
31
- role: {},
32
- isExpanded: { type: Boolean }
33
- },
34
- setup(__props) {
35
- const props = __props;
36
- const { user } = useUser();
37
- const imageHandler = computed(() => {
38
- if (props.avatarUrl) {
39
- return `background-image: url(${CSS.escape(props.avatarUrl)})`;
40
- }
41
- return void 0;
42
- });
43
- return (_ctx, _cache) => {
44
- return openBlock(), createElementBlock("div", _hoisted_1$4, [
45
- _ctx.avatarUrl ? (openBlock(), createElementBlock("div", {
46
- key: 0,
47
- class: "vc-user-info__avatar",
48
- style: normalizeStyle(imageHandler.value)
49
- }, null, 4)) : (openBlock(), createBlock(unref(_sfc_main$a), {
50
- key: 1,
51
- icon: "material-account_circle",
52
- class: "vc-user-info__icon"
53
- })),
54
- createVNode(Transition, { name: "opacity" }, {
55
- default: withCtx(() => [
56
- withDirectives(createElementVNode("div", _hoisted_2$2, [
57
- createElementVNode("div", _hoisted_3$2, toDisplayString(_ctx.name || unref(user) && "fullName" in unref(user) && unref(user).fullName || unref(user)?.userName), 1),
58
- createElementVNode("div", _hoisted_4$2, toDisplayString(_ctx.role && _ctx.$t(`SHELL.USER.ROLE.${_ctx.role}`) || (unref(user)?.isAdministrator ? _ctx.$t("SHELL.USER.ROLE.ADMINISTRATOR") : "")), 1)
59
- ], 512), [
60
- [vShow, _ctx.isExpanded || _ctx.$isMobile.value]
61
- ])
62
- ]),
63
- _: 1
64
- })
65
- ]);
66
- };
67
- }
68
- });
69
-
70
- const _hoisted_1$3 = { class: "vc-settings-menu" };
71
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
72
- __name: "settings-menu",
73
- setup(__props) {
74
- const settingsMenu = useSettingsMenu();
75
- const { items } = settingsMenu;
76
- return (_ctx, _cache) => {
77
- return openBlock(), createElementBlock("div", _hoisted_1$3, [
78
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item) => {
79
- return openBlock(), createBlock(resolveDynamicComponent(item.component), mergeProps({
80
- key: item.id,
81
- ref_for: true
82
- }, item.props || {}), null, 16);
83
- }), 128))
84
- ]);
85
- };
86
- }
87
- });
88
-
89
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
90
- __name: "user-sidebar",
91
- props: {
92
- isOpened: { type: Boolean }
93
- },
94
- emits: ["update:isOpened", "item:click"],
95
- setup(__props) {
96
- return (_ctx, _cache) => {
97
- return openBlock(), createBlock(unref(_sfc_main$b), {
98
- "is-expanded": _ctx.isOpened,
99
- position: "left",
100
- render: "always",
101
- title: _ctx.$t("SHELL.ACCOUNT.SETTINGS"),
102
- onClose: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("update:isOpened", false))
103
- }, {
104
- content: withCtx(() => [
105
- _ctx.isOpened ? (openBlock(), createElementBlock("div", {
106
- key: 0,
107
- class: "vc-user-sidebar__menu",
108
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => _ctx.$emit("update:isOpened", false), ["stop"]))
109
- }, [
110
- createVNode(unref(_sfc_main$8))
111
- ])) : createCommentVNode("", true)
112
- ]),
113
- _: 1
114
- }, 8, ["is-expanded", "title"]);
115
- };
116
- }
117
- });
118
-
119
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
120
- __name: "user-dropdown-button",
121
- props: {
122
- avatarUrl: {},
123
- name: {},
124
- role: {},
125
- disabled: { type: Boolean }
126
- },
127
- setup(__props) {
128
- const { t } = useI18n({ useScope: "global" });
129
- const isSidebarOpened = ref(false);
130
- const { isExpanded, isHoverExpanded } = useMenuExpanded();
131
- function handleMenuItemClick(item) {
132
- item.clickHandler?.();
133
- }
134
- function handleClick() {
135
- isSidebarOpened.value = !isSidebarOpened.value;
136
- }
137
- return (_ctx, _cache) => {
138
- return openBlock(), createElementBlock("div", null, [
139
- createElementVNode("button", {
140
- type: "button",
141
- class: normalizeClass(["vc-user-dropdown-button", {
142
- "vc-user-dropdown-button--active": false,
143
- "vc-user-dropdown-button--auto-width": _ctx.disabled,
144
- "vc-user-dropdown-button--mobile": _ctx.$isMobile.value,
145
- "vc-user-dropdown-button--collapsed": !unref(isExpanded) && _ctx.$isDesktop.value
146
- }]),
147
- onClick: handleClick
148
- }, [
149
- createElementVNode("div", {
150
- class: normalizeClass(["vc-user-dropdown-button__wrap", {
151
- "vc-user-dropdown-button__wrap--active": false
152
- }])
153
- }, [
154
- createVNode(_sfc_main$9, {
155
- "avatar-url": _ctx.avatarUrl,
156
- name: _ctx.name,
157
- role: _ctx.role,
158
- "is-expanded": unref(isExpanded) || unref(isHoverExpanded)
159
- }, null, 8, ["avatar-url", "name", "role", "is-expanded"]),
160
- _cache[1] || (_cache[1] = createElementVNode("div", { class: "vc-user-dropdown-button__actions" }, [
161
- createElementVNode("div", { class: "vc-user-dropdown-button__trigger" })
162
- ], -1))
163
- ])
164
- ], 2),
165
- createVNode(_sfc_main$7, {
166
- "is-opened": isSidebarOpened.value,
167
- "onUpdate:isOpened": _cache[0] || (_cache[0] = ($event) => isSidebarOpened.value = $event),
168
- "onItem:click": handleMenuItemClick
169
- }, null, 8, ["is-opened"])
170
- ]);
171
- };
172
- }
173
- });
174
-
175
- const UserDropdownButton = _sfc_main$6;
176
-
177
- const _hoisted_1$2 = { class: "vc-notification-template" };
178
- const _hoisted_2$1 = { class: "vc-notification-template__content" };
179
- const _hoisted_3$1 = { class: "vc-notification-template__time" };
180
- const _hoisted_4$1 = {
181
- key: 0,
182
- class: "vc-notification-template__content-body"
183
- };
184
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
185
- __name: "notification-template",
186
- props: {
187
- color: {},
188
- icon: {},
189
- title: {},
190
- notification: {}
191
- },
192
- setup(__props) {
193
- const props = __props;
194
- const locale = window.navigator.language;
195
- const pushTime = computed(() => {
196
- return hooks(props.notification.created).locale(locale).format("L LT");
197
- });
198
- return (_ctx, _cache) => {
199
- return openBlock(), createElementBlock("div", _hoisted_1$2, [
200
- createElementVNode("div", {
201
- class: normalizeClass(["vc-notification-template__container", {
202
- "vc-notification-template__container--mobile": _ctx.$isMobile.value
203
- }])
204
- }, [
205
- createElementVNode("div", _hoisted_2$1, [
206
- createElementVNode("p", {
207
- class: normalizeClass(["vc-notification-template__title", { "vc-notification-template__title--desktop": _ctx.$isDesktop.value }])
208
- }, toDisplayString(_ctx.title), 3),
209
- createElementVNode("p", _hoisted_3$1, toDisplayString(pushTime.value), 1),
210
- _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
211
- renderSlot(_ctx.$slots, "default")
212
- ])) : createCommentVNode("", true)
213
- ])
214
- ], 2)
215
- ]);
216
- };
217
- }
218
- });
219
-
220
- const NotificationTemplate = _sfc_main$5;
221
-
222
- const _hoisted_1$1 = { class: "tw-flex tw-p-3 tw-w-full" };
223
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
224
- __name: "notification",
225
- props: {
226
- notification: {},
227
- templates: {}
228
- },
229
- emits: ["onClick"],
230
- setup(__props, { emit: __emit }) {
231
- const props = __props;
232
- const emit = __emit;
233
- const currentTemplate = computed(() => props.templates?.find((x) => x?.notifyType === props.notification.notifyType));
234
- const templateProps = computed(() => ({
235
- notification: props.notification
236
- }));
237
- const handleClick = () => {
238
- emit("onClick", props.notification);
239
- };
240
- const notificationStyle = computed(() => ({
241
- color: "var(--notification-icon-color)",
242
- icon: "material-exclamation"
243
- }));
244
- return (_ctx, _cache) => {
245
- const _component_VcHint = resolveComponent("VcHint");
246
- const _component_VcRow = resolveComponent("VcRow");
247
- return openBlock(), createElementBlock("div", _hoisted_1$1, [
248
- createVNode(_component_VcRow, { class: "tw-justify-between tw-grow tw-basis-0 !tw-flex" }, {
249
- default: withCtx(() => [
250
- createElementVNode("div", { onClick: handleClick }, [
251
- currentTemplate.value ? (openBlock(), createBlock(resolveDynamicComponent(currentTemplate.value), normalizeProps(mergeProps({ key: 0 }, templateProps.value)), null, 16)) : (openBlock(), createBlock(unref(NotificationTemplate), {
252
- key: 1,
253
- color: notificationStyle.value.color,
254
- title: _ctx.notification.title ?? "",
255
- icon: notificationStyle.value.icon,
256
- notification: _ctx.notification
257
- }, {
258
- default: withCtx(() => [
259
- _ctx.notification.description ? (openBlock(), createBlock(_component_VcHint, {
260
- key: 0,
261
- class: "tw-mb-1"
262
- }, {
263
- default: withCtx(() => [
264
- createTextVNode(toDisplayString(_ctx.notification.description), 1)
265
- ]),
266
- _: 1
267
- })) : createCommentVNode("", true)
268
- ]),
269
- _: 1
270
- }, 8, ["color", "title", "icon", "notification"]))
271
- ])
272
- ]),
273
- _: 1
274
- })
275
- ]);
276
- };
277
- }
278
- });
279
-
280
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
281
- __name: "notification-dropdown",
282
- setup(__props) {
283
- const notificationTemplates = inject(NotificationTemplatesSymbol);
284
- const { t } = useI18n({ useScope: "global" });
285
- const { notifications, markAllAsRead } = useNotifications();
286
- const hasUnreadNotifications = computed(() => {
287
- return notifications.value.some((item) => item.isNew);
288
- });
289
- function onOpen(state) {
290
- if (state && notifications.value.some((x) => x.isNew)) {
291
- markAllAsRead();
292
- }
293
- }
294
- onMounted(() => {
295
- onOpen(hasUnreadNotifications.value);
296
- });
297
- return (_ctx, _cache) => {
298
- return openBlock(), createBlock(unref(_sfc_main$c), {
299
- items: unref(notifications),
300
- "empty-text": unref(t)("COMPONENTS.NOTIFICATION_DROPDOWN.EMPTY")
301
- }, {
302
- item: withCtx(({ item }) => [
303
- createVNode(_sfc_main$4, {
304
- notification: item,
305
- templates: unref(notificationTemplates) || []
306
- }, null, 8, ["notification", "templates"])
307
- ]),
308
- _: 1
309
- }, 8, ["items", "empty-text"]);
310
- };
311
- }
312
- });
313
-
314
- const NotificationDropdown = _sfc_main$3;
315
-
316
- function useLayoutPersistence(storageKey, updateCallback) {
317
- const savedLayout = useLocalStorage(storageKey, {});
318
- const saveLayout = (layout) => {
319
- try {
320
- const layoutData = {};
321
- layout.forEach((position, widgetId) => {
322
- layoutData[widgetId] = position;
323
- });
324
- savedLayout.value = layoutData;
325
- } catch (error) {
326
- console.error("Failed to save dashboard layout to localStorage:", error);
327
- }
328
- };
329
- const loadLayout = (widgets) => {
330
- try {
331
- if (!savedLayout.value || Object.keys(savedLayout.value).length === 0) {
332
- return false;
333
- }
334
- Object.entries(savedLayout.value).forEach(([widgetId, position]) => {
335
- const widget = widgets.find((w) => w.id === widgetId);
336
- if (widget) {
337
- updateCallback(widgetId, position);
338
- }
339
- });
340
- return true;
341
- } catch (error) {
342
- console.error("Failed to load dashboard layout from localStorage:", error);
343
- return false;
344
- }
345
- };
346
- const clearSavedLayout = () => {
347
- savedLayout.value = {};
348
- };
349
- const hasSavedLayout = () => {
350
- return Object.keys(savedLayout.value).length > 0;
351
- };
352
- return {
353
- saveLayout,
354
- loadLayout,
355
- clearSavedLayout,
356
- hasSavedLayout
357
- };
358
- }
359
-
360
- const GRID_COLUMNS = 12;
361
- const MIN_GRID_ROWS = 12;
362
- const ROWS_BUFFER = 10;
363
- function useGridSystem() {
364
- const dynamicRows = ref(MIN_GRID_ROWS);
365
- const updateGridRows = (widgets, layout) => {
366
- if (widgets.length === 0) {
367
- dynamicRows.value = MIN_GRID_ROWS;
368
- return dynamicRows.value;
369
- }
370
- const maxY = Math.max(
371
- ...Array.from(layout.values()).map((pos, index) => {
372
- const widget = widgets.find((w) => w.id === Array.from(layout.keys())[index]);
373
- return widget ? pos.y + widget.size.height : pos.y + 1;
374
- }),
375
- 0
376
- );
377
- dynamicRows.value = Math.max(maxY + ROWS_BUFFER, MIN_GRID_ROWS);
378
- return dynamicRows.value;
379
- };
380
- const hasCollision = (widget, position, widgets, layout, excludeWidgetId) => {
381
- if (position.x < 0 || position.x + widget.size.width > GRID_COLUMNS || position.y < 0) {
382
- return true;
383
- }
384
- const occupiedCells = /* @__PURE__ */ new Set();
385
- widgets.forEach((other) => {
386
- if (other.id === widget.id || excludeWidgetId && other.id === excludeWidgetId) {
387
- return;
388
- }
389
- const otherPos = layout.get(other.id);
390
- if (!otherPos) return;
391
- for (let x = otherPos.x; x < otherPos.x + other.size.width; x++) {
392
- for (let y = otherPos.y; y < otherPos.y + other.size.height; y++) {
393
- occupiedCells.add(`${x},${y}`);
394
- }
395
- }
396
- });
397
- for (let x = position.x; x < position.x + widget.size.width; x++) {
398
- for (let y = position.y; y < position.y + widget.size.height; y++) {
399
- if (occupiedCells.has(`${x},${y}`)) {
400
- return true;
401
- }
402
- }
403
- }
404
- return false;
405
- };
406
- const isAreaFree = (x, y, width, height, occupiedCells) => {
407
- if (x < 0 || x + width > GRID_COLUMNS || y < 0) {
408
- return false;
409
- }
410
- for (let ix = x; ix < x + width; ix++) {
411
- for (let iy = y; iy < y + height; iy++) {
412
- if (occupiedCells.has(`${ix},${iy}`)) {
413
- return false;
414
- }
415
- }
416
- }
417
- return true;
418
- };
419
- const createOccupiedCellsMap = (widgets, layout, excludeWidgetId) => {
420
- const occupiedCells = /* @__PURE__ */ new Set();
421
- widgets.forEach((widget) => {
422
- if (excludeWidgetId && widget.id === excludeWidgetId) {
423
- return;
424
- }
425
- const pos = layout.get(widget.id);
426
- if (!pos) return;
427
- for (let x = pos.x; x < pos.x + widget.size.width; x++) {
428
- for (let y = pos.y; y < pos.y + widget.size.height; y++) {
429
- occupiedCells.add(`${x},${y}`);
430
- }
431
- }
432
- });
433
- return occupiedCells;
434
- };
435
- return {
436
- GRID_COLUMNS,
437
- MIN_GRID_ROWS,
438
- ROWS_BUFFER,
439
- dynamicRows,
440
- updateGridRows,
441
- hasCollision,
442
- isAreaFree,
443
- createOccupiedCellsMap
444
- };
445
- }
446
-
447
- const SEARCH_DIRECTIONS = [
448
- { dx: 0, dy: 0 },
449
- // Current position
450
- { dx: 0, dy: 1 },
451
- // Down
452
- { dx: 1, dy: 0 },
453
- // Right
454
- { dx: 0, dy: -1 },
455
- // Up
456
- { dx: -1, dy: 0 },
457
- // Left
458
- { dx: 1, dy: 1 },
459
- // Right-down
460
- { dx: -1, dy: 1 },
461
- // Left-down
462
- { dx: 1, dy: -1 },
463
- // Right-up
464
- { dx: -1, dy: -1 }
465
- // Left-up
466
- ];
467
- function useWidgetLayout(updatePositionCallback) {
468
- const grid = useGridSystem();
469
- const findFreePosition = (widget, widgets, layout) => {
470
- const currentPos = layout.get(widget.id);
471
- if (currentPos && !grid.hasCollision(widget, currentPos, widgets, layout, widget.id)) {
472
- return currentPos;
473
- }
474
- const startX = currentPos?.x || 0;
475
- const startY = currentPos?.y || 0;
476
- let layer = 0;
477
- const maxLayers = Math.max(grid.GRID_COLUMNS, grid.dynamicRows.value);
478
- while (layer < maxLayers) {
479
- for (const { dx, dy } of SEARCH_DIRECTIONS) {
480
- const x = startX + dx * layer;
481
- const y = startY + dy * layer;
482
- const position = { x, y };
483
- if (!grid.hasCollision(widget, position, widgets, layout, widget.id)) {
484
- return position;
485
- }
486
- }
487
- layer++;
488
- }
489
- return {
490
- x: 0,
491
- y: grid.dynamicRows.value
492
- };
493
- };
494
- const findOptimalPosition = (widget, occupiedCells, maxRows) => {
495
- let bestPos = { x: 0, y: 0 };
496
- let minY = Number.MAX_SAFE_INTEGER;
497
- for (let y = 0; y < maxRows; y++) {
498
- for (let x = 0; x <= grid.GRID_COLUMNS - widget.size.width; x++) {
499
- if (grid.isAreaFree(x, y, widget.size.width, widget.size.height, occupiedCells)) {
500
- if (y < minY) {
501
- minY = y;
502
- bestPos = { x, y };
503
- } else if (y === minY && x < bestPos.x) {
504
- bestPos = { x, y };
505
- }
506
- if (y === 0) {
507
- return bestPos;
508
- }
509
- }
510
- }
511
- if (minY !== Number.MAX_SAFE_INTEGER && y > minY) {
512
- break;
513
- }
514
- }
515
- if (minY === Number.MAX_SAFE_INTEGER) {
516
- return { x: 0, y: maxRows };
517
- }
518
- return bestPos;
519
- };
520
- const arrangeWidgetsInRows = (widgetsToArrange, allWidgets, layout) => {
521
- if (widgetsToArrange.length === 0) return;
522
- const sortedWidgets = [...widgetsToArrange].sort((a, b) => {
523
- const aSize = a.size.width * a.size.height;
524
- const bSize = b.size.width * b.size.height;
525
- return bSize - aSize;
526
- });
527
- let currentX = 0;
528
- let currentY = 0;
529
- let rowHeight = 0;
530
- sortedWidgets.forEach((widget) => {
531
- if (currentX + widget.size.width > grid.GRID_COLUMNS) {
532
- currentX = 0;
533
- currentY += rowHeight;
534
- rowHeight = 0;
535
- }
536
- const position = { x: currentX, y: currentY };
537
- updatePositionCallback(widget.id, position);
538
- currentX += widget.size.width;
539
- rowHeight = Math.max(rowHeight, widget.size.height);
540
- });
541
- };
542
- const initializeWithBuiltInPositions = (widgets, layout) => {
543
- if (widgets.length === 0) return false;
544
- const widgetsWithPositions = widgets.filter((widget) => widget.position);
545
- const widgetsWithoutPositions = widgets.filter((widget) => !widget.position);
546
- if (widgetsWithPositions.length === 0) return false;
547
- const sortedWidgets = [...widgetsWithPositions].sort((a, b) => {
548
- if (!a.position || !b.position) return 0;
549
- if (a.position.y !== b.position.y) return a.position.y - b.position.y;
550
- return a.position.x - b.position.x;
551
- });
552
- layout.clear();
553
- sortedWidgets.forEach((widget) => {
554
- if (widget.position) {
555
- updatePositionCallback(widget.id, widget.position);
556
- }
557
- });
558
- let hasCollisions;
559
- do {
560
- hasCollisions = false;
561
- for (const widget of sortedWidgets) {
562
- if (!widget.position) continue;
563
- const position = layout.get(widget.id);
564
- if (position && grid.hasCollision(widget, position, widgets, layout, widget.id)) {
565
- hasCollisions = true;
566
- const freePosition = findFreePosition(widget, widgets, layout);
567
- updatePositionCallback(widget.id, freePosition);
568
- }
569
- }
570
- } while (hasCollisions);
571
- const occupiedCells = grid.createOccupiedCellsMap(widgets, layout);
572
- const sortedRemaining = [...widgetsWithoutPositions].sort((a, b) => {
573
- const aSize = a.size.width * a.size.height;
574
- const bSize = b.size.width * b.size.height;
575
- return bSize - aSize;
576
- });
577
- for (const widget of sortedRemaining) {
578
- const position = findOptimalPosition(widget, occupiedCells, grid.dynamicRows.value + grid.ROWS_BUFFER);
579
- updatePositionCallback(widget.id, position);
580
- for (let x = position.x; x < position.x + widget.size.width; x++) {
581
- for (let y = position.y; y < position.y + widget.size.height; y++) {
582
- occupiedCells.add(`${x},${y}`);
583
- }
584
- }
585
- }
586
- return true;
587
- };
588
- return {
589
- findFreePosition,
590
- findOptimalPosition,
591
- arrangeWidgetsInRows,
592
- initializeWithBuiltInPositions
593
- };
594
- }
595
-
596
- const DASHBOARD_LAYOUT_KEY = "vc-dashboard-layout";
597
- function useDashboardGrid() {
598
- const dashboard = useDashboard();
599
- const widgets = computed(() => dashboard.getWidgets());
600
- const layout = computed(() => dashboard.getLayout());
601
- const grid = useGridSystem();
602
- const widgetLayout = useWidgetLayout(dashboard.updateWidgetPosition);
603
- const persistence = useLayoutPersistence(DASHBOARD_LAYOUT_KEY, dashboard.updateWidgetPosition);
604
- const getGridRows = () => {
605
- return grid.updateGridRows(widgets.value, layout.value);
606
- };
607
- const saveLayoutToLocalStorage = () => {
608
- persistence.saveLayout(layout.value);
609
- };
610
- const loadLayoutFromLocalStorage = () => {
611
- return persistence.loadLayout(widgets.value);
612
- };
613
- const arrangeWidgetsInRows = (widgetsToArrange) => {
614
- widgetLayout.arrangeWidgetsInRows(widgetsToArrange, widgets.value, layout.value);
615
- };
616
- const initializeWithBuiltInPositions = () => {
617
- return widgetLayout.initializeWithBuiltInPositions(widgets.value, layout.value);
618
- };
619
- const initializeLayout = () => {
620
- const layoutLoadedFromStorage = loadLayoutFromLocalStorage();
621
- if (!layoutLoadedFromStorage) {
622
- const usedBuiltInPositions = initializeWithBuiltInPositions();
623
- if (!usedBuiltInPositions) {
624
- arrangeWidgetsInRows(widgets.value);
625
- }
626
- }
627
- };
628
- return {
629
- widgets,
630
- layout,
631
- GRID_COLUMNS: grid.GRID_COLUMNS,
632
- getGridRows,
633
- saveLayoutToLocalStorage,
634
- loadLayoutFromLocalStorage,
635
- arrangeWidgetsInRows,
636
- initializeWithBuiltInPositions,
637
- initializeLayout
638
- };
639
- }
640
-
641
- function useDragClone() {
642
- const dragClone = ref(null);
643
- const createDragClone = (element) => {
644
- const widgetElement = element.closest(".dashboard-widget");
645
- if (!widgetElement) return null;
646
- const clone = widgetElement.cloneNode(true);
647
- const rect = widgetElement.getBoundingClientRect();
648
- const scrollX = window.scrollX || window.pageXOffset;
649
- const scrollY = window.scrollY || window.pageYOffset;
650
- const computedStyle = window.getComputedStyle(widgetElement);
651
- clone.style.position = "fixed";
652
- clone.style.width = `${rect.width}px`;
653
- clone.style.height = `${rect.height}px`;
654
- clone.style.left = `${rect.left + scrollX}px`;
655
- clone.style.top = `${rect.top + scrollY}px`;
656
- clone.style.zIndex = "9999";
657
- clone.style.pointerEvents = "none";
658
- clone.style.opacity = "0.95";
659
- clone.style.transform = "scale(1.02)";
660
- clone.style.transition = "transform 0.1s ease, opacity 0.2s ease";
661
- clone.style.boxShadow = "0 10px 25px rgba(0,0,0,0.15)";
662
- clone.style.willChange = "transform";
663
- clone.style.backgroundColor = computedStyle.backgroundColor;
664
- clone.style.borderRadius = computedStyle.borderRadius;
665
- clone.classList.add("dashboard-widget-clone");
666
- requestAnimationFrame(() => {
667
- clone.style.transform = "scale(1.02)";
668
- clone.style.opacity = "0.92";
669
- });
670
- document.body.appendChild(clone);
671
- dragClone.value = clone;
672
- return clone;
673
- };
674
- const updateDragClonePosition = (deltaX, deltaY) => {
675
- if (!dragClone.value) return;
676
- dragClone.value.style.transform = `translate(${deltaX}px, ${deltaY}px)`;
677
- };
678
- const removeDragClone = () => {
679
- if (!dragClone.value) return;
680
- if (dragClone.value.parentNode) {
681
- document.body.removeChild(dragClone.value);
682
- }
683
- dragClone.value = null;
684
- };
685
- return {
686
- dragClone,
687
- createDragClone,
688
- updateDragClonePosition,
689
- removeDragClone
690
- };
691
- }
692
-
693
- function useEventCoordinates() {
694
- const initialPosition = ref({ clientX: 0, clientY: 0 });
695
- const isTouchDevice = ref(false);
696
- const getEventCoordinates = (event) => {
697
- if ("touches" in event) {
698
- isTouchDevice.value = true;
699
- return {
700
- clientX: event.touches[0].clientX,
701
- clientY: event.touches[0].clientY
702
- };
703
- }
704
- isTouchDevice.value = false;
705
- return {
706
- clientX: event.clientX,
707
- clientY: event.clientY
708
- };
709
- };
710
- const saveInitialPosition = (event) => {
711
- initialPosition.value = getEventCoordinates(event);
712
- };
713
- const calculateDelta = (currentCoordinates) => {
714
- return {
715
- deltaX: currentCoordinates.clientX - initialPosition.value.clientX,
716
- deltaY: currentCoordinates.clientY - initialPosition.value.clientY
717
- };
718
- };
719
- const hasMovedBeyondThreshold = (currentCoordinates, threshold = 3) => {
720
- const { deltaX, deltaY } = calculateDelta(currentCoordinates);
721
- return Math.abs(deltaX) > threshold || Math.abs(deltaY) > threshold;
722
- };
723
- return {
724
- initialPosition,
725
- isTouchDevice,
726
- getEventCoordinates,
727
- saveInitialPosition,
728
- calculateDelta,
729
- hasMovedBeyondThreshold
730
- };
731
- }
732
-
733
- function useCollisionDetection() {
734
- const displacedWidgets = ref(/* @__PURE__ */ new Map());
735
- const intersect = (widgetA, posA, widgetB, posB) => {
736
- const verticalDistance = Math.abs(posA.y - posB.y);
737
- if (verticalDistance > widgetA.size.height + widgetB.size.height) {
738
- return false;
739
- }
740
- const horizontalDistance = Math.abs(posA.x - posB.x);
741
- if (horizontalDistance > widgetA.size.width + widgetB.size.width) {
742
- return false;
743
- }
744
- const aLeft = posA.x;
745
- const aRight = posA.x + widgetA.size.width;
746
- const aTop = posA.y;
747
- const aBottom = posA.y + widgetA.size.height;
748
- const bLeft = posB.x;
749
- const bRight = posB.x + widgetB.size.width;
750
- const bTop = posB.y;
751
- const bBottom = posB.y + widgetB.size.height;
752
- return !(aRight <= bLeft || aLeft >= bRight || aBottom <= bTop || aTop >= bBottom);
753
- };
754
- const updateDisplacedWidgets = (draggedWidget, previewPosition, widgets, layout) => {
755
- if (!draggedWidget || !previewPosition) {
756
- displacedWidgets.value.clear();
757
- return;
758
- }
759
- const newDisplacements = /* @__PURE__ */ new Map();
760
- const processedWidgets = /* @__PURE__ */ new Set();
761
- const directCollisionWidgets = /* @__PURE__ */ new Set();
762
- for (const widget of widgets) {
763
- if (widget.id === draggedWidget.id) continue;
764
- const pos = layout.get(widget.id);
765
- if (!pos) continue;
766
- if (intersect(draggedWidget, previewPosition, widget, pos)) {
767
- directCollisionWidgets.add(widget.id);
768
- }
769
- }
770
- if (directCollisionWidgets.size === 0) {
771
- displacedWidgets.value = newDisplacements;
772
- return;
773
- }
774
- const sortedWidgets = [...widgets].filter((w) => w.id !== draggedWidget.id).sort((a, b) => {
775
- const posA = layout.get(a.id);
776
- const posB = layout.get(b.id);
777
- if (!posA || !posB) return 0;
778
- return posA.y === posB.y ? posA.x - posB.x : posA.y - posB.y;
779
- });
780
- const collisionCache = /* @__PURE__ */ new Map();
781
- const checkCollision = (widget, position) => {
782
- const cacheKey = `${widget.id}_${position.x}_${position.y}`;
783
- if (collisionCache.has(cacheKey)) {
784
- return collisionCache.get(cacheKey);
785
- }
786
- let hasCollision = intersect(draggedWidget, previewPosition, widget, position);
787
- if (!hasCollision) {
788
- for (const [id, pos] of newDisplacements) {
789
- const w = widgets.find((w2) => w2.id === id);
790
- if (w && intersect(widget, position, w, pos)) {
791
- hasCollision = true;
792
- break;
793
- }
794
- }
795
- }
796
- collisionCache.set(cacheKey, hasCollision);
797
- return hasCollision;
798
- };
799
- for (const widget of sortedWidgets) {
800
- if (processedWidgets.has(widget.id)) continue;
801
- const currentPos = layout.get(widget.id);
802
- if (!currentPos) continue;
803
- if (!directCollisionWidgets.has(widget.id) && newDisplacements.size === 0) continue;
804
- const hasCollision = checkCollision(widget, currentPos);
805
- if (hasCollision) {
806
- const newY = Math.max(previewPosition.y + draggedWidget.size.height, currentPos.y + 1);
807
- let finalY = newY;
808
- const maxIterations = 50;
809
- let iterations = 0;
810
- while (checkCollision(widget, { x: currentPos.x, y: finalY }) && iterations < maxIterations) {
811
- finalY++;
812
- iterations++;
813
- }
814
- newDisplacements.set(widget.id, { x: currentPos.x, y: finalY });
815
- processedWidgets.add(widget.id);
816
- for (const w of sortedWidgets) {
817
- if (w.id !== widget.id && !processedWidgets.has(w.id)) {
818
- const pos = layout.get(w.id);
819
- if (pos && intersect(widget, { x: currentPos.x, y: finalY }, w, pos)) {
820
- directCollisionWidgets.add(w.id);
821
- }
822
- }
823
- }
824
- }
825
- }
826
- displacedWidgets.value = newDisplacements;
827
- };
828
- const clearDisplacedWidgets = () => {
829
- displacedWidgets.value.clear();
830
- };
831
- const isWidgetDisplaced = (widgetId) => {
832
- return displacedWidgets.value.has(widgetId);
833
- };
834
- const getDisplacedPosition = (widgetId) => {
835
- return displacedWidgets.value.get(widgetId);
836
- };
837
- return {
838
- displacedWidgets,
839
- intersect,
840
- updateDisplacedWidgets,
841
- clearDisplacedWidgets,
842
- isWidgetDisplaced,
843
- getDisplacedPosition
844
- };
845
- }
846
-
847
- function useGridPosition(gridColumns, getGridRows) {
848
- const previewPosition = ref(null);
849
- const dragOffset = ref({ x: 0, y: 0 });
850
- const calculateDragOffset = (event, element, cellSize) => {
851
- const rect = element.getBoundingClientRect();
852
- let clientX, clientY;
853
- if ("touches" in event) {
854
- clientX = event.touches[0].clientX;
855
- clientY = event.touches[0].clientY;
856
- } else {
857
- clientX = event.clientX;
858
- clientY = event.clientY;
859
- }
860
- dragOffset.value = {
861
- x: (clientX - rect.left) / cellSize.cellWidth,
862
- y: (clientY - rect.top) / cellSize.cellHeight
863
- };
864
- };
865
- const mouseToGridCoordinates = (coords, containerRect, cellSize, scrollOffset) => {
866
- const mouseX = coords.clientX - containerRect.left + scrollOffset.left;
867
- const mouseY = coords.clientY - containerRect.top + scrollOffset.top;
868
- const gridX = Math.round(mouseX / cellSize.cellWidth - dragOffset.value.x);
869
- const gridY = Math.round(mouseY / cellSize.cellHeight - dragOffset.value.y);
870
- return { gridX, gridY };
871
- };
872
- const constrainToGrid = (gridX, gridY, widgetWidth, widgetHeight) => {
873
- gridX = Math.max(0, gridX);
874
- gridY = Math.max(0, gridY);
875
- const gridWidth = gridColumns;
876
- const gridHeight = getGridRows?.() || 100;
877
- gridX = Math.min(gridX, gridWidth - widgetWidth);
878
- gridY = Math.min(gridY, gridHeight - widgetHeight);
879
- return { gridX, gridY };
880
- };
881
- const updatePreviewPosition = (position) => {
882
- previewPosition.value = position;
883
- return position;
884
- };
885
- const resetPosition = () => {
886
- previewPosition.value = null;
887
- dragOffset.value = { x: 0, y: 0 };
888
- };
889
- return {
890
- previewPosition,
891
- dragOffset,
892
- calculateDragOffset,
893
- mouseToGridCoordinates,
894
- constrainToGrid,
895
- updatePreviewPosition,
896
- resetPosition
897
- };
898
- }
899
-
900
- const CELL_HEIGHT$1 = 80;
901
- function useDashboardDragAndDrop(updateWidgetPosition, getGridRows) {
902
- const dashboard = useDashboard();
903
- const widgets = computed(() => dashboard.getWidgets());
904
- const gridContainer = ref(null);
905
- const draggedWidget = ref(null);
906
- const isDragging = ref(false);
907
- const { dragClone, createDragClone, updateDragClonePosition, removeDragClone } = useDragClone();
908
- const { initialPosition, isTouchDevice, getEventCoordinates, saveInitialPosition, hasMovedBeyondThreshold } = useEventCoordinates();
909
- const { displacedWidgets, updateDisplacedWidgets, isWidgetDisplaced, getDisplacedPosition } = useCollisionDetection();
910
- const {
911
- previewPosition,
912
- calculateDragOffset,
913
- mouseToGridCoordinates,
914
- constrainToGrid,
915
- updatePreviewPosition,
916
- resetPosition
917
- } = useGridPosition(GRID_COLUMNS, getGridRows);
918
- const calculateCellSize = () => {
919
- if (!gridContainer.value) return { cellWidth: 0, cellHeight: CELL_HEIGHT$1 };
920
- const rect = gridContainer.value.getBoundingClientRect();
921
- return {
922
- cellWidth: rect.width / GRID_COLUMNS,
923
- cellHeight: CELL_HEIGHT$1
924
- };
925
- };
926
- const updateDragPosition = (event) => {
927
- if (!gridContainer.value || !draggedWidget.value || !dragClone.value) return;
928
- const coords = getEventCoordinates(event);
929
- requestAnimationFrame(() => {
930
- if (!gridContainer.value || !draggedWidget.value || !dragClone.value) return;
931
- const rect = gridContainer.value.getBoundingClientRect();
932
- const cellSize = calculateCellSize();
933
- const { deltaX, deltaY } = {
934
- deltaX: coords.clientX - initialPosition.value.clientX,
935
- deltaY: coords.clientY - initialPosition.value.clientY
936
- };
937
- updateDragClonePosition(deltaX, deltaY);
938
- const scrollOffset = {
939
- left: gridContainer.value.scrollLeft,
940
- top: gridContainer.value.scrollTop
941
- };
942
- const { gridX, gridY } = mouseToGridCoordinates(coords, rect, cellSize, scrollOffset);
943
- const constrainedPosition = constrainToGrid(
944
- gridX,
945
- gridY,
946
- draggedWidget.value.size.width,
947
- draggedWidget.value.size.height
948
- );
949
- if (!previewPosition.value || previewPosition.value.x !== constrainedPosition.gridX || previewPosition.value.y !== constrainedPosition.gridY) {
950
- const newPosition = {
951
- x: constrainedPosition.gridX,
952
- y: constrainedPosition.gridY
953
- };
954
- updatePreviewPosition(newPosition);
955
- updateDisplacedWidgets(draggedWidget.value, newPosition, widgets.value, new Map(dashboard.getLayout()));
956
- }
957
- });
958
- };
959
- const handleMouseMove = (event) => {
960
- if (!isDragging.value || !draggedWidget.value || !gridContainer.value || !dragClone.value) return;
961
- updateDragPosition(event);
962
- };
963
- const handleTouchMove = (event) => {
964
- if (!isDragging.value || !draggedWidget.value || !gridContainer.value || !dragClone.value) return;
965
- event.preventDefault();
966
- updateDragPosition(event);
967
- };
968
- const handleMouseUp = () => {
969
- finishDrag();
970
- };
971
- const handleTouchEnd = () => {
972
- finishDrag();
973
- };
974
- const finishDrag = () => {
975
- if (!isDragging.value || !draggedWidget.value || !previewPosition.value) return;
976
- const draggedWidgetId = draggedWidget.value.id;
977
- const finalPosition = previewPosition.value;
978
- if (dragClone.value) {
979
- const originalWidget = document.querySelector(`.dashboard-widget[data-id="${draggedWidgetId}"]`);
980
- if (originalWidget) {
981
- const cellSize = calculateCellSize();
982
- const widgetGap = 20;
983
- const cloneRect = dragClone.value.getBoundingClientRect();
984
- const scrollX = window.scrollX || window.pageXOffset;
985
- const scrollY = window.scrollY || window.pageYOffset;
986
- const gridRect = gridContainer.value.getBoundingClientRect();
987
- const gridScrollLeft = gridContainer.value.scrollLeft;
988
- const gridScrollTop = gridContainer.value.scrollTop;
989
- const relX = cloneRect.left + scrollX - (gridRect.left + scrollX) + gridScrollLeft;
990
- const relY = cloneRect.top + scrollY - (gridRect.top + scrollY) + gridScrollTop;
991
- const finalX = finalPosition.x * cellSize.cellWidth + widgetGap / 2;
992
- const finalY = finalPosition.y * cellSize.cellHeight + widgetGap / 2;
993
- originalWidget.style.transition = "none";
994
- originalWidget.style.transform = `translate(${relX}px, ${relY}px)`;
995
- originalWidget.style.opacity = "1";
996
- originalWidget.style.zIndex = "1000";
997
- removeDragClone();
998
- originalWidget.offsetHeight;
999
- updateWidgetPosition(draggedWidgetId, finalPosition);
1000
- for (const [widgetId, position] of displacedWidgets.value.entries()) {
1001
- updateWidgetPosition(widgetId, position);
1002
- }
1003
- setTimeout(() => {
1004
- originalWidget.style.transition = `transform var(--dashboard-transition-duration) var(--dashboard-transition-timing)`;
1005
- originalWidget.style.transform = `translate(${finalX}px, ${finalY}px)`;
1006
- }, 20);
1007
- } else {
1008
- removeDragClone();
1009
- updateWidgetPosition(draggedWidgetId, finalPosition);
1010
- for (const [widgetId, position] of displacedWidgets.value.entries()) {
1011
- updateWidgetPosition(widgetId, position);
1012
- }
1013
- }
1014
- } else {
1015
- updateWidgetPosition(draggedWidgetId, finalPosition);
1016
- for (const [widgetId, position] of displacedWidgets.value.entries()) {
1017
- updateWidgetPosition(widgetId, position);
1018
- }
1019
- }
1020
- document.removeEventListener("mousemove", handleMouseMove);
1021
- document.removeEventListener("mouseup", handleMouseUp);
1022
- document.removeEventListener("touchmove", handleTouchMove, { passive: false });
1023
- document.removeEventListener("touchend", handleTouchEnd);
1024
- document.removeEventListener("touchcancel", handleTouchEnd);
1025
- setTimeout(() => {
1026
- isDragging.value = false;
1027
- draggedWidget.value = null;
1028
- resetPosition();
1029
- }, 50);
1030
- };
1031
- const handleMouseDown = (event, widget, element) => {
1032
- if (!gridContainer.value) return;
1033
- if ("touches" in event) {
1034
- isTouchDevice.value = true;
1035
- }
1036
- if (!isTouchDevice.value) {
1037
- event.preventDefault();
1038
- }
1039
- event.stopPropagation();
1040
- saveInitialPosition(event);
1041
- let hasDragStarted = false;
1042
- const widgetElement = element.closest(".dashboard-widget");
1043
- if (!widgetElement) return;
1044
- const cellSize = calculateCellSize();
1045
- const tempMoveHandler = (moveEvent) => {
1046
- if (hasDragStarted) return;
1047
- const currentCoords = getEventCoordinates(moveEvent);
1048
- if (hasMovedBeyondThreshold(currentCoords, 3)) {
1049
- hasDragStarted = true;
1050
- isDragging.value = true;
1051
- draggedWidget.value = widget;
1052
- calculateDragOffset(event, widgetElement, cellSize);
1053
- createDragClone(element);
1054
- document.removeEventListener("mousemove", tempMoveHandler);
1055
- document.removeEventListener("touchmove", tempMoveHandler);
1056
- document.removeEventListener("mouseup", tempUpHandler);
1057
- document.removeEventListener("touchend", tempUpHandler);
1058
- if (isTouchDevice.value) {
1059
- document.addEventListener("touchmove", handleTouchMove, { passive: false });
1060
- document.addEventListener("touchend", handleTouchEnd);
1061
- document.addEventListener("touchcancel", handleTouchEnd);
1062
- } else {
1063
- document.addEventListener("mousemove", handleMouseMove, { passive: true });
1064
- document.addEventListener("mouseup", handleMouseUp);
1065
- }
1066
- }
1067
- };
1068
- const tempUpHandler = () => {
1069
- if (!hasDragStarted) {
1070
- document.removeEventListener("mousemove", tempMoveHandler);
1071
- document.removeEventListener("touchmove", tempMoveHandler);
1072
- document.removeEventListener("mouseup", tempUpHandler);
1073
- document.removeEventListener("touchend", tempUpHandler);
1074
- }
1075
- };
1076
- if (isTouchDevice.value) {
1077
- document.addEventListener("touchmove", tempMoveHandler, { passive: true });
1078
- document.addEventListener("touchend", tempUpHandler);
1079
- } else {
1080
- document.addEventListener("mousemove", tempMoveHandler, { passive: true });
1081
- document.addEventListener("mouseup", tempUpHandler);
1082
- }
1083
- };
1084
- const setGridContainer = (container) => {
1085
- gridContainer.value = container;
1086
- };
1087
- onUnmounted(() => {
1088
- finishDrag();
1089
- });
1090
- return {
1091
- draggedWidget,
1092
- previewPosition,
1093
- displacedWidgets,
1094
- isDragging,
1095
- handleMouseDown,
1096
- // Now handles both mouse and touch events
1097
- setGridContainer,
1098
- isWidgetDisplaced,
1099
- getDisplacedPosition
1100
- };
1101
- }
1102
-
1103
- const CELL_HEIGHT = 80;
1104
- const HORIZONTAL_PADDING = 18;
1105
- function useCellSizeCalculator(gridColumns) {
1106
- const cellSizeCache = ref(null);
1107
- const previousContainerWidth = ref(0);
1108
- const calculateCellSize = (container, useCache = true) => {
1109
- if (useCache && cellSizeCache.value) return cellSizeCache.value;
1110
- if (!container) return { width: 0, height: CELL_HEIGHT };
1111
- const rect = container.getBoundingClientRect();
1112
- const availableWidth = rect.width - 2 * HORIZONTAL_PADDING;
1113
- const cellWidth = availableWidth / gridColumns;
1114
- const size = {
1115
- width: Math.max(cellWidth, 0),
1116
- // Protection against negative values
1117
- height: CELL_HEIGHT
1118
- };
1119
- cellSizeCache.value = size;
1120
- previousContainerWidth.value = rect.width;
1121
- return size;
1122
- };
1123
- const clearCache = () => {
1124
- cellSizeCache.value = null;
1125
- };
1126
- const shouldRecalculate = (newWidth) => {
1127
- if (previousContainerWidth.value === 0) return true;
1128
- const widthChange = Math.abs(newWidth - previousContainerWidth.value);
1129
- const widthChangePercent = widthChange / previousContainerWidth.value * 100;
1130
- return widthChangePercent > 5 || widthChange > 50;
1131
- };
1132
- const handleContainerResize = (container) => {
1133
- if (!container) return;
1134
- const newWidth = container.getBoundingClientRect().width;
1135
- clearCache();
1136
- if (shouldRecalculate(newWidth)) {
1137
- calculateCellSize(container, false);
1138
- }
1139
- previousContainerWidth.value = newWidth;
1140
- };
1141
- return {
1142
- calculateCellSize,
1143
- clearCache,
1144
- shouldRecalculate,
1145
- handleContainerResize,
1146
- previousContainerWidth
1147
- };
1148
- }
1149
-
1150
- const WIDGET_GAP = 20;
1151
- function useWidgetStyles(getCellSize) {
1152
- const getPreviewStyles = (widget, position) => {
1153
- const cellSize = getCellSize();
1154
- if (!position || !widget?.size) return {};
1155
- const widgetWidth = widget.size.width * cellSize.width - WIDGET_GAP;
1156
- const widgetHeight = widget.size.height * cellSize.height - WIDGET_GAP;
1157
- const translateX = position.x * cellSize.width + WIDGET_GAP / 2;
1158
- const translateY = position.y * cellSize.height + WIDGET_GAP / 2;
1159
- return {
1160
- width: `${widgetWidth}px`,
1161
- height: `${widgetHeight}px`,
1162
- transform: `translate(${translateX}px, ${translateY}px)`
1163
- };
1164
- };
1165
- const getWidgetStyles = (widget, position, isDragged = false, displacedPosition) => {
1166
- if (!position) return { display: "none" };
1167
- const cellSize = getCellSize();
1168
- const width = widget.size.width * cellSize.width - WIDGET_GAP;
1169
- const height = widget.size.height * cellSize.height - WIDGET_GAP;
1170
- const left = position.x * cellSize.width + WIDGET_GAP / 2;
1171
- const top = position.y * cellSize.height + WIDGET_GAP / 2;
1172
- const baseStyles = {
1173
- position: "absolute",
1174
- width: `${width}px`,
1175
- height: `${height}px`
1176
- };
1177
- if (displacedPosition) {
1178
- const newLeft = displacedPosition.x * cellSize.width + WIDGET_GAP / 2;
1179
- const newTop = displacedPosition.y * cellSize.height + WIDGET_GAP / 2;
1180
- return {
1181
- ...baseStyles,
1182
- transform: `translate(${newLeft}px, ${newTop}px)`,
1183
- transition: "transform var(--dashboard-transition-duration) var(--dashboard-transition-timing)",
1184
- zIndex: "10"
1185
- };
1186
- }
1187
- if (isDragged) {
1188
- return {
1189
- ...baseStyles,
1190
- transform: `translate(${left}px, ${top}px)`,
1191
- opacity: "0",
1192
- // Hide the original, since the clone is displayed
1193
- pointerEvents: "none",
1194
- zIndex: "1",
1195
- transition: "none"
1196
- // Disable animations for the original widget
1197
- };
1198
- }
1199
- return {
1200
- ...baseStyles,
1201
- transform: `translate(${left}px, ${top}px)`,
1202
- transition: "transform var(--dashboard-transition-duration) var(--dashboard-transition-timing)"
1203
- };
1204
- };
1205
- return {
1206
- getPreviewStyles,
1207
- getWidgetStyles,
1208
- WIDGET_GAP
1209
- };
1210
- }
1211
-
1212
- function useResizeObserver(callback, options) {
1213
- const observer = ref(null);
1214
- const debounceTimer = ref(null);
1215
- const isSupported = typeof window !== "undefined" && "ResizeObserver" in window;
1216
- const handleResize = (entries) => {
1217
- {
1218
- if (debounceTimer.value !== null) {
1219
- window.clearTimeout(debounceTimer.value);
1220
- debounceTimer.value = null;
1221
- }
1222
- debounceTimer.value = window.setTimeout(() => {
1223
- callback(entries);
1224
- }, options.debounceMs);
1225
- }
1226
- };
1227
- const observe = (element) => {
1228
- if (!isSupported) return;
1229
- if (!observer.value) {
1230
- observer.value = new ResizeObserver(handleResize);
1231
- }
1232
- observer.value.observe(element);
1233
- };
1234
- const unobserve = (element) => {
1235
- if (!isSupported || !observer.value) return;
1236
- observer.value.unobserve(element);
1237
- };
1238
- const disconnect = () => {
1239
- if (!isSupported || !observer.value) return;
1240
- observer.value.disconnect();
1241
- observer.value = null;
1242
- if (debounceTimer.value !== null) {
1243
- window.clearTimeout(debounceTimer.value);
1244
- debounceTimer.value = null;
1245
- }
1246
- };
1247
- onUnmounted(() => {
1248
- disconnect();
1249
- });
1250
- return {
1251
- observe,
1252
- unobserve,
1253
- disconnect,
1254
- isSupported
1255
- };
1256
- }
1257
-
1258
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
1259
- __name: "DashboardWidget",
1260
- props: {
1261
- widget: {}
1262
- },
1263
- emits: ["drag"],
1264
- setup(__props, { emit: __emit }) {
1265
- const interactiveSelectors = [
1266
- "button",
1267
- "a",
1268
- "input",
1269
- "select",
1270
- "textarea",
1271
- "label",
1272
- '[role="button"]',
1273
- '[role="checkbox"]',
1274
- '[role="radio"]',
1275
- '[role="switch"]',
1276
- '[role="tab"]',
1277
- '[role="link"]'
1278
- ];
1279
- const isInteractiveElement = (target) => {
1280
- if (!target || !(target instanceof Element)) return false;
1281
- return interactiveSelectors.some((selector) => {
1282
- return target.matches(selector) || !!target.closest(selector);
1283
- });
1284
- };
1285
- const handleWidgetMouseDown = (event) => {
1286
- if (isInteractiveElement(event.target)) {
1287
- return;
1288
- }
1289
- event.preventDefault();
1290
- event.stopPropagation();
1291
- emit("drag", event);
1292
- };
1293
- const handleWidgetTouchStart = (event) => {
1294
- if (isInteractiveElement(event.target)) {
1295
- return;
1296
- }
1297
- emit("drag", event);
1298
- };
1299
- const emit = __emit;
1300
- return (_ctx, _cache) => {
1301
- return openBlock(), createElementBlock("div", {
1302
- class: "dashboard-widget",
1303
- "data-test": "dashboard-widget",
1304
- onMousedown: handleWidgetMouseDown,
1305
- onTouchstartPassive: handleWidgetTouchStart
1306
- }, [
1307
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.widget.component), mergeProps(_ctx.widget.props || {}, { class: "dashboard-widget__content" }), null, 16))
1308
- ], 32);
1309
- };
1310
- }
1311
- });
1312
-
1313
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
1314
- __name: "DraggableDashboard",
1315
- setup(__props, { expose: __expose }) {
1316
- const gridContainerRef = ref(null);
1317
- const dashboard = useDashboard();
1318
- const {
1319
- widgets,
1320
- layout,
1321
- GRID_COLUMNS,
1322
- getGridRows,
1323
- arrangeWidgetsInRows,
1324
- initializeLayout,
1325
- saveLayoutToLocalStorage,
1326
- initializeWithBuiltInPositions
1327
- } = useDashboardGrid();
1328
- const cellSizeCalculator = useCellSizeCalculator(GRID_COLUMNS);
1329
- const getCellSize = () => {
1330
- return cellSizeCalculator.calculateCellSize(gridContainerRef.value);
1331
- };
1332
- const widgetStyles = useWidgetStyles(getCellSize);
1333
- const {
1334
- draggedWidget,
1335
- previewPosition,
1336
- isDragging,
1337
- handleMouseDown,
1338
- setGridContainer,
1339
- isWidgetDisplaced,
1340
- getDisplacedPosition
1341
- } = useDashboardDragAndDrop(dashboard.updateWidgetPosition, getGridRows);
1342
- watch(gridContainerRef, (container) => {
1343
- if (container) {
1344
- setGridContainer(container);
1345
- }
1346
- });
1347
- watch(
1348
- layout,
1349
- () => {
1350
- saveLayoutToLocalStorage();
1351
- },
1352
- { deep: true }
1353
- );
1354
- const handleContainerResize = (entries) => {
1355
- if (!entries.length || isDragging.value) return;
1356
- entries[0];
1357
- const container = gridContainerRef.value;
1358
- if (container) {
1359
- cellSizeCalculator.handleContainerResize(container);
1360
- }
1361
- };
1362
- const resizeObserver = useResizeObserver(handleContainerResize, { debounceMs: 300 });
1363
- const getWidgetStylesWithState = (widget) => {
1364
- const position = layout.value.get(widget.id);
1365
- const isDragged = draggedWidget.value?.id === widget.id;
1366
- const displacedPosition = isWidgetDisplaced(widget.id) ? getDisplacedPosition(widget.id) : void 0;
1367
- return widgetStyles.getWidgetStyles(widget, position, isDragged, displacedPosition);
1368
- };
1369
- const rearrangeWidgets = () => {
1370
- arrangeWidgetsInRows(widgets.value);
1371
- };
1372
- const recalculateLayout = () => {
1373
- cellSizeCalculator.clearCache();
1374
- recalculateWidgetPositions();
1375
- };
1376
- const saveLayout = () => {
1377
- saveLayoutToLocalStorage();
1378
- };
1379
- const useBuiltInPositions = () => {
1380
- const result = initializeWithBuiltInPositions();
1381
- return result;
1382
- };
1383
- const recalculateWidgetPositions = () => {
1384
- getCellSize();
1385
- if (gridContainerRef.value) {
1386
- cellSizeCalculator.previousContainerWidth.value = gridContainerRef.value.getBoundingClientRect().width;
1387
- }
1388
- };
1389
- onMounted(() => {
1390
- initializeLayout();
1391
- getCellSize();
1392
- if (gridContainerRef.value && resizeObserver.isSupported) {
1393
- resizeObserver.observe(gridContainerRef.value);
1394
- }
1395
- window.addEventListener("resize", cellSizeCalculator.clearCache);
1396
- });
1397
- onUnmounted(() => {
1398
- window.removeEventListener("resize", cellSizeCalculator.clearCache);
1399
- });
1400
- __expose({
1401
- rearrangeWidgets,
1402
- recalculateLayout,
1403
- saveLayout,
1404
- useBuiltInPositions
1405
- });
1406
- return (_ctx, _cache) => {
1407
- return openBlock(), createBlock(_sfc_main$d, {
1408
- "no-padding": "",
1409
- class: "vc-dashboard-grid"
1410
- }, {
1411
- default: withCtx(() => [
1412
- createElementVNode("div", {
1413
- ref_key: "gridContainerRef",
1414
- ref: gridContainerRef,
1415
- class: "vc-dashboard-grid__container"
1416
- }, [
1417
- unref(draggedWidget) && unref(previewPosition) ? (openBlock(), createElementBlock("div", {
1418
- key: 0,
1419
- class: normalizeClass(["vc-dashboard-grid__position-preview", {
1420
- "is-animating": unref(isDragging)
1421
- }]),
1422
- style: normalizeStyle(unref(widgetStyles).getPreviewStyles(unref(draggedWidget), unref(previewPosition)))
1423
- }, null, 6)) : createCommentVNode("", true),
1424
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(widgets), (widget) => {
1425
- return openBlock(), createBlock(_sfc_main$2, {
1426
- key: widget.id,
1427
- widget,
1428
- style: normalizeStyle(getWidgetStylesWithState(widget)),
1429
- "is-dragging": unref(draggedWidget)?.id === widget.id,
1430
- class: normalizeClass({
1431
- "is-dragging": unref(draggedWidget)?.id === widget.id,
1432
- "is-displaced": unref(isWidgetDisplaced)(widget.id),
1433
- "is-animating": unref(isDragging) && (unref(draggedWidget)?.id === widget.id || unref(isWidgetDisplaced)(widget.id))
1434
- }),
1435
- "data-id": widget.id,
1436
- onDrag: (e) => unref(handleMouseDown)(e, widget, e.target)
1437
- }, null, 8, ["widget", "style", "is-dragging", "class", "data-id", "onDrag"]);
1438
- }), 128))
1439
- ], 512)
1440
- ]),
1441
- _: 1
1442
- });
1443
- };
1444
- }
1445
- });
1446
-
1447
- const _hoisted_1 = { class: "dashboard-widget-card" };
1448
- const _hoisted_2 = { class: "dashboard-widget-card__header-wrapper" };
1449
- const _hoisted_3 = { class: "dashboard-widget-card__header" };
1450
- const _hoisted_4 = { class: "dashboard-widget-card__header-content" };
1451
- const _hoisted_5 = { class: "dashboard-widget-card__header" };
1452
- const _hoisted_6 = { class: "dashboard-widget-card__actions" };
1453
- const _hoisted_7 = { class: "dashboard-widget-card__body" };
1454
- const _hoisted_8 = {
1455
- key: 0,
1456
- class: "dashboard-widget-card__body-content"
1457
- };
1458
- const _sfc_main = /* @__PURE__ */ defineComponent({
1459
- __name: "dashboard-widget-card",
1460
- props: {
1461
- header: {},
1462
- icon: {},
1463
- loading: { type: Boolean }
1464
- },
1465
- setup(__props) {
1466
- const props = __props;
1467
- return (_ctx, _cache) => {
1468
- const _component_VcIcon = resolveComponent("VcIcon");
1469
- const _directive_loading = resolveDirective("loading");
1470
- return openBlock(), createElementBlock("div", _hoisted_1, [
1471
- createElementVNode("div", _hoisted_2, [
1472
- createElementVNode("div", _hoisted_3, [
1473
- renderSlot(_ctx.$slots, "header", {}, () => [
1474
- createElementVNode("div", _hoisted_4, [
1475
- _ctx.icon ? (openBlock(), createBlock(_component_VcIcon, {
1476
- key: 0,
1477
- class: "dashboard-widget-card__icon",
1478
- icon: _ctx.icon,
1479
- size: "xl"
1480
- }, null, 8, ["icon"])) : createCommentVNode("", true),
1481
- createElementVNode("div", _hoisted_5, toDisplayString(props.header), 1)
1482
- ])
1483
- ])
1484
- ]),
1485
- createElementVNode("div", _hoisted_6, [
1486
- renderSlot(_ctx.$slots, "actions")
1487
- ])
1488
- ]),
1489
- createElementVNode("div", _hoisted_7, [
1490
- _ctx.$isDesktop.value || !_ctx.$slots["mobile-content"] ? withDirectives((openBlock(), createElementBlock("div", _hoisted_8, [
1491
- renderSlot(_ctx.$slots, "content")
1492
- ])), [
1493
- [_directive_loading, _ctx.loading]
1494
- ]) : createCommentVNode("", true)
1495
- ])
1496
- ]);
1497
- };
1498
- }
1499
- });
1500
-
1501
- export { NotificationDropdown as N, UserDropdownButton as U, _sfc_main as _, _sfc_main$1 as a, NotificationTemplate as b };