@aithe/aithe-ui 26.2.3 → 26.3.2

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 (620) hide show
  1. package/README.md +19 -11
  2. package/dist/apps/admin/app.js +12 -0
  3. package/dist/apps/admin/components/admin-app.js +83 -0
  4. package/dist/apps/admin/components/admin-layout.d.ts +0 -1
  5. package/dist/apps/admin/components/admin-layout.d.ts.map +1 -1
  6. package/dist/apps/admin/components/admin-layout.js +250 -0
  7. package/dist/apps/admin/datahub/auth.js +24 -0
  8. package/dist/apps/admin/datahub/dashboard.js +16 -0
  9. package/dist/apps/admin/datahub/index.js +42 -0
  10. package/dist/apps/admin/datahub/menu.js +16 -0
  11. package/dist/apps/admin/datahub/mock/auth.js +11 -0
  12. package/dist/apps/admin/datahub/mock/dashboard.js +10 -0
  13. package/dist/apps/admin/datahub/mock/menu.js +42 -0
  14. package/dist/apps/admin/i18n/de-DE.js +37 -0
  15. package/dist/apps/admin/i18n/en-US.js +37 -0
  16. package/dist/apps/admin/i18n/es-ES.js +38 -0
  17. package/dist/apps/admin/i18n/fr-FR.js +37 -0
  18. package/dist/apps/admin/i18n/index.js +27 -0
  19. package/dist/apps/admin/i18n/ja-JP.js +38 -0
  20. package/dist/apps/admin/i18n/ko-KR.js +37 -0
  21. package/dist/apps/admin/i18n/pt-BR.js +37 -0
  22. package/dist/apps/admin/i18n/zh-CN.js +37 -0
  23. package/dist/apps/admin/i18n/zh-HK.js +37 -0
  24. package/dist/apps/admin/i18n/zh-TW.js +37 -0
  25. package/dist/apps/admin/pages/dashboard-page.d.ts +1 -0
  26. package/dist/apps/admin/pages/dashboard-page.d.ts.map +1 -1
  27. package/dist/apps/admin/pages/dashboard-page.js +199 -0
  28. package/dist/apps/admin/pages/login-page.js +278 -0
  29. package/dist/apps/admin/pages/not-found-page.js +57 -0
  30. package/dist/apps/admin/pages/role-page.js +76 -0
  31. package/dist/apps/admin/pages/settings-page.js +95 -0
  32. package/dist/apps/admin/pages/user-page.js +76 -0
  33. package/dist/apps/admin/router/index.js +43 -0
  34. package/dist/apps/admin/standalone.js +1 -0
  35. package/dist/apps/admin/store/auth.js +42 -0
  36. package/dist/apps/api/app.js +82 -0
  37. package/dist/apps/api/demo-data.d.ts.map +1 -1
  38. package/dist/apps/api/demo-data.js +965 -0
  39. package/dist/apps/api/docs-viewer.js +684 -0
  40. package/dist/apps/api/i18n/de-DE.d.ts.map +1 -1
  41. package/dist/apps/api/i18n/de-DE.js +131 -0
  42. package/dist/apps/api/i18n/en-US.d.ts.map +1 -1
  43. package/dist/apps/api/i18n/en-US.js +141 -0
  44. package/dist/apps/api/i18n/es-ES.d.ts.map +1 -1
  45. package/dist/apps/api/i18n/es-ES.js +131 -0
  46. package/dist/apps/api/i18n/fr-FR.d.ts.map +1 -1
  47. package/dist/apps/api/i18n/fr-FR.js +131 -0
  48. package/dist/apps/api/i18n/index.js +27 -0
  49. package/dist/apps/api/i18n/ja-JP.d.ts.map +1 -1
  50. package/dist/apps/api/i18n/ja-JP.js +131 -0
  51. package/dist/apps/api/i18n/ko-KR.d.ts.map +1 -1
  52. package/dist/apps/api/i18n/ko-KR.js +131 -0
  53. package/dist/apps/api/i18n/pt-BR.d.ts.map +1 -1
  54. package/dist/apps/api/i18n/pt-BR.js +131 -0
  55. package/dist/apps/api/i18n/zh-CN.d.ts.map +1 -1
  56. package/dist/apps/api/i18n/zh-CN.js +141 -0
  57. package/dist/apps/api/i18n/zh-HK.d.ts.map +1 -1
  58. package/dist/apps/api/i18n/zh-HK.js +131 -0
  59. package/dist/apps/api/i18n/zh-TW.d.ts.map +1 -1
  60. package/dist/apps/api/i18n/zh-TW.js +131 -0
  61. package/dist/apps/api/pages/docs.d.ts.map +1 -1
  62. package/dist/apps/api/pages/docs.js +369 -0
  63. package/dist/apps/api/standalone.js +1 -0
  64. package/dist/apps/demo/app.d.ts.map +1 -1
  65. package/dist/apps/demo/app.js +275 -0
  66. package/dist/apps/demo/editor.d.ts.map +1 -1
  67. package/dist/apps/demo/editor.js +270 -0
  68. package/dist/apps/demo/helpers.js +7 -0
  69. package/dist/apps/demo/i18n/de-DE.d.ts.map +1 -1
  70. package/dist/apps/demo/i18n/de-DE.js +289 -0
  71. package/dist/apps/demo/i18n/en-US.d.ts.map +1 -1
  72. package/dist/apps/demo/i18n/en-US.js +301 -0
  73. package/dist/apps/demo/i18n/es-ES.d.ts.map +1 -1
  74. package/dist/apps/demo/i18n/es-ES.js +289 -0
  75. package/dist/apps/demo/i18n/fr-FR.d.ts.map +1 -1
  76. package/dist/apps/demo/i18n/fr-FR.js +289 -0
  77. package/dist/apps/demo/i18n/index.js +27 -0
  78. package/dist/apps/demo/i18n/ja-JP.d.ts.map +1 -1
  79. package/dist/apps/demo/i18n/ja-JP.js +289 -0
  80. package/dist/apps/demo/i18n/ko-KR.d.ts.map +1 -1
  81. package/dist/apps/demo/i18n/ko-KR.js +289 -0
  82. package/dist/apps/demo/i18n/pt-BR.d.ts.map +1 -1
  83. package/dist/apps/demo/i18n/pt-BR.js +289 -0
  84. package/dist/apps/demo/i18n/zh-CN.d.ts.map +1 -1
  85. package/dist/apps/demo/i18n/zh-CN.js +301 -0
  86. package/dist/apps/demo/i18n/zh-HK.d.ts.map +1 -1
  87. package/dist/apps/demo/i18n/zh-HK.js +289 -0
  88. package/dist/apps/demo/i18n/zh-TW.d.ts.map +1 -1
  89. package/dist/apps/demo/i18n/zh-TW.js +289 -0
  90. package/dist/apps/demo/pages/autoform.d.ts.map +1 -1
  91. package/dist/apps/demo/pages/autoform.js +422 -0
  92. package/dist/apps/demo/pages/autoview.d.ts +3 -0
  93. package/dist/apps/demo/pages/autoview.d.ts.map +1 -0
  94. package/dist/apps/demo/pages/autoview.js +310 -0
  95. package/dist/apps/demo/pages/basic.js +157 -0
  96. package/dist/apps/demo/pages/code.js +1088 -0
  97. package/dist/apps/demo/pages/container.js +42 -0
  98. package/dist/apps/demo/pages/dashboard.js +159 -0
  99. package/dist/apps/demo/pages/data.d.ts.map +1 -1
  100. package/dist/apps/demo/pages/data.js +327 -0
  101. package/dist/apps/demo/pages/display.d.ts.map +1 -1
  102. package/dist/apps/demo/pages/display.js +295 -0
  103. package/dist/apps/demo/pages/feedback.js +94 -0
  104. package/dist/apps/demo/pages/form.d.ts.map +1 -1
  105. package/dist/apps/demo/pages/form.js +119 -0
  106. package/dist/apps/demo/pages/layout.js +74 -0
  107. package/dist/apps/demo/pages/navigation.js +54 -0
  108. package/dist/apps/demo/pages/progress.js +42 -0
  109. package/dist/apps/demo/pages/theme.js +126 -0
  110. package/dist/apps/demo/standalone.js +1 -0
  111. package/dist/components/basic/AGENTS.md +1 -0
  112. package/dist/components/basic/avatar.js +168 -0
  113. package/dist/components/basic/badge.js +157 -0
  114. package/dist/components/basic/button-group.js +70 -0
  115. package/dist/components/basic/button.d.ts +2 -4
  116. package/dist/components/basic/button.d.ts.map +1 -1
  117. package/dist/components/basic/button.js +315 -0
  118. package/dist/components/basic/card.js +186 -0
  119. package/dist/components/basic/chip.js +103 -0
  120. package/dist/components/basic/divider.js +127 -0
  121. package/dist/components/basic/empty.js +72 -0
  122. package/dist/components/basic/icon.js +129 -0
  123. package/dist/components/basic/input.d.ts.map +1 -1
  124. package/dist/components/basic/input.js +314 -0
  125. package/dist/components/basic/tag.d.ts +7 -2
  126. package/dist/components/basic/tag.d.ts.map +1 -1
  127. package/dist/components/basic/tag.js +248 -0
  128. package/dist/components/basic/textarea.d.ts +0 -1
  129. package/dist/components/basic/textarea.d.ts.map +1 -1
  130. package/dist/components/basic/textarea.js +130 -0
  131. package/dist/components/container/callout.js +108 -0
  132. package/dist/components/container/details.js +117 -0
  133. package/dist/components/container/scroller.js +144 -0
  134. package/dist/components/container/split-panel.js +150 -0
  135. package/dist/components/data/AGENTS.md +1 -1
  136. package/dist/components/data/box-table.d.ts +53 -0
  137. package/dist/components/data/box-table.d.ts.map +1 -0
  138. package/dist/components/data/box-table.js +220 -0
  139. package/dist/components/data/dropdown.d.ts +8 -5
  140. package/dist/components/data/dropdown.d.ts.map +1 -1
  141. package/dist/components/data/dropdown.js +219 -0
  142. package/dist/components/data/metrics-group.js +180 -0
  143. package/dist/components/data/metrics.d.ts +11 -0
  144. package/dist/components/data/metrics.d.ts.map +1 -1
  145. package/dist/components/data/metrics.js +309 -0
  146. package/dist/components/data/pagination.js +119 -0
  147. package/dist/components/data/tab-pane.d.ts +58 -12
  148. package/dist/components/data/tab-pane.d.ts.map +1 -1
  149. package/dist/components/data/tab-pane.js +130 -0
  150. package/dist/components/data/table-column.d.ts +29 -5
  151. package/dist/components/data/table-column.d.ts.map +1 -1
  152. package/dist/components/data/table-column.js +123 -0
  153. package/dist/components/data/table.d.ts +134 -54
  154. package/dist/components/data/table.d.ts.map +1 -1
  155. package/dist/components/data/table.js +1210 -0
  156. package/dist/components/data/tabs.d.ts +60 -3
  157. package/dist/components/data/tabs.d.ts.map +1 -1
  158. package/dist/components/data/tabs.js +416 -0
  159. package/dist/components/data/timeline-item.js +127 -0
  160. package/dist/components/data/timeline.js +204 -0
  161. package/dist/components/data/tree-menu.d.ts +12 -2
  162. package/dist/components/data/tree-menu.d.ts.map +1 -1
  163. package/dist/components/data/tree-menu.js +482 -0
  164. package/dist/components/data/tree.js +269 -0
  165. package/dist/components/display/AGENTS.md +5 -2
  166. package/dist/components/display/animated-image.js +98 -0
  167. package/dist/components/display/autoview.d.ts +139 -0
  168. package/dist/components/display/autoview.d.ts.map +1 -0
  169. package/dist/components/display/autoview.js +460 -0
  170. package/dist/components/display/brief-box.d.ts +42 -0
  171. package/dist/components/display/brief-box.d.ts.map +1 -0
  172. package/dist/components/display/brief-box.js +117 -0
  173. package/dist/components/display/carousel.js +223 -0
  174. package/dist/components/display/code-editor.d.ts.map +1 -1
  175. package/dist/components/display/code-editor.js +976 -0
  176. package/dist/components/display/comparison.js +132 -0
  177. package/dist/components/display/desc-item.d.ts +48 -0
  178. package/dist/components/display/desc-item.d.ts.map +1 -0
  179. package/dist/components/display/desc-item.js +150 -0
  180. package/dist/components/display/desc.d.ts +68 -0
  181. package/dist/components/display/desc.d.ts.map +1 -0
  182. package/dist/components/display/desc.js +405 -0
  183. package/dist/components/display/detail-box.d.ts +51 -0
  184. package/dist/components/display/detail-box.d.ts.map +1 -0
  185. package/dist/components/display/detail-box.js +157 -0
  186. package/dist/components/display/label.js +166 -0
  187. package/dist/components/display/markdown-editor.js +319 -0
  188. package/dist/components/display/markdown.d.ts.map +1 -1
  189. package/dist/components/display/markdown.js +193 -0
  190. package/dist/components/display/mini-box.d.ts +31 -0
  191. package/dist/components/display/mini-box.d.ts.map +1 -0
  192. package/dist/components/display/mini-box.js +137 -0
  193. package/dist/components/display/profile.d.ts +18 -0
  194. package/dist/components/display/profile.d.ts.map +1 -0
  195. package/dist/components/display/profile.js +164 -0
  196. package/dist/components/feedback/AGENTS.md +1 -0
  197. package/dist/components/feedback/alert.js +150 -0
  198. package/dist/components/feedback/dialog.js +228 -0
  199. package/dist/components/feedback/drawer.d.ts.map +1 -1
  200. package/dist/components/feedback/drawer.js +338 -0
  201. package/dist/components/feedback/loading.js +130 -0
  202. package/dist/components/feedback/modal.d.ts.map +1 -1
  203. package/dist/components/feedback/modal.js +303 -0
  204. package/dist/components/feedback/notification.js +170 -0
  205. package/dist/components/feedback/popover.d.ts +1 -1
  206. package/dist/components/feedback/popover.js +124 -0
  207. package/dist/components/feedback/toast.js +142 -0
  208. package/dist/components/feedback/tooltip.d.ts +1 -1
  209. package/dist/components/feedback/tooltip.js +153 -0
  210. package/dist/components/form/AGENTS.md +4 -0
  211. package/dist/components/form/autoform-item.d.ts +6 -0
  212. package/dist/components/form/autoform-item.d.ts.map +1 -1
  213. package/dist/components/form/autoform-item.js +791 -0
  214. package/dist/components/form/autoform.d.ts +15 -5
  215. package/dist/components/form/autoform.d.ts.map +1 -1
  216. package/dist/components/form/autoform.js +303 -0
  217. package/dist/components/form/checkbox-group.js +118 -0
  218. package/dist/components/form/checkbox.js +123 -0
  219. package/dist/components/form/color-picker.js +148 -0
  220. package/dist/components/form/combobox.d.ts +4 -0
  221. package/dist/components/form/combobox.d.ts.map +1 -1
  222. package/dist/components/form/combobox.js +325 -0
  223. package/dist/components/form/date-picker.js +123 -0
  224. package/dist/components/form/form-item.d.ts.map +1 -1
  225. package/dist/components/form/form-item.js +141 -0
  226. package/dist/components/form/form.js +94 -0
  227. package/dist/components/form/radio-group.js +106 -0
  228. package/dist/components/form/radio.js +110 -0
  229. package/dist/components/form/rate.js +116 -0
  230. package/dist/components/form/select.d.ts +5 -1
  231. package/dist/components/form/select.d.ts.map +1 -1
  232. package/dist/components/form/select.js +539 -0
  233. package/dist/components/form/slider.js +134 -0
  234. package/dist/components/form/switch.js +146 -0
  235. package/dist/components/form/time-picker.js +92 -0
  236. package/dist/components/form/transfer.js +273 -0
  237. package/dist/components/form/upload.js +138 -0
  238. package/dist/components/framework/body.js +333 -0
  239. package/dist/components/framework/dashboard-panel.js +519 -0
  240. package/dist/components/framework/dashboard.d.ts.map +1 -1
  241. package/dist/components/framework/dashboard.js +1084 -0
  242. package/dist/components/framework/header.js +237 -0
  243. package/dist/components/framework/log-panel.js +637 -0
  244. package/dist/components/framework/page.js +151 -0
  245. package/dist/components/framework/sidebar.d.ts +4 -10
  246. package/dist/components/framework/sidebar.d.ts.map +1 -1
  247. package/dist/components/framework/sidebar.js +477 -0
  248. package/dist/components/layout/affix.js +137 -0
  249. package/dist/components/layout/col.js +103 -0
  250. package/dist/components/layout/collapse-item.js +165 -0
  251. package/dist/components/layout/collapse.js +108 -0
  252. package/dist/components/layout/container.js +92 -0
  253. package/dist/components/layout/flex.js +100 -0
  254. package/dist/components/layout/row.js +103 -0
  255. package/dist/components/layout/space.js +85 -0
  256. package/dist/components/navigation/back-top.js +127 -0
  257. package/dist/components/navigation/breadcrumb-item.js +108 -0
  258. package/dist/components/navigation/breadcrumb.js +70 -0
  259. package/dist/components/navigation/menu-item.js +181 -0
  260. package/dist/components/navigation/menu.js +126 -0
  261. package/dist/components/navigation/steps.js +183 -0
  262. package/dist/components/navigation/sub-menu.d.ts.map +1 -1
  263. package/dist/components/navigation/sub-menu.js +252 -0
  264. package/dist/components/progress/progress-bar.js +97 -0
  265. package/dist/components/progress/progress-ring.js +111 -0
  266. package/dist/components/progress/skeleton.js +108 -0
  267. package/dist/components/progress/spinner.js +129 -0
  268. package/dist/components/theme/locale-switch.js +241 -0
  269. package/dist/components/theme/shadow-picker.js +233 -0
  270. package/dist/components/theme/shape-picker.js +232 -0
  271. package/dist/components/theme/theme-picker.js +236 -0
  272. package/dist/components/theme/theme-preview.d.ts +1 -2
  273. package/dist/components/theme/theme-preview.d.ts.map +1 -1
  274. package/dist/components/theme/theme-preview.js +376 -0
  275. package/dist/components/theme/theme-switch.d.ts.map +1 -1
  276. package/dist/components/theme/theme-switch.js +318 -0
  277. package/dist/components/theme/typo-picker.js +219 -0
  278. package/dist/core/AGENTS.md +6 -1
  279. package/dist/core/aithe-element.d.ts +2 -2
  280. package/dist/core/aithe-element.js +135 -0
  281. package/dist/core/aithe-widget.js +30 -0
  282. package/dist/core/anchored-overlay.d.ts +3 -0
  283. package/dist/core/anchored-overlay.d.ts.map +1 -1
  284. package/dist/core/anchored-overlay.js +111 -0
  285. package/dist/core/autoform/autoform.js +79 -0
  286. package/dist/core/autoform/autoview.d.ts +86 -0
  287. package/dist/core/autoform/autoview.d.ts.map +1 -0
  288. package/dist/core/autoform/autoview.js +37 -0
  289. package/dist/core/autoform/condition.js +170 -0
  290. package/dist/core/autoform/index.d.ts +2 -0
  291. package/dist/core/autoform/index.d.ts.map +1 -1
  292. package/dist/core/autoform/index.js +9 -0
  293. package/dist/core/autoform/types.js +7 -0
  294. package/dist/core/datahub/__tests__/force-options.test.d.ts +8 -0
  295. package/dist/core/datahub/__tests__/force-options.test.d.ts.map +1 -0
  296. package/dist/core/datahub/__tests__/force-options.test.js +161 -0
  297. package/dist/core/datahub/config/strategy.d.ts +1 -1
  298. package/dist/core/datahub/config/strategy.d.ts.map +1 -1
  299. package/dist/core/datahub/config/strategy.js +50 -0
  300. package/dist/core/datahub/core/adapter/fetch-adapter.d.ts +1 -1
  301. package/dist/core/datahub/core/adapter/fetch-adapter.d.ts.map +1 -1
  302. package/dist/core/datahub/core/adapter/fetch-adapter.js +118 -0
  303. package/dist/core/datahub/core/adapter/index.js +7 -0
  304. package/dist/core/datahub/core/adapter/mock-adapter.d.ts +1 -1
  305. package/dist/core/datahub/core/adapter/mock-adapter.d.ts.map +1 -1
  306. package/dist/core/datahub/core/adapter/mock-adapter.js +58 -0
  307. package/dist/core/datahub/core/api-styles.d.ts +1 -1
  308. package/dist/core/datahub/core/api-styles.d.ts.map +1 -1
  309. package/dist/core/datahub/core/api-styles.js +136 -0
  310. package/dist/core/datahub/core/datahub-core.d.ts +53 -3
  311. package/dist/core/datahub/core/datahub-core.d.ts.map +1 -1
  312. package/dist/core/datahub/core/datahub-core.js +520 -0
  313. package/dist/core/datahub/core/index.js +7 -0
  314. package/dist/core/datahub/index.js +50 -0
  315. package/dist/core/datahub/types.d.ts +24 -0
  316. package/dist/core/datahub/types.d.ts.map +1 -1
  317. package/dist/core/datahub/types.js +31 -0
  318. package/dist/core/datahub/utils/cache.js +55 -0
  319. package/dist/core/datahub/utils/common.js +23 -0
  320. package/dist/core/datahub/utils/dedup.d.ts +1 -1
  321. package/dist/core/datahub/utils/dedup.d.ts.map +1 -1
  322. package/dist/core/datahub/utils/dedup.js +52 -0
  323. package/dist/core/datahub/utils/idempotent.js +61 -0
  324. package/dist/core/datahub/utils/is-query.js +53 -0
  325. package/dist/core/datahub/utils/loading.js +78 -0
  326. package/dist/core/filter/__tests__/index.test.d.ts +2 -0
  327. package/dist/core/filter/__tests__/index.test.d.ts.map +1 -0
  328. package/dist/core/filter/__tests__/index.test.js +230 -0
  329. package/dist/core/filter/builtins.d.ts +60 -0
  330. package/dist/core/filter/builtins.d.ts.map +1 -0
  331. package/dist/core/filter/builtins.js +172 -0
  332. package/dist/core/filter/factory.d.ts +54 -0
  333. package/dist/core/filter/factory.d.ts.map +1 -0
  334. package/dist/core/filter/factory.js +96 -0
  335. package/dist/core/filter/index.d.ts +11 -0
  336. package/dist/core/filter/index.d.ts.map +1 -0
  337. package/dist/core/filter/index.js +9 -0
  338. package/dist/core/filter/types.d.ts +12 -0
  339. package/dist/core/filter/types.d.ts.map +1 -0
  340. package/dist/core/filter/types.js +1 -0
  341. package/dist/core/floating.js +132 -0
  342. package/dist/core/highlight/index.js +43 -0
  343. package/dist/core/highlight/lang-bash.js +27 -0
  344. package/dist/core/highlight/lang-c.js +27 -0
  345. package/dist/core/highlight/lang-cmake.js +27 -0
  346. package/dist/core/highlight/lang-cpp.js +27 -0
  347. package/dist/core/highlight/lang-css.js +24 -0
  348. package/dist/core/highlight/lang-dart.js +27 -0
  349. package/dist/core/highlight/lang-dockerfile.js +16 -0
  350. package/dist/core/highlight/lang-fsharp.js +23 -0
  351. package/dist/core/highlight/lang-go.js +22 -0
  352. package/dist/core/highlight/lang-html.js +12 -0
  353. package/dist/core/highlight/lang-java.js +22 -0
  354. package/dist/core/highlight/lang-javascript.js +26 -0
  355. package/dist/core/highlight/lang-json.js +13 -0
  356. package/dist/core/highlight/lang-jsonline.js +13 -0
  357. package/dist/core/highlight/lang-jsx.js +30 -0
  358. package/dist/core/highlight/lang-kotlin.js +27 -0
  359. package/dist/core/highlight/lang-latex.js +22 -0
  360. package/dist/core/highlight/lang-lua.js +26 -0
  361. package/dist/core/highlight/lang-makefile.js +22 -0
  362. package/dist/core/highlight/lang-markdown.js +18 -0
  363. package/dist/core/highlight/lang-objectivec.js +24 -0
  364. package/dist/core/highlight/lang-perl.js +30 -0
  365. package/dist/core/highlight/lang-powershell.js +23 -0
  366. package/dist/core/highlight/lang-python.js +27 -0
  367. package/dist/core/highlight/lang-r.js +21 -0
  368. package/dist/core/highlight/lang-ruby.js +29 -0
  369. package/dist/core/highlight/lang-rust.js +24 -0
  370. package/dist/core/highlight/lang-scala.js +26 -0
  371. package/dist/core/highlight/lang-sql.js +21 -0
  372. package/dist/core/highlight/lang-svelte.js +27 -0
  373. package/dist/core/highlight/lang-swift.js +28 -0
  374. package/dist/core/highlight/lang-tsx.js +35 -0
  375. package/dist/core/highlight/lang-typescript.js +31 -0
  376. package/dist/core/highlight/lang-vue.js +29 -0
  377. package/dist/core/highlight/lang-wasm.js +22 -0
  378. package/dist/core/highlight/lang-xml.js +12 -0
  379. package/dist/core/highlight/lang-yaml.js +14 -0
  380. package/dist/core/highlight/registry.js +99 -0
  381. package/dist/core/logger/LoggerCore.js +626 -0
  382. package/dist/core/logger/index.js +10 -0
  383. package/dist/core/logger/types.js +29 -0
  384. package/dist/core/markdown/index.js +20 -0
  385. package/dist/core/markdown/parser.d.ts +2 -0
  386. package/dist/core/markdown/parser.d.ts.map +1 -1
  387. package/dist/core/markdown/parser.js +376 -0
  388. package/dist/core/markdown/plugins.d.ts +2 -1
  389. package/dist/core/markdown/plugins.d.ts.map +1 -1
  390. package/dist/core/markdown/plugins.js +755 -0
  391. package/dist/core/markdown/types.d.ts +5 -0
  392. package/dist/core/markdown/types.d.ts.map +1 -1
  393. package/dist/core/markdown/types.js +7 -0
  394. package/dist/core/router/index.js +244 -0
  395. package/dist/core/styles.js +44 -0
  396. package/dist/core/types.d.ts +52 -3
  397. package/dist/core/types.d.ts.map +1 -1
  398. package/dist/core/types.js +1 -0
  399. package/dist/index.d.ts +9 -0
  400. package/dist/index.d.ts.map +1 -1
  401. package/dist/index.js +3695 -1622
  402. package/dist/index.js.map +1 -1
  403. package/dist/index.umd.js +1844 -758
  404. package/dist/index.umd.js.map +1 -1
  405. package/dist/styles/aithe-ui.d.ts +23 -0
  406. package/dist/styles/aithe-ui.d.ts.map +1 -1
  407. package/dist/styles/aithe-ui.js +185 -0
  408. package/dist/styles/global.css.d.ts +1 -1
  409. package/dist/styles/global.css.d.ts.map +1 -1
  410. package/dist/styles/global.css.js +119 -0
  411. package/dist/styles/i18n/index.js +206 -0
  412. package/dist/styles/i18n/locales/de-DE.d.ts.map +1 -1
  413. package/dist/styles/i18n/locales/de-DE.js +151 -0
  414. package/dist/styles/i18n/locales/en-US.d.ts.map +1 -1
  415. package/dist/styles/i18n/locales/en-US.js +160 -0
  416. package/dist/styles/i18n/locales/es-ES.d.ts.map +1 -1
  417. package/dist/styles/i18n/locales/es-ES.js +151 -0
  418. package/dist/styles/i18n/locales/fr-FR.d.ts.map +1 -1
  419. package/dist/styles/i18n/locales/fr-FR.js +151 -0
  420. package/dist/styles/i18n/locales/index.js +14 -0
  421. package/dist/styles/i18n/locales/ja-JP.d.ts.map +1 -1
  422. package/dist/styles/i18n/locales/ja-JP.js +151 -0
  423. package/dist/styles/i18n/locales/ko-KR.d.ts.map +1 -1
  424. package/dist/styles/i18n/locales/ko-KR.js +151 -0
  425. package/dist/styles/i18n/locales/pt-BR.d.ts.map +1 -1
  426. package/dist/styles/i18n/locales/pt-BR.js +151 -0
  427. package/dist/styles/i18n/locales/zh-CN.d.ts.map +1 -1
  428. package/dist/styles/i18n/locales/zh-CN.js +160 -0
  429. package/dist/styles/i18n/locales/zh-HK.d.ts.map +1 -1
  430. package/dist/styles/i18n/locales/zh-HK.js +151 -0
  431. package/dist/styles/i18n/locales/zh-TW.d.ts.map +1 -1
  432. package/dist/styles/i18n/locales/zh-TW.js +151 -0
  433. package/dist/styles/layout/index.js +88 -0
  434. package/dist/styles/mixins.js +43 -0
  435. package/dist/styles/shadow/cyber.js +19 -0
  436. package/dist/styles/shadow/deep.js +19 -0
  437. package/dist/styles/shadow/diffuse.js +19 -0
  438. package/dist/styles/shadow/flat.js +19 -0
  439. package/dist/styles/shadow/glassmorphism.js +19 -0
  440. package/dist/styles/shadow/index.js +129 -0
  441. package/dist/styles/shadow/neumorphism.js +21 -0
  442. package/dist/styles/shadow/retro.js +19 -0
  443. package/dist/styles/shadow/sharp-business.js +19 -0
  444. package/dist/styles/shadow/skeuomorphic.js +21 -0
  445. package/dist/styles/shape/chamfer.js +19 -0
  446. package/dist/styles/shape/circle.js +19 -0
  447. package/dist/styles/shape/index.js +174 -0
  448. package/dist/styles/shape/organic.js +19 -0
  449. package/dist/styles/shape/pill.js +19 -0
  450. package/dist/styles/shape/rounded.js +21 -0
  451. package/dist/styles/shape/rounder.js +19 -0
  452. package/dist/styles/shape/sharp.js +19 -0
  453. package/dist/styles/shape/smooth.js +19 -0
  454. package/dist/styles/theme/aliyun.d.ts +1 -1
  455. package/dist/styles/theme/aliyun.d.ts.map +1 -1
  456. package/dist/styles/theme/aliyun.js +102 -0
  457. package/dist/styles/theme/amber.d.ts +1 -1
  458. package/dist/styles/theme/amber.d.ts.map +1 -1
  459. package/dist/styles/theme/amber.js +101 -0
  460. package/dist/styles/theme/blue.d.ts +1 -1
  461. package/dist/styles/theme/blue.d.ts.map +1 -1
  462. package/dist/styles/theme/blue.js +101 -0
  463. package/dist/styles/theme/charcoal.d.ts +1 -1
  464. package/dist/styles/theme/charcoal.d.ts.map +1 -1
  465. package/dist/styles/theme/charcoal.js +106 -0
  466. package/dist/styles/theme/cyan.d.ts +1 -1
  467. package/dist/styles/theme/cyan.d.ts.map +1 -1
  468. package/dist/styles/theme/cyan.js +96 -0
  469. package/dist/styles/theme/dark.d.ts +1 -1
  470. package/dist/styles/theme/dark.d.ts.map +1 -1
  471. package/dist/styles/theme/dark.js +106 -0
  472. package/dist/styles/theme/ebony.d.ts +1 -1
  473. package/dist/styles/theme/ebony.d.ts.map +1 -1
  474. package/dist/styles/theme/ebony.js +106 -0
  475. package/dist/styles/theme/festive.d.ts +1 -1
  476. package/dist/styles/theme/festive.d.ts.map +1 -1
  477. package/dist/styles/theme/festive.js +101 -0
  478. package/dist/styles/theme/graphite.d.ts +1 -1
  479. package/dist/styles/theme/graphite.d.ts.map +1 -1
  480. package/dist/styles/theme/graphite.js +106 -0
  481. package/dist/styles/theme/gray.d.ts +1 -1
  482. package/dist/styles/theme/gray.d.ts.map +1 -1
  483. package/dist/styles/theme/gray.js +101 -0
  484. package/dist/styles/theme/huawei.d.ts +1 -1
  485. package/dist/styles/theme/huawei.d.ts.map +1 -1
  486. package/dist/styles/theme/huawei.js +102 -0
  487. package/dist/styles/theme/index.d.ts +1 -1
  488. package/dist/styles/theme/index.d.ts.map +1 -1
  489. package/dist/styles/theme/index.js +276 -0
  490. package/dist/styles/theme/indigo.d.ts +1 -1
  491. package/dist/styles/theme/indigo.d.ts.map +1 -1
  492. package/dist/styles/theme/indigo.js +101 -0
  493. package/dist/styles/theme/ink.d.ts +1 -1
  494. package/dist/styles/theme/ink.d.ts.map +1 -1
  495. package/dist/styles/theme/ink.js +106 -0
  496. package/dist/styles/theme/light.d.ts +1 -1
  497. package/dist/styles/theme/light.d.ts.map +1 -1
  498. package/dist/styles/theme/light.js +102 -0
  499. package/dist/styles/theme/midnight.d.ts +1 -1
  500. package/dist/styles/theme/midnight.d.ts.map +1 -1
  501. package/dist/styles/theme/midnight.js +106 -0
  502. package/dist/styles/theme/navy.d.ts +1 -1
  503. package/dist/styles/theme/navy.d.ts.map +1 -1
  504. package/dist/styles/theme/navy.js +106 -0
  505. package/dist/styles/theme/obsidian.d.ts +1 -1
  506. package/dist/styles/theme/obsidian.d.ts.map +1 -1
  507. package/dist/styles/theme/obsidian.js +106 -0
  508. package/dist/styles/theme/onyx.d.ts +1 -1
  509. package/dist/styles/theme/onyx.d.ts.map +1 -1
  510. package/dist/styles/theme/onyx.js +106 -0
  511. package/dist/styles/theme/orange.d.ts +1 -1
  512. package/dist/styles/theme/orange.d.ts.map +1 -1
  513. package/dist/styles/theme/orange.js +101 -0
  514. package/dist/styles/theme/pink.d.ts +1 -1
  515. package/dist/styles/theme/pink.d.ts.map +1 -1
  516. package/dist/styles/theme/pink.js +101 -0
  517. package/dist/styles/theme/purple.d.ts +1 -1
  518. package/dist/styles/theme/purple.d.ts.map +1 -1
  519. package/dist/styles/theme/purple.js +101 -0
  520. package/dist/styles/theme/raisin.d.ts +1 -1
  521. package/dist/styles/theme/raisin.d.ts.map +1 -1
  522. package/dist/styles/theme/raisin.js +106 -0
  523. package/dist/styles/theme/slate.d.ts +1 -1
  524. package/dist/styles/theme/slate.d.ts.map +1 -1
  525. package/dist/styles/theme/slate.js +106 -0
  526. package/dist/styles/theme/teal.d.ts +1 -1
  527. package/dist/styles/theme/teal.d.ts.map +1 -1
  528. package/dist/styles/theme/teal.js +101 -0
  529. package/dist/styles/theme/tianyi.d.ts +1 -1
  530. package/dist/styles/theme/tianyi.d.ts.map +1 -1
  531. package/dist/styles/theme/tianyi.js +102 -0
  532. package/dist/styles/types.js +1 -0
  533. package/dist/styles/typo/business.js +34 -0
  534. package/dist/styles/typo/compact.js +34 -0
  535. package/dist/styles/typo/index.js +99 -0
  536. package/dist/styles/typo/luxury.js +34 -0
  537. package/dist/styles/typo/minimal.js +34 -0
  538. package/dist/types/index.js +2 -0
  539. package/dist/utils/dom.js +51 -0
  540. package/dist/utils/events.js +32 -0
  541. package/dist/utils/icon.js +176 -0
  542. package/dist/utils/index.js +4 -0
  543. package/dist/utils/utils.d.ts +5 -5
  544. package/dist/utils/utils.js +89 -0
  545. package/dist/utils/validation.js +52 -0
  546. package/docs/api/basic/button.md +9 -6
  547. package/docs/api/basic/tag.md +24 -17
  548. package/docs/api/data/box-table.md +73 -0
  549. package/docs/api/data/dropdown.md +3 -2
  550. package/docs/api/data/metrics.md +2 -0
  551. package/docs/api/data/table-column.md +37 -23
  552. package/docs/api/data/table.md +158 -44
  553. package/docs/api/data/tabs.md +46 -1
  554. package/docs/api/data/tree-menu.md +55 -2
  555. package/docs/api/display/autoview.md +277 -0
  556. package/docs/api/display/box.md +66 -0
  557. package/docs/api/display/brief-box.md +73 -0
  558. package/docs/api/display/desc-item.md +57 -0
  559. package/docs/api/display/desc.md +246 -0
  560. package/docs/api/display/detail-box.md +75 -0
  561. package/docs/api/display/mini-box.md +100 -0
  562. package/docs/api/display/profile.md +92 -0
  563. package/docs/api/feedback/popover.md +10 -10
  564. package/docs/api/feedback/tooltip.md +14 -14
  565. package/docs/api/form/autoform-item.md +115 -0
  566. package/docs/api/form/autoform.md +7 -3
  567. package/docs/api/form/combobox.md +27 -7
  568. package/docs/api/form/select.md +50 -28
  569. package/docs/api/framework/log-panel.md +46 -0
  570. package/docs/api/framework/sidebar.md +3 -2
  571. package/docs/api/summary.md +46 -35
  572. package/docs/api/theme/theme-switch.md +1 -1
  573. package/docs/autoform.md +14 -33
  574. package/docs/changelog/CHANGELOG.md +155 -0
  575. package/docs/changelog/VERSION_26.3.1.md +966 -0
  576. package/docs/changelog/VERSION_26.3.2.md +852 -0
  577. package/docs/datahub.md +4 -1
  578. package/docs/filter.md +332 -0
  579. package/docs/framework-integration.md +2 -2
  580. package/docs/guide.md +72 -6
  581. package/docs/i18n.md +2 -4
  582. package/docs/issue/26.3.1/issue_26.3.1.0.md +84 -0
  583. package/docs/issue/26.3.1/issue_26.3.1.1.md +72 -0
  584. package/docs/issue/26.3.1/issue_26.3.1.2.md +75 -0
  585. package/docs/issue/26.3.1/issue_26.3.1.3.md +78 -0
  586. package/docs/issue/26.3.1/issue_26.3.1.4.md +113 -0
  587. package/docs/issue/26.3.1/issue_26.3.1.5.md +142 -0
  588. package/docs/issue/26.3.1/issue_26.3.1.6.md +100 -0
  589. package/docs/issue/26.3.1/issue_26.3.1.7.md +78 -0
  590. package/docs/issue/26.3.2/issue_26.3.2.1.md +46 -0
  591. package/docs/issue/26.3.2/issue_26.3.2.2.md +82 -0
  592. package/docs/issue/26.3.2/issue_26.3.2.3.md +57 -0
  593. package/docs/issue/26.3.2/issue_26.3.2.4.md +43 -0
  594. package/docs/issue/AGENTS.md +24 -3
  595. package/docs/markdown.md +2 -2
  596. package/docs/quickstart.md +5 -5
  597. package/docs/theming.md +5 -4
  598. package/package.json +5 -2
  599. package/dist/components/navigation/dropdown.d.ts +0 -56
  600. package/dist/components/navigation/dropdown.d.ts.map +0 -1
  601. /package/docs/issue/{issue_26.2.2.1.md → 26.2.2/issue_26.2.2.1.md} +0 -0
  602. /package/docs/issue/{issue_26.2.2.2.md → 26.2.2/issue_26.2.2.2.md} +0 -0
  603. /package/docs/issue/{issue_26.2.2.3.md → 26.2.2/issue_26.2.2.3.md} +0 -0
  604. /package/docs/issue/{issue_26.2.2.4.md → 26.2.2/issue_26.2.2.4.md} +0 -0
  605. /package/docs/issue/{issue_26.2.3.1.md → 26.2.3/issue_26.2.3.1.md} +0 -0
  606. /package/docs/issue/{issue_26.2.3.10.md → 26.2.3/issue_26.2.3.10.md} +0 -0
  607. /package/docs/issue/{issue_26.2.3.11.md → 26.2.3/issue_26.2.3.11.md} +0 -0
  608. /package/docs/issue/{issue_26.2.3.12.md → 26.2.3/issue_26.2.3.12.md} +0 -0
  609. /package/docs/issue/{issue_26.2.3.13.md → 26.2.3/issue_26.2.3.13.md} +0 -0
  610. /package/docs/issue/{issue_26.2.3.14.md → 26.2.3/issue_26.2.3.14.md} +0 -0
  611. /package/docs/issue/{issue_26.2.3.15.md → 26.2.3/issue_26.2.3.15.md} +0 -0
  612. /package/docs/issue/{issue_26.2.3.16.md → 26.2.3/issue_26.2.3.16.md} +0 -0
  613. /package/docs/issue/{issue_26.2.3.2.md → 26.2.3/issue_26.2.3.2.md} +0 -0
  614. /package/docs/issue/{issue_26.2.3.3.md → 26.2.3/issue_26.2.3.3.md} +0 -0
  615. /package/docs/issue/{issue_26.2.3.4.md → 26.2.3/issue_26.2.3.4.md} +0 -0
  616. /package/docs/issue/{issue_26.2.3.5.md → 26.2.3/issue_26.2.3.5.md} +0 -0
  617. /package/docs/issue/{issue_26.2.3.6.md → 26.2.3/issue_26.2.3.6.md} +0 -0
  618. /package/docs/issue/{issue_26.2.3.7.md → 26.2.3/issue_26.2.3.7.md} +0 -0
  619. /package/docs/issue/{issue_26.2.3.8.md → 26.2.3/issue_26.2.3.8.md} +0 -0
  620. /package/docs/issue/{issue_26.2.3.9.md → 26.2.3/issue_26.2.3.9.md} +0 -0
@@ -0,0 +1,1084 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ /**
8
+ * @file Dashboard 父组件 / Dashboard parent component
9
+ * @description 拖拽式仪表盘父组件,基于 CSS Grid 格子布局管理面板定位与尺寸。
10
+ * 支持面板拖拽换位、调整大小、显隐控制、锁定、状态持久化、自动重排。
11
+ * Drag-and-drop dashboard parent component using CSS Grid for panel positioning and sizing.
12
+ * Supports panel drag-swap, resize, visibility control, locking, state persistence, auto-rearrange.
13
+ */
14
+ import { css, html, nothing, unsafeCSS } from 'lit';
15
+ import { customElement, property, state, query } from 'lit/decorators.js';
16
+ import { AitheElement } from '../../core/aithe-element';
17
+ import { aitheBaseStyles } from '../../core/styles';
18
+ import { aitheThemeText } from '../../styles/theme';
19
+ import './dashboard-panel';
20
+ /** Storage key prefix for dashboard state. 仪表盘状态存储键前缀。 */
21
+ const STORAGE_KEY_PREFIX = 'aithe-dashboard-';
22
+ /** Default grid configuration constants. 默认网格配置常量。 */
23
+ const DEFAULT_COLUMNS = 12;
24
+ const DEFAULT_CELL_HEIGHT = 60;
25
+ const DEFAULT_GAP = 10;
26
+ /** Minimum panel size in grid units. 面板最小格子单位尺寸。 */
27
+ const MIN_PANEL_W = 1;
28
+ const MIN_PANEL_H = 1;
29
+ /**
30
+ * Drag-and-drop dashboard parent component. Uses CSS Grid for panel positioning.
31
+ * Manages all child panel layout, visibility, drag-swap, resize, auto-rearrange, and state persistence.
32
+ * The grid auto-fills the container width — cellWidth is computed from container width / columns.
33
+ *
34
+ * 拖拽式仪表盘父组件。使用 CSS Grid 管理面板定位,统一管理子面板布局、显隐、拖拽换位、
35
+ * 调整大小、自动重排和状态持久化。网格自动填充容器宽度——cellWidth 由容器宽度/列数计算。
36
+ *
37
+ * @slot - Default slot for dashboard-panel children. 默认插槽,放置 dashboard-panel 子组件。
38
+ * @slot toolbar - Slot for custom toolbar buttons (inserted at the left side of the toolbar). 工具栏插槽,用于插入自定义按钮(位于工具栏左侧)。
39
+ *
40
+ * @csspart toolbar - The header toolbar bar. 头部工具栏。
41
+ * @csspart grid - The CSS Grid container. CSS Grid 容器。
42
+ *
43
+ * @fires aithe-dashboard-change - Emitted when panel layout changes with `{ panels }`. 面板布局变更时发出。
44
+ * @fires aithe-dashboard-fullscreen - Emitted when fullscreen mode toggles with `{ fullscreen }`. 全屏模式切换时发出。
45
+ *
46
+ * @example
47
+ * ```html
48
+ * <aithe-dashboard columns="12" cell-height="60" gap="10">
49
+ * <aithe-dashboard-panel panel-id="stats" x="0" y="0" w="6" h="4" label="Statistics" icon="barChart">
50
+ * <p>Stats content</p>
51
+ * </aithe-dashboard-panel>
52
+ * </aithe-dashboard>
53
+ * ```
54
+ */
55
+ let AitheDashboard = class AitheDashboard extends AitheElement {
56
+ constructor() {
57
+ super(...arguments);
58
+ /** Total number of grid columns. 网格总列数。 */
59
+ this.columns = DEFAULT_COLUMNS;
60
+ /** Base cell height in pixels. 格子基础高度(像素)。 */
61
+ this.cellHeight = DEFAULT_CELL_HEIGHT;
62
+ /** Gap between grid cells in pixels. 格子间距(像素)。 */
63
+ this.gap = DEFAULT_GAP;
64
+ /** Whether the dashboard is locked (disables all drag and resize). 仪表盘是否锁定(禁用所有拖拽和调整大小)。 */
65
+ this.locked = false;
66
+ /** Storage key for persisting panel state. If empty, persistence is disabled. 状态持久化存储键,为空则禁用持久化。 */
67
+ this.storageKey = '';
68
+ /** Whether to show the built-in toolbar header. 是否显示内置工具栏头部。 */
69
+ this.showToolbar = true;
70
+ /** Whether to show the visibility dropdown button. 是否显示可见性下拉按钮。 */
71
+ this.showVisibility = true;
72
+ /** Whether to show the lock toggle button. 是否显示锁定切换按钮。 */
73
+ this.showLock = true;
74
+ /** Whether to show the reset button. 是否显示重置按钮。 */
75
+ this.showReset = true;
76
+ /** Whether to show the fullscreen toggle button. 是否显示全屏切换按钮。 */
77
+ this.showFullscreen = true;
78
+ /** Whether to show the theme picker button. 是否显示主题选择按钮。 */
79
+ this.showTheme = true;
80
+ /** Whether to show the auto-arrange button. 是否显示自动重排按钮。 */
81
+ this.showAutoArrange = true;
82
+ /** Whether to show the toggle content button. 是否显示内容切换按钮。 */
83
+ this.showToggleContent = true;
84
+ this.panelStates = new Map();
85
+ this.visibilityDropdownOpen = false;
86
+ this.fullscreen = false;
87
+ /** Whether the grid content area is visible. 网格内容区域是否可见。 */
88
+ this.showContent = true;
89
+ /** Internal theme for scoping theme changes to the dashboard only. 仅作用于仪表盘内部的本地主题。 */
90
+ this.dashboardTheme = '';
91
+ /** Computed cell width derived from container width / columns. 由容器宽度/列数计算的格子宽度。 */
92
+ this.computedCellWidth = 80;
93
+ /** Initial panel states from DOM attributes, used for reset. 从 DOM 属性读取的初始面板状态,用于重置。 */
94
+ this.initialPanelStates = new Map();
95
+ this.dragTargetId = '';
96
+ this.dragStartGridX = 0;
97
+ this.dragStartGridY = 0;
98
+ this.resizeTargetId = '';
99
+ this.resizeEdge = '';
100
+ this.resizeStartW = 0;
101
+ this.resizeStartH = 0;
102
+ this.resizeStartX = 0;
103
+ this.resizeStartY = 0;
104
+ this.resizeObserver = null;
105
+ this.handleSlotChange = () => {
106
+ this.syncPanelsFromDOM();
107
+ };
108
+ this.handlePanelClose = (event) => {
109
+ const customEvent = event;
110
+ const { panelId } = customEvent.detail;
111
+ this.updatePanelState(panelId, { visible: false });
112
+ this.emit('aithe-dashboard-change', { panels: this.getPanelStatesArray() });
113
+ };
114
+ this.handlePanelDragStart = (event) => {
115
+ if (this.locked)
116
+ return;
117
+ const customEvent = event;
118
+ this.dragTargetId = customEvent.detail.panelId;
119
+ const state = this.panelStates.get(this.dragTargetId);
120
+ if (state) {
121
+ this.dragStartGridX = state.x;
122
+ this.dragStartGridY = state.y;
123
+ }
124
+ };
125
+ this.handlePanelDrag = (event) => {
126
+ if (!this.dragTargetId || this.locked)
127
+ return;
128
+ const customEvent = event;
129
+ const { deltaX, deltaY } = customEvent.detail;
130
+ const state = this.panelStates.get(this.dragTargetId);
131
+ if (!state)
132
+ return;
133
+ const stepX = this.computedCellWidth + this.gap;
134
+ const stepY = this.cellHeight + this.gap;
135
+ const gridDeltaX = Math.round(deltaX / stepX);
136
+ const gridDeltaY = Math.round(deltaY / stepY);
137
+ const newX = this.clampX(this.dragStartGridX + gridDeltaX, state.w);
138
+ const newY = Math.max(0, this.dragStartGridY + gridDeltaY);
139
+ if (newX !== state.x || newY !== state.y) {
140
+ this.movePanelWithAutoRearrange(this.dragTargetId, newX, newY);
141
+ }
142
+ };
143
+ this.handlePanelDragEnd = () => {
144
+ this.dragTargetId = '';
145
+ };
146
+ this.handlePanelMaximize = (event) => {
147
+ const customEvent = event;
148
+ const { panelId } = customEvent.detail;
149
+ const state = this.panelStates.get(panelId);
150
+ if (!state)
151
+ return;
152
+ const newMaximized = !state.maximized;
153
+ this.updatePanelState(panelId, { maximized: newMaximized });
154
+ };
155
+ /** Handle panel resize start event. 处理面板调整大小开始事件。 */
156
+ this.handlePanelResizeStart = (event) => {
157
+ if (this.locked)
158
+ return;
159
+ const customEvent = event;
160
+ this.resizeTargetId = customEvent.detail.panelId;
161
+ this.resizeEdge = customEvent.detail.edge;
162
+ const state = this.panelStates.get(this.resizeTargetId);
163
+ if (state) {
164
+ this.resizeStartW = state.w;
165
+ this.resizeStartH = state.h;
166
+ this.resizeStartX = state.x;
167
+ this.resizeStartY = state.y;
168
+ }
169
+ };
170
+ /** Handle panel resize move event. Auto-rearranges overlapping panels like drag. 处理面板调整大小移动事件。与拖拽一样自动重排重叠面板。 */
171
+ this.handlePanelResize = (event) => {
172
+ if (!this.resizeTargetId || this.locked)
173
+ return;
174
+ const customEvent = event;
175
+ const { deltaX, deltaY } = customEvent.detail;
176
+ const state = this.panelStates.get(this.resizeTargetId);
177
+ if (!state)
178
+ return;
179
+ const stepX = this.computedCellWidth + this.gap;
180
+ const stepY = this.cellHeight + this.gap;
181
+ let newW = this.resizeStartW;
182
+ let newH = this.resizeStartH;
183
+ let newX = this.resizeStartX;
184
+ let newY = this.resizeStartY;
185
+ const edge = this.resizeEdge;
186
+ if (edge.includes('e')) {
187
+ newW = Math.max(MIN_PANEL_W, this.resizeStartW + Math.round(deltaX / stepX));
188
+ }
189
+ if (edge.includes('w')) {
190
+ const dw = Math.round(deltaX / stepX);
191
+ const proposedW = this.resizeStartW - dw;
192
+ if (proposedW >= MIN_PANEL_W) {
193
+ newW = proposedW;
194
+ newX = this.resizeStartX + dw;
195
+ }
196
+ }
197
+ if (edge.includes('s')) {
198
+ newH = Math.max(MIN_PANEL_H, this.resizeStartH + Math.round(deltaY / stepY));
199
+ }
200
+ if (edge.includes('n')) {
201
+ const dh = Math.round(deltaY / stepY);
202
+ const proposedH = this.resizeStartH - dh;
203
+ if (proposedH >= MIN_PANEL_H) {
204
+ newH = proposedH;
205
+ newY = this.resizeStartY + dh;
206
+ }
207
+ }
208
+ newX = this.clampX(newX, newW);
209
+ newW = Math.min(newW, this.columns - newX);
210
+ if (newW !== state.w || newH !== state.h || newX !== state.x || newY !== state.y) {
211
+ this.resizePanelWithAutoRearrange(this.resizeTargetId, newX, newY, newW, newH);
212
+ }
213
+ };
214
+ /** Handle panel resize end event. 处理面板调整大小结束事件。 */
215
+ this.handlePanelResizeEnd = () => {
216
+ this.resizeTargetId = '';
217
+ this.resizeEdge = '';
218
+ };
219
+ /**
220
+ * Auto-arrange all visible panels into a compact grid, scanning left-to-right top-to-bottom.
221
+ * 自动重排所有可见面板为紧凑网格,从左到右、从上到下扫描。
222
+ */
223
+ this.autoArrangeAll = () => {
224
+ const sorted = Array.from(this.panelStates.values())
225
+ .filter((s) => s.visible)
226
+ .sort((a, b) => a.y - b.y || a.x - b.x);
227
+ const arranged = new Map();
228
+ for (const panel of sorted) {
229
+ const pos = this.findNextAvailableSlotInMap(panel.w, panel.h, panel.panelId, arranged);
230
+ arranged.set(panel.panelId, { ...panel, x: pos.x, y: pos.y });
231
+ }
232
+ for (const [id, state] of this.panelStates) {
233
+ if (!state.visible) {
234
+ arranged.set(id, { ...state });
235
+ }
236
+ }
237
+ this.panelStates = arranged;
238
+ this.applyPanelAttributes();
239
+ this.saveState();
240
+ this.emit('aithe-dashboard-change', { panels: this.getPanelStatesArray() });
241
+ };
242
+ this.toggleLock = () => {
243
+ this.locked = !this.locked;
244
+ };
245
+ this.toggleVisibilityDropdown = () => {
246
+ this.visibilityDropdownOpen = !this.visibilityDropdownOpen;
247
+ };
248
+ this.togglePanelVisibility = (panelId) => {
249
+ const state = this.panelStates.get(panelId);
250
+ if (!state)
251
+ return;
252
+ this.updatePanelState(panelId, { visible: !state.visible });
253
+ this.emit('aithe-dashboard-change', { panels: this.getPanelStatesArray() });
254
+ };
255
+ /** Reset all panels to their initial DOM-defined positions and sizes. 重置所有面板到初始 DOM 定义的位置和尺寸。 */
256
+ this.resetToDefault = () => {
257
+ const map = new Map();
258
+ for (const [id, state] of this.initialPanelStates) {
259
+ map.set(id, { ...state });
260
+ }
261
+ this.panelStates = map;
262
+ this.applyPanelAttributes();
263
+ this.saveState();
264
+ this.emit('aithe-dashboard-change', { panels: this.getPanelStatesArray() });
265
+ };
266
+ /** Toggle dashboard fullscreen mode for big-screen display. 切换仪表盘全屏模式,用于大屏显示。 */
267
+ this.toggleFullscreen = () => {
268
+ this.fullscreen = !this.fullscreen;
269
+ if (this.fullscreen) {
270
+ this.setAttribute('fullscreen', '');
271
+ }
272
+ else {
273
+ this.removeAttribute('fullscreen');
274
+ }
275
+ this.emit('aithe-dashboard-fullscreen', { fullscreen: this.fullscreen });
276
+ };
277
+ /** Handle theme change from the theme picker. Scoped to dashboard only — prevents global theme switch and applies data-aithe-theme on the internal wrapper. 处理主题选择器的主题变更。仅作用于仪表盘内部——阻止全局主题切换,并在内部容器上设置 data-aithe-theme。 */
278
+ this.handleThemeChange = (event) => {
279
+ event.preventDefault();
280
+ const customEvent = event;
281
+ this.dashboardTheme = customEvent.detail.theme;
282
+ };
283
+ this.handleDocClick = (event) => {
284
+ if (!this.visibilityDropdownEl) {
285
+ this.visibilityDropdownOpen = false;
286
+ return;
287
+ }
288
+ const path = event.composedPath();
289
+ if (!path.includes(this.visibilityDropdownEl)) {
290
+ this.visibilityDropdownOpen = false;
291
+ }
292
+ };
293
+ }
294
+ static { this.styles = [
295
+ unsafeCSS(aitheThemeText),
296
+ aitheBaseStyles,
297
+ css `
298
+ :host {
299
+ display: block;
300
+ position: relative;
301
+ width: 100%;
302
+ }
303
+
304
+ :host([fullscreen]) {
305
+ position: fixed;
306
+ top: 0;
307
+ left: 0;
308
+ width: 100vw;
309
+ height: 100vh;
310
+ z-index: 9999;
311
+ background: var(--aithe-color-surface, #fff);
312
+ }
313
+
314
+ :host([fullscreen]) .dashboard-wrapper {
315
+ height: 100vh;
316
+ }
317
+
318
+ .dashboard-wrapper {
319
+ display: flex;
320
+ flex-direction: column;
321
+ height: 100%;
322
+ }
323
+
324
+ .toolbar {
325
+ display: flex;
326
+ align-items: center;
327
+ gap: var(--aithe-space-2, 8px);
328
+ padding: var(--aithe-space-2, 8px) var(--aithe-space-3, 12px);
329
+ border-bottom: 1px solid var(--aithe-color-border, #e5e7eb);
330
+ background: var(--aithe-color-surface, #fff);
331
+ flex-shrink: 0;
332
+ }
333
+
334
+ .toolbar-slot {
335
+ display: inline-flex;
336
+ align-items: center;
337
+ gap: var(--aithe-space-2, 8px);
338
+ margin-right: auto;
339
+ }
340
+
341
+ .toolbar-group {
342
+ display: flex;
343
+ align-items: center;
344
+ gap: var(--aithe-space-2, 8px);
345
+ }
346
+
347
+ .toolbar-btn {
348
+ display: inline-flex;
349
+ align-items: center;
350
+ justify-content: center;
351
+ width: 32px;
352
+ height: 32px;
353
+ border: 1px solid var(--aithe-color-border, #e5e7eb);
354
+ border-radius: var(--aithe-radius-md, 6px);
355
+ background: var(--aithe-color-surface, #fff);
356
+ color: var(--aithe-color-text, #1a1a1a);
357
+ cursor: pointer;
358
+ transition:
359
+ background 0.15s,
360
+ border-color 0.15s;
361
+ white-space: nowrap;
362
+ }
363
+
364
+ .toolbar-btn:hover {
365
+ border-color: var(--aithe-primary-6, #1677ff);
366
+ color: var(--aithe-primary-6, #1677ff);
367
+ }
368
+
369
+ .toolbar-btn.active {
370
+ background: var(--aithe-primary-6, #1677ff);
371
+ border-color: var(--aithe-primary-6, #1677ff);
372
+ color: var(--aithe-color-text-on-primary, #fff);
373
+ }
374
+
375
+ .visibility-dropdown {
376
+ position: relative;
377
+ }
378
+
379
+ .dropdown-menu {
380
+ position: absolute;
381
+ top: 100%;
382
+ right: 0;
383
+ margin-top: var(--aithe-space-1, 4px);
384
+ min-width: 200px;
385
+ padding: var(--aithe-space-2, 8px) 0;
386
+ border: 1px solid var(--aithe-color-border, #e5e7eb);
387
+ border-radius: var(--aithe-radius-lg, 12px);
388
+ background: var(--aithe-color-surface-elevated, #fff);
389
+ box-shadow: var(--aithe-shadow-3, 0 4px 16px rgba(0, 0, 0, 0.12));
390
+ z-index: 100;
391
+ }
392
+
393
+ .dropdown-item {
394
+ display: flex;
395
+ align-items: center;
396
+ gap: var(--aithe-space-2, 8px);
397
+ width: 100%;
398
+ padding: var(--aithe-space-2, 8px) var(--aithe-space-3, 12px);
399
+ border: none;
400
+ background: transparent;
401
+ color: var(--aithe-color-text, #1a1a1a);
402
+ font-size: var(--aithe-font-size-sm, 14px);
403
+ text-align: left;
404
+ cursor: pointer;
405
+ transition: background 0.15s;
406
+ }
407
+
408
+ .dropdown-item:hover {
409
+ background: var(--aithe-color-surface-muted, #f3f4f6);
410
+ }
411
+
412
+ .dropdown-item input[type='checkbox'] {
413
+ accent-color: var(--aithe-primary-6, #1677ff);
414
+ }
415
+
416
+ .grid-container {
417
+ position: relative;
418
+ min-height: 200px;
419
+ flex: 1;
420
+ background: var(--aithe-color-bg, #f5f5f5);
421
+ border-radius: var(--aithe-container-radius-lg, 12px);
422
+ box-sizing: border-box;
423
+ transition:
424
+ opacity var(--aithe-duration-slow, 0.3s) var(--aithe-ease-standard, ease),
425
+ padding-top var(--aithe-duration-slow, 0.3s) var(--aithe-ease-standard, ease),
426
+ padding-bottom var(--aithe-duration-slow, 0.3s) var(--aithe-ease-standard, ease),
427
+ min-height var(--aithe-duration-slow, 0.3s) var(--aithe-ease-standard, ease);
428
+ }
429
+
430
+ ::slotted(aithe-dashboard-panel) {
431
+ position: absolute;
432
+ transition:
433
+ left var(--aithe-duration-base, 0.2s) var(--aithe-ease-standard, ease),
434
+ top var(--aithe-duration-base, 0.2s) var(--aithe-ease-standard, ease),
435
+ width var(--aithe-duration-base, 0.2s) var(--aithe-ease-standard, ease),
436
+ height var(--aithe-duration-base, 0.2s) var(--aithe-ease-standard, ease);
437
+ }
438
+
439
+ ::slotted(aithe-dashboard-panel[maximized]) {
440
+ position: absolute !important;
441
+ top: 0 !important;
442
+ left: 0 !important;
443
+ width: 100% !important;
444
+ height: 100% !important;
445
+ z-index: 20;
446
+ }
447
+
448
+ .grid-container.collapsed {
449
+ min-height: 0 !important;
450
+ padding-top: 0 !important;
451
+ padding-bottom: 0 !important;
452
+ border: none;
453
+ opacity: 0;
454
+ overflow: hidden;
455
+ flex: 0 0 0;
456
+ border-radius: 0;
457
+ }
458
+
459
+ @media (max-width: 768px) {
460
+ .grid-container {
461
+ position: static !important;
462
+ min-height: 0 !important;
463
+ }
464
+
465
+ ::slotted(aithe-dashboard-panel) {
466
+ position: static !important;
467
+ width: 100% !important;
468
+ left: auto !important;
469
+ top: auto !important;
470
+ height: auto !important;
471
+ margin-bottom: var(--aithe-space-3, 12px);
472
+ transition: none !important;
473
+ }
474
+
475
+ ::slotted(aithe-dashboard-panel[maximized]) {
476
+ position: static !important;
477
+ width: 100% !important;
478
+ height: auto !important;
479
+ z-index: auto;
480
+ }
481
+ }
482
+ `,
483
+ ]; }
484
+ connectedCallback() {
485
+ super.connectedCallback();
486
+ this.addEventListener('aithe-panel-close', this.handlePanelClose);
487
+ this.addEventListener('aithe-panel-drag-start', this.handlePanelDragStart);
488
+ this.addEventListener('aithe-panel-drag', this.handlePanelDrag);
489
+ this.addEventListener('aithe-panel-drag-end', this.handlePanelDragEnd);
490
+ this.addEventListener('aithe-panel-maximize', this.handlePanelMaximize);
491
+ this.addEventListener('aithe-panel-resize-start', this.handlePanelResizeStart);
492
+ this.addEventListener('aithe-panel-resize', this.handlePanelResize);
493
+ this.addEventListener('aithe-panel-resize-end', this.handlePanelResizeEnd);
494
+ document.addEventListener('click', this.handleDocClick);
495
+ this.restoreState();
496
+ this.setupResizeObserver();
497
+ }
498
+ disconnectedCallback() {
499
+ super.disconnectedCallback();
500
+ this.removeEventListener('aithe-panel-close', this.handlePanelClose);
501
+ this.removeEventListener('aithe-panel-drag-start', this.handlePanelDragStart);
502
+ this.removeEventListener('aithe-panel-drag', this.handlePanelDrag);
503
+ this.removeEventListener('aithe-panel-drag-end', this.handlePanelDragEnd);
504
+ this.removeEventListener('aithe-panel-maximize', this.handlePanelMaximize);
505
+ this.removeEventListener('aithe-panel-resize-start', this.handlePanelResizeStart);
506
+ this.removeEventListener('aithe-panel-resize', this.handlePanelResize);
507
+ this.removeEventListener('aithe-panel-resize-end', this.handlePanelResizeEnd);
508
+ document.removeEventListener('click', this.handleDocClick);
509
+ this.resizeObserver?.disconnect();
510
+ }
511
+ updated(changed) {
512
+ if (changed.has('columns') || changed.has('cellHeight') || changed.has('gap')) {
513
+ this.recalcCellWidth();
514
+ this.applyPanelAttributes();
515
+ }
516
+ if (changed.has('locked')) {
517
+ this.applyPanelAttributes();
518
+ }
519
+ }
520
+ /** Setup ResizeObserver to recalculate cell width when container resizes. 设置 ResizeObserver 以在容器尺寸变化时重新计算格子宽度。 */
521
+ setupResizeObserver() {
522
+ this.resizeObserver = new ResizeObserver(() => {
523
+ this.recalcCellWidth();
524
+ this.applyPanelAttributes();
525
+ });
526
+ this.resizeObserver.observe(this);
527
+ }
528
+ /** Recalculate cellWidth from container width. 根据容器宽度重新计算格子宽度。 */
529
+ recalcCellWidth() {
530
+ const container = this.gridContainer;
531
+ if (!container)
532
+ return;
533
+ const style = globalThis.getComputedStyle(container);
534
+ const paddingLeft = Number.parseFloat(style.paddingLeft) || 0;
535
+ const paddingRight = Number.parseFloat(style.paddingRight) || 0;
536
+ const containerWidth = container.clientWidth - paddingLeft - paddingRight;
537
+ if (containerWidth > 0 && this.columns > 0) {
538
+ this.computedCellWidth = Math.max(1, (containerWidth - (this.columns - 1) * this.gap) / this.columns);
539
+ }
540
+ }
541
+ syncPanelsFromDOM() {
542
+ const panels = this.querySelectorAll('aithe-dashboard-panel');
543
+ const existingIds = new Set(this.panelStates.keys());
544
+ const domIds = new Set();
545
+ for (const panel of panels) {
546
+ const el = panel;
547
+ const id = el.getAttribute('panel-id') || '';
548
+ if (!id)
549
+ continue;
550
+ domIds.add(id);
551
+ const hasExplicitX = el.hasAttribute('x');
552
+ const hasExplicitY = el.hasAttribute('y');
553
+ const rawX = Number.parseInt(el.getAttribute('x') || '0', 10);
554
+ const rawY = Number.parseInt(el.getAttribute('y') || '0', 10);
555
+ const rawW = Number.parseInt(el.getAttribute('w') || '1', 10);
556
+ const rawH = Number.parseInt(el.getAttribute('h') || '1', 10);
557
+ const domState = {
558
+ panelId: id,
559
+ label: el.getAttribute('label') || id,
560
+ x: rawX,
561
+ y: rawY,
562
+ w: rawW,
563
+ h: rawH,
564
+ visible: el.getAttribute('visible') !== 'false',
565
+ maximized: false,
566
+ };
567
+ if (!this.panelStates.has(id)) {
568
+ if (!hasExplicitX && !hasExplicitY) {
569
+ const pos = this.findNextAvailableSlot(rawW, rawH, id);
570
+ domState.x = pos.x;
571
+ domState.y = pos.y;
572
+ }
573
+ this.panelStates.set(id, { ...domState });
574
+ }
575
+ if (!this.initialPanelStates.has(id)) {
576
+ this.initialPanelStates.set(id, { ...domState });
577
+ }
578
+ }
579
+ for (const id of existingIds) {
580
+ if (!domIds.has(id)) {
581
+ this.panelStates.delete(id);
582
+ this.initialPanelStates.delete(id);
583
+ }
584
+ }
585
+ this.panelStates = new Map(this.panelStates);
586
+ this.recalcCellWidth();
587
+ this.applyPanelAttributes();
588
+ }
589
+ applyPanelAttributes() {
590
+ const panels = this.querySelectorAll('aithe-dashboard-panel');
591
+ for (const panel of panels) {
592
+ const el = panel;
593
+ const id = el.getAttribute('panel-id') || '';
594
+ const state = this.panelStates.get(id);
595
+ if (!state)
596
+ continue;
597
+ if (this.locked) {
598
+ el.setAttribute('locked', '');
599
+ }
600
+ else {
601
+ el.removeAttribute('locked');
602
+ }
603
+ if (state.maximized) {
604
+ el.setAttribute('maximized', '');
605
+ }
606
+ else {
607
+ el.removeAttribute('maximized');
608
+ }
609
+ if (state.visible) {
610
+ el.removeAttribute('hidden');
611
+ }
612
+ else {
613
+ el.setAttribute('hidden', '');
614
+ }
615
+ if (state.maximized) {
616
+ el.style.position = 'absolute';
617
+ el.style.top = '0';
618
+ el.style.left = '0';
619
+ el.style.width = '100%';
620
+ el.style.height = '100%';
621
+ el.style.zIndex = '20';
622
+ }
623
+ else {
624
+ const margin = this.outerMargin;
625
+ const left = margin + state.x * (this.computedCellWidth + this.gap);
626
+ const top = margin + state.y * (this.cellHeight + this.gap);
627
+ const width = state.w * this.computedCellWidth + (state.w - 1) * this.gap;
628
+ const height = state.h * this.cellHeight + (state.h - 1) * this.gap;
629
+ el.style.position = 'absolute';
630
+ el.style.left = `${left}px`;
631
+ el.style.top = `${top}px`;
632
+ el.style.width = `${width}px`;
633
+ el.style.height = `${height}px`;
634
+ el.style.zIndex = '';
635
+ }
636
+ }
637
+ this.updateGridHeight();
638
+ }
639
+ updateGridHeight() {
640
+ if (!this.showContent) {
641
+ if (this.gridContainer) {
642
+ this.gridContainer.style.height = '0';
643
+ this.gridContainer.style.minHeight = '0';
644
+ }
645
+ return;
646
+ }
647
+ const margin = this.outerMargin;
648
+ let maxBottom = 0;
649
+ for (const state of this.panelStates.values()) {
650
+ if (!state.visible || state.maximized)
651
+ continue;
652
+ const bottom = margin + (state.y + state.h) * this.cellHeight + (state.y + state.h - 1) * this.gap;
653
+ if (bottom > maxBottom)
654
+ maxBottom = bottom;
655
+ }
656
+ if (this.gridContainer) {
657
+ const h = Math.max(maxBottom + margin, 200);
658
+ this.gridContainer.style.height = '';
659
+ this.gridContainer.style.minHeight = `${h}px`;
660
+ }
661
+ }
662
+ updatePanelState(panelId, partial) {
663
+ const current = this.panelStates.get(panelId);
664
+ if (!current)
665
+ return;
666
+ const updated = { ...current, ...partial };
667
+ this.panelStates.set(panelId, updated);
668
+ this.panelStates = new Map(this.panelStates);
669
+ this.applyPanelAttributes();
670
+ this.saveState();
671
+ }
672
+ clampX(x, w) {
673
+ return Math.max(0, Math.min(x, this.columns - w));
674
+ }
675
+ /**
676
+ * Move a panel to new position and auto-rearrange overlapping panels.
677
+ * When the moving panel overlaps another, push the overlapped panel to the next available position.
678
+ * 移动面板到新位置并自动重排重叠面板。当移动面板与另一面板重叠时,将被重叠面板推到下一个可用位置。
679
+ */
680
+ movePanelWithAutoRearrange(movingId, newX, newY) {
681
+ const moving = this.panelStates.get(movingId);
682
+ if (!moving)
683
+ return;
684
+ const clampedX = this.clampX(newX, moving.w);
685
+ const clampedY = Math.max(0, newY);
686
+ this.panelStates.set(movingId, { ...moving, x: clampedX, y: clampedY });
687
+ const overlapped = this.findAllOverlapping(clampedX, clampedY, moving.w, moving.h, movingId);
688
+ for (const overlapId of overlapped) {
689
+ this.pushPanelDown(overlapId, clampedX, clampedY, moving.w, moving.h);
690
+ }
691
+ this.panelStates = new Map(this.panelStates);
692
+ this.applyPanelAttributes();
693
+ this.saveState();
694
+ }
695
+ /** Find all panels overlapping the given rect. 查找与给定矩形重叠的所有面板。 */
696
+ findAllOverlapping(x, y, w, h, excludeId) {
697
+ const result = [];
698
+ for (const [id, state] of this.panelStates) {
699
+ if (id === excludeId || !state.visible || state.maximized)
700
+ continue;
701
+ const overlapsX = x < state.x + state.w && x + w > state.x;
702
+ const overlapsY = y < state.y + state.h && y + h > state.y;
703
+ if (overlapsX && overlapsY) {
704
+ result.push(id);
705
+ }
706
+ }
707
+ return result;
708
+ }
709
+ /**
710
+ * Push an overlapped panel to the first available position below the moving panel.
711
+ * 将被重叠的面板推到移动面板下方的第一个可用位置。
712
+ */
713
+ pushPanelDown(panelId, moverX, moverY, moverW, moverH) {
714
+ const state = this.panelStates.get(panelId);
715
+ if (!state)
716
+ return;
717
+ const targetY = moverY + moverH;
718
+ let foundY = targetY;
719
+ let testY = targetY;
720
+ let attempts = 0;
721
+ const maxAttempts = 100;
722
+ while (attempts < maxAttempts) {
723
+ const overlapping = this.findAllOverlapping(state.x, testY, state.w, state.h, panelId);
724
+ const hasConflict = overlapping.length > 0;
725
+ if (!hasConflict) {
726
+ foundY = testY;
727
+ break;
728
+ }
729
+ testY++;
730
+ attempts++;
731
+ }
732
+ this.panelStates.set(panelId, { ...state, x: state.x, y: foundY });
733
+ }
734
+ /**
735
+ * Find the next available grid slot for a panel of given size, scanning left-to-right top-to-bottom.
736
+ * 为给定尺寸的面板查找下一个可用网格位置,从左到右、从上到下扫描。
737
+ */
738
+ findNextAvailableSlot(w, h, excludeId) {
739
+ const maxY = 100;
740
+ for (let y = 0; y <= maxY; y++) {
741
+ for (let x = 0; x <= this.columns - w; x++) {
742
+ const overlapping = this.findAllOverlapping(x, y, w, h, excludeId);
743
+ if (overlapping.length === 0) {
744
+ return { x, y };
745
+ }
746
+ }
747
+ }
748
+ return { x: 0, y: maxY };
749
+ }
750
+ /** Like findNextAvailableSlot but checks against a provided Map instead of this.panelStates. 与 findNextAvailableSlot 类似,但检查提供的 Map 而非 this.panelStates。 */
751
+ findNextAvailableSlotInMap(w, h, excludeId, map) {
752
+ const maxY = 100;
753
+ for (let y = 0; y <= maxY; y++) {
754
+ for (let x = 0; x <= this.columns - w; x++) {
755
+ const overlapping = this.findAllOverlappingInMap(x, y, w, h, excludeId, map);
756
+ if (overlapping.length === 0) {
757
+ return { x, y };
758
+ }
759
+ }
760
+ }
761
+ return { x: 0, y: maxY };
762
+ }
763
+ /** Like findAllOverlapping but checks against a provided Map. 与 findAllOverlapping 类似,但检查提供的 Map。 */
764
+ findAllOverlappingInMap(x, y, w, h, excludeId, map) {
765
+ const result = [];
766
+ for (const [id, state] of map) {
767
+ if (id === excludeId || !state.visible || state.maximized)
768
+ continue;
769
+ const overlapsX = x < state.x + state.w && x + w > state.x;
770
+ const overlapsY = y < state.y + state.h && y + h > state.y;
771
+ if (overlapsX && overlapsY) {
772
+ result.push(id);
773
+ }
774
+ }
775
+ return result;
776
+ }
777
+ /**
778
+ * Resize a panel to new position/size and auto-rearrange overlapping panels.
779
+ * When the resized panel overlaps another, push the overlapped panel to the next available position.
780
+ * 调整面板到新位置/尺寸并自动重排重叠面板。当调整后的面板与另一面板重叠时,将被重叠面板推到下一个可用位置。
781
+ */
782
+ resizePanelWithAutoRearrange(resizeId, newX, newY, newW, newH) {
783
+ const resizing = this.panelStates.get(resizeId);
784
+ if (!resizing)
785
+ return;
786
+ const clampedX = this.clampX(newX, newW);
787
+ const clampedY = Math.max(0, newY);
788
+ const clampedW = Math.max(MIN_PANEL_W, Math.min(newW, this.columns - clampedX));
789
+ const clampedH = Math.max(MIN_PANEL_H, newH);
790
+ this.panelStates.set(resizeId, {
791
+ ...resizing,
792
+ x: clampedX,
793
+ y: clampedY,
794
+ w: clampedW,
795
+ h: clampedH,
796
+ });
797
+ const overlapped = this.findAllOverlapping(clampedX, clampedY, clampedW, clampedH, resizeId);
798
+ for (const overlapId of overlapped) {
799
+ this.pushPanelDown(overlapId, clampedX, clampedY, clampedW, clampedH);
800
+ }
801
+ this.panelStates = new Map(this.panelStates);
802
+ this.applyPanelAttributes();
803
+ this.saveState();
804
+ }
805
+ swapPanels(sourceId, targetId) {
806
+ const source = this.panelStates.get(sourceId);
807
+ const target = this.panelStates.get(targetId);
808
+ if (!source || !target)
809
+ return;
810
+ const sourceX = source.x;
811
+ const sourceY = source.y;
812
+ this.panelStates.set(sourceId, { ...source, x: target.x, y: target.y });
813
+ this.panelStates.set(targetId, { ...target, x: sourceX, y: sourceY });
814
+ this.panelStates = new Map(this.panelStates);
815
+ this.applyPanelAttributes();
816
+ this.saveState();
817
+ }
818
+ getPanelStatesArray() {
819
+ return Array.from(this.panelStates.values());
820
+ }
821
+ getStorageFullKey() {
822
+ return this.storageKey ? `${STORAGE_KEY_PREFIX}${this.storageKey}` : '';
823
+ }
824
+ saveState() {
825
+ const key = this.getStorageFullKey();
826
+ if (!key)
827
+ return;
828
+ try {
829
+ const data = JSON.stringify(this.getPanelStatesArray());
830
+ globalThis.localStorage?.setItem(key, data);
831
+ }
832
+ catch {
833
+ // Storage unavailable or quota exceeded
834
+ }
835
+ }
836
+ restoreState() {
837
+ const key = this.getStorageFullKey();
838
+ if (!key)
839
+ return;
840
+ try {
841
+ const raw = globalThis.localStorage?.getItem(key);
842
+ if (!raw)
843
+ return;
844
+ const arr = JSON.parse(raw);
845
+ const map = new Map();
846
+ for (const item of arr) {
847
+ map.set(item.panelId, item);
848
+ }
849
+ this.panelStates = map;
850
+ }
851
+ catch {
852
+ // Storage unavailable or parse error
853
+ }
854
+ }
855
+ /** Render visibility dropdown button. 渲染可见性下拉按钮。 */
856
+ renderVisibilityBtn(allPanels) {
857
+ if (!this.showVisibility)
858
+ return nothing;
859
+ return html `
860
+ <div class="visibility-dropdown">
861
+ <button
862
+ class="toolbar-btn"
863
+ type="button"
864
+ @click=${this.toggleVisibilityDropdown}
865
+ title="Visibility"
866
+ >
867
+ <aithe-icon name="eye" size="14"></aithe-icon>
868
+ </button>
869
+ ${this.visibilityDropdownOpen
870
+ ? html `
871
+ <div class="dropdown-menu">
872
+ ${allPanels.map((state) => html `
873
+ <label class="dropdown-item">
874
+ <input
875
+ type="checkbox"
876
+ .checked=${state.visible}
877
+ @change=${() => this.togglePanelVisibility(state.panelId)}
878
+ />
879
+ <span>${state.label || state.panelId}</span>
880
+ </label>
881
+ `)}
882
+ </div>
883
+ `
884
+ : nothing}
885
+ </div>
886
+ `;
887
+ }
888
+ /** Render reset button. 渲染重置按钮。 */
889
+ renderResetBtn() {
890
+ if (!this.showReset)
891
+ return nothing;
892
+ return html `
893
+ <button
894
+ class="toolbar-btn"
895
+ type="button"
896
+ @click=${this.resetToDefault}
897
+ title="Reset to default"
898
+ >
899
+ <aithe-icon name="refresh" size="14"></aithe-icon>
900
+ </button>
901
+ `;
902
+ }
903
+ /** Render lock toggle button. 渲染锁定切换按钮。 */
904
+ renderLockBtn() {
905
+ if (!this.showLock)
906
+ return nothing;
907
+ const lockIcon = this.locked ? 'lock' : 'unlock';
908
+ const lockTitle = this.locked ? 'Unlock' : 'Lock';
909
+ return html `
910
+ <button
911
+ class="toolbar-btn ${this.locked ? 'active' : ''}"
912
+ type="button"
913
+ @click=${this.toggleLock}
914
+ title=${lockTitle}
915
+ >
916
+ <aithe-icon name=${lockIcon} size="14"></aithe-icon>
917
+ </button>
918
+ `;
919
+ }
920
+ /** Render fullscreen toggle button. 渲染全屏切换按钮。 */
921
+ renderFullscreenBtn() {
922
+ if (!this.showFullscreen)
923
+ return nothing;
924
+ const fsIcon = this.fullscreen ? 'minimize' : 'maximize';
925
+ const fsTitle = this.fullscreen ? 'Exit fullscreen' : 'Fullscreen';
926
+ return html `
927
+ <button
928
+ class="toolbar-btn ${this.fullscreen ? 'active' : ''}"
929
+ type="button"
930
+ @click=${this.toggleFullscreen}
931
+ title=${fsTitle}
932
+ >
933
+ <aithe-icon name=${fsIcon} size="14"></aithe-icon>
934
+ </button>
935
+ `;
936
+ }
937
+ /** Render theme picker button. 渲染主题选择按钮。 */
938
+ renderThemeBtn() {
939
+ if (!this.showTheme)
940
+ return nothing;
941
+ return html `
942
+ <aithe-theme-picker
943
+ .value=${(this.computedTheme) || 'light'}
944
+ placement="bottom-end"
945
+ icon-only
946
+ @aithe-theme-change=${this.handleThemeChange}
947
+ ></aithe-theme-picker>
948
+ `;
949
+ }
950
+ /** Render auto-arrange button. 渲染自动重排按钮。 */
951
+ renderAutoArrangeBtn() {
952
+ if (!this.showAutoArrange)
953
+ return nothing;
954
+ return html `
955
+ <button
956
+ class="toolbar-btn"
957
+ type="button"
958
+ @click=${this.autoArrangeAll}
959
+ title="Auto arrange"
960
+ >
961
+ <aithe-icon name="autoArrange" size="14"></aithe-icon>
962
+ </button>
963
+ `;
964
+ }
965
+ /** Render toggle content button. 渲染内容切换按钮。 */
966
+ renderToggleContentBtn() {
967
+ if (!this.showToggleContent)
968
+ return nothing;
969
+ const icon = this.showContent ? 'chevronUp' : 'chevronDown';
970
+ const title = this.showContent ? 'Collapse content' : 'Expand content';
971
+ return html `
972
+ <button
973
+ class="toolbar-btn toggle-content-btn"
974
+ type="button"
975
+ @click=${() => { this.showContent = !this.showContent; }}
976
+ title=${title}
977
+ >
978
+ <aithe-icon name=${icon} size="14"></aithe-icon>
979
+ </button>
980
+ `;
981
+ }
982
+ renderToolbar() {
983
+ if (!this.showToolbar)
984
+ return nothing;
985
+ const allPanels = Array.from(this.panelStates.values());
986
+ return html `
987
+ <div class="toolbar" part="toolbar">
988
+ <div class="toolbar-slot">
989
+ <slot name="toolbar"></slot>
990
+ </div>
991
+ <div class="toolbar-group">
992
+ ${this.renderAutoArrangeBtn()} ${this.renderVisibilityBtn(allPanels)}
993
+ ${this.renderResetBtn()} ${this.renderLockBtn()} ${this.renderFullscreenBtn()}
994
+ ${this.renderThemeBtn()}
995
+ </div>
996
+ <div class="toolbar-group">
997
+ ${this.renderToggleContentBtn()}
998
+ </div>
999
+ </div>
1000
+ `;
1001
+ }
1002
+ /** Compute outer margin for grid container (gap, minimum 20px). 计算网格容器外边距(gap,最小 20px)。 */
1003
+ get outerMargin() {
1004
+ return Math.max(this.gap, 10);
1005
+ }
1006
+ render() {
1007
+ return html `
1008
+ <div class="dashboard-wrapper" data-aithe-theme=${this.dashboardTheme || this.computedTheme}>
1009
+ ${this.renderToolbar()}
1010
+ <div
1011
+ class="grid-container ${this.showContent ? '' : 'collapsed'}"
1012
+ part="grid"
1013
+ style="padding:${this.outerMargin}px"
1014
+ >
1015
+ <slot @slotchange=${this.handleSlotChange}></slot>
1016
+ </div>
1017
+ </div>
1018
+ `;
1019
+ }
1020
+ };
1021
+ __decorate([
1022
+ property({ type: Number, attribute: 'columns' })
1023
+ ], AitheDashboard.prototype, "columns", void 0);
1024
+ __decorate([
1025
+ property({ type: Number, attribute: 'cell-height' })
1026
+ ], AitheDashboard.prototype, "cellHeight", void 0);
1027
+ __decorate([
1028
+ property({ type: Number })
1029
+ ], AitheDashboard.prototype, "gap", void 0);
1030
+ __decorate([
1031
+ property({ type: Boolean, reflect: true })
1032
+ ], AitheDashboard.prototype, "locked", void 0);
1033
+ __decorate([
1034
+ property({ type: String, attribute: 'storage-key' })
1035
+ ], AitheDashboard.prototype, "storageKey", void 0);
1036
+ __decorate([
1037
+ property({ type: Boolean, attribute: 'show-toolbar' })
1038
+ ], AitheDashboard.prototype, "showToolbar", void 0);
1039
+ __decorate([
1040
+ property({ type: Boolean, attribute: 'show-visibility' })
1041
+ ], AitheDashboard.prototype, "showVisibility", void 0);
1042
+ __decorate([
1043
+ property({ type: Boolean, attribute: 'show-lock' })
1044
+ ], AitheDashboard.prototype, "showLock", void 0);
1045
+ __decorate([
1046
+ property({ type: Boolean, attribute: 'show-reset' })
1047
+ ], AitheDashboard.prototype, "showReset", void 0);
1048
+ __decorate([
1049
+ property({ type: Boolean, attribute: 'show-fullscreen' })
1050
+ ], AitheDashboard.prototype, "showFullscreen", void 0);
1051
+ __decorate([
1052
+ property({ type: Boolean, attribute: 'show-theme' })
1053
+ ], AitheDashboard.prototype, "showTheme", void 0);
1054
+ __decorate([
1055
+ property({ type: Boolean, attribute: 'show-auto-arrange' })
1056
+ ], AitheDashboard.prototype, "showAutoArrange", void 0);
1057
+ __decorate([
1058
+ property({ type: Boolean, attribute: 'show-toggle-content' })
1059
+ ], AitheDashboard.prototype, "showToggleContent", void 0);
1060
+ __decorate([
1061
+ state()
1062
+ ], AitheDashboard.prototype, "panelStates", void 0);
1063
+ __decorate([
1064
+ state()
1065
+ ], AitheDashboard.prototype, "visibilityDropdownOpen", void 0);
1066
+ __decorate([
1067
+ state()
1068
+ ], AitheDashboard.prototype, "fullscreen", void 0);
1069
+ __decorate([
1070
+ state()
1071
+ ], AitheDashboard.prototype, "showContent", void 0);
1072
+ __decorate([
1073
+ state()
1074
+ ], AitheDashboard.prototype, "dashboardTheme", void 0);
1075
+ __decorate([
1076
+ query('.grid-container')
1077
+ ], AitheDashboard.prototype, "gridContainer", void 0);
1078
+ __decorate([
1079
+ query('.visibility-dropdown')
1080
+ ], AitheDashboard.prototype, "visibilityDropdownEl", void 0);
1081
+ AitheDashboard = __decorate([
1082
+ customElement('aithe-dashboard')
1083
+ ], AitheDashboard);
1084
+ export { AitheDashboard };