hys-ui 0.6.0 → 0.8.0

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 (268) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/LICENSE +19 -0
  3. package/dist/components/HysDataGrid/HysDataGrid.vue.js +1 -1
  4. package/dist/components/HysDataGrid/HysDataGrid2.vue.js +1055 -753
  5. package/dist/components/HysDataGrid/gridColumnLayout.js +46 -0
  6. package/dist/components/HysDataGrid/gridPresentation.js +17 -0
  7. package/dist/components/HysDataGrid/useGridContextMenu.js +33 -0
  8. package/dist/components/HysDatePicker/HysDatePicker.vue.js +102 -48
  9. package/dist/components/HysDatePicker/HysDatePickerControl.vue.js +2 -2
  10. package/dist/components/HysDatePicker/HysDatePickerControl2.vue.js +874 -532
  11. package/dist/components/HysDatePicker/HysDatePickerPanel.vue.js +2 -2
  12. package/dist/components/HysDatePicker/HysDatePickerPanel2.vue.js +209 -168
  13. package/dist/components/HysDateRangePicker/HysDateRangePicker.vue.js +102 -48
  14. package/dist/components/HysDescriptions/HysDescriptions.vue.js +7 -0
  15. package/dist/components/HysDescriptions/HysDescriptions2.vue.js +146 -0
  16. package/dist/components/HysForm/HysForm2.vue.js +9 -8
  17. package/dist/components/HysIcon/HysIcon.vue.js +373 -0
  18. package/dist/components/HysIcon/HysIcon2.vue.js +5 -0
  19. package/dist/components/HysIcon/IconGraphic/IconGraphic.vue.js +147 -0
  20. package/dist/components/HysIcon/IconGraphic/IconGraphic2.vue.js +4 -0
  21. package/dist/components/HysIcon/IconPickerPanel/IconPickerPanel.vue.js +7 -0
  22. package/dist/components/HysIcon/IconPickerPanel/IconPickerPanel2.vue.js +440 -0
  23. package/dist/components/HysIcon/IconReferenceGraphic/IconReferenceGraphic.vue.js +29 -0
  24. package/dist/components/HysIcon/IconReferenceGraphic/IconReferenceGraphic2.vue.js +4 -0
  25. package/dist/components/HysIcon/IconTooltip/IconTooltip.vue.js +19 -0
  26. package/dist/components/HysIcon/IconTooltip/IconTooltip2.vue.js +4 -0
  27. package/dist/components/HysIcon/builtins/access.js +180 -0
  28. package/dist/components/HysIcon/builtins/actions.js +327 -0
  29. package/dist/components/HysIcon/builtins/business.js +364 -0
  30. package/dist/components/HysIcon/builtins/catalog/access-1.json.js +51 -0
  31. package/dist/components/HysIcon/builtins/catalog/access-2.json.js +35 -0
  32. package/dist/components/HysIcon/builtins/catalog/accessibility.json.js +26 -0
  33. package/dist/components/HysIcon/builtins/catalog/arrows-1.json.js +45 -0
  34. package/dist/components/HysIcon/builtins/catalog/arrows-2.json.js +46 -0
  35. package/dist/components/HysIcon/builtins/catalog/arrows-3.json.js +42 -0
  36. package/dist/components/HysIcon/builtins/catalog/charts-1.json.js +50 -0
  37. package/dist/components/HysIcon/builtins/catalog/charts-2.json.js +13 -0
  38. package/dist/components/HysIcon/builtins/catalog/commerce.json.js +43 -0
  39. package/dist/components/HysIcon/builtins/catalog/communication-1.json.js +49 -0
  40. package/dist/components/HysIcon/builtins/catalog/communication-2.json.js +37 -0
  41. package/dist/components/HysIcon/builtins/catalog/design-1.json.js +61 -0
  42. package/dist/components/HysIcon/builtins/catalog/design-2.json.js +27 -0
  43. package/dist/components/HysIcon/builtins/catalog/development-1.json.js +58 -0
  44. package/dist/components/HysIcon/builtins/catalog/development-2.json.js +60 -0
  45. package/dist/components/HysIcon/builtins/catalog/development-3.json.js +25 -0
  46. package/dist/components/HysIcon/builtins/catalog/devices-1.json.js +52 -0
  47. package/dist/components/HysIcon/builtins/catalog/devices-2.json.js +55 -0
  48. package/dist/components/HysIcon/builtins/catalog/devices-3.json.js +23 -0
  49. package/dist/components/HysIcon/builtins/catalog/education.json.js +34 -0
  50. package/dist/components/HysIcon/builtins/catalog/emoji.json.js +24 -0
  51. package/dist/components/HysIcon/builtins/catalog/files-1.json.js +45 -0
  52. package/dist/components/HysIcon/builtins/catalog/files-2.json.js +47 -0
  53. package/dist/components/HysIcon/builtins/catalog/files-3.json.js +8 -0
  54. package/dist/components/HysIcon/builtins/catalog/food-1.json.js +67 -0
  55. package/dist/components/HysIcon/builtins/catalog/food-2.json.js +40 -0
  56. package/dist/components/HysIcon/builtins/catalog/home.json.js +36 -0
  57. package/dist/components/HysIcon/builtins/catalog/layout-1.json.js +46 -0
  58. package/dist/components/HysIcon/builtins/catalog/layout-2.json.js +45 -0
  59. package/dist/components/HysIcon/builtins/catalog/manifest.json.js +4 -0
  60. package/dist/components/HysIcon/builtins/catalog/maps-1.json.js +61 -0
  61. package/dist/components/HysIcon/builtins/catalog/maps-2.json.js +24 -0
  62. package/dist/components/HysIcon/builtins/catalog/media-1.json.js +57 -0
  63. package/dist/components/HysIcon/builtins/catalog/media-2.json.js +13 -0
  64. package/dist/components/HysIcon/builtins/catalog/medical.json.js +30 -0
  65. package/dist/components/HysIcon/builtins/catalog/nature.json.js +54 -0
  66. package/dist/components/HysIcon/builtins/catalog/recreation.json.js +51 -0
  67. package/dist/components/HysIcon/builtins/catalog/shapes.json.js +54 -0
  68. package/dist/components/HysIcon/builtins/catalog/text-1.json.js +52 -0
  69. package/dist/components/HysIcon/builtins/catalog/text-2.json.js +54 -0
  70. package/dist/components/HysIcon/builtins/catalog/text-3.json.js +58 -0
  71. package/dist/components/HysIcon/builtins/catalog/text-4.json.js +41 -0
  72. package/dist/components/HysIcon/builtins/catalog/time.json.js +39 -0
  73. package/dist/components/HysIcon/builtins/catalog/transport-1.json.js +57 -0
  74. package/dist/components/HysIcon/builtins/catalog/transport-2.json.js +7 -0
  75. package/dist/components/HysIcon/builtins/catalog/weather.json.js +46 -0
  76. package/dist/components/HysIcon/builtins/communication.js +314 -0
  77. package/dist/components/HysIcon/builtins/documents.js +315 -0
  78. package/dist/components/HysIcon/builtins/extendedCatalog.js +75 -0
  79. package/dist/components/HysIcon/builtins/iconInCategory.js +11 -0
  80. package/dist/components/HysIcon/builtins/media.js +255 -0
  81. package/dist/components/HysIcon/builtins/navigation.js +276 -0
  82. package/dist/components/HysIcon/builtins/technology.js +189 -0
  83. package/dist/components/HysIcon/iconBuiltins.js +228 -0
  84. package/dist/components/HysIcon/iconConfig.js +30 -0
  85. package/dist/components/HysIcon/iconRegistry.js +183 -0
  86. package/dist/components/HysIcon/iconSafety.js +191 -0
  87. package/dist/components/HysIcon/iconStyle.js +70 -0
  88. package/dist/components/HysIcon/useIconResource.js +75 -0
  89. package/dist/components/HysPopconfirm/HysPopconfirm.vue.js +7 -0
  90. package/dist/components/HysPopconfirm/HysPopconfirm2.vue.js +346 -0
  91. package/dist/components/HysPopconfirm/usePopconfirmAction.js +32 -0
  92. package/dist/components/HysResult/HysResult.vue.js +7 -0
  93. package/dist/components/HysResult/HysResult2.vue.js +124 -0
  94. package/dist/components/HysSpace/HysSpace.vue.js +7 -0
  95. package/dist/components/HysSpace/HysSpace2.vue.js +79 -0
  96. package/dist/components/HysSpace/spaceItems.js +17 -0
  97. package/dist/components/HysSpin/HysSpin.vue.js +7 -0
  98. package/dist/components/HysSpin/HysSpin2.vue.js +427 -0
  99. package/dist/components/HysSpin/SpinGlyph/SpinGlyph.vue.js +334 -0
  100. package/dist/components/HysSpin/SpinGlyph/SpinGlyph2.vue.js +5 -0
  101. package/dist/components/HysSpin/SpinPortal/SpinPortal.vue.js +7 -0
  102. package/dist/components/HysSpin/SpinPortal/SpinPortal2.vue.js +66 -0
  103. package/dist/components/HysSpin/SpinPortal/spinTarget.js +57 -0
  104. package/dist/components/HysSpin/spinCatalog.js +35 -0
  105. package/dist/components/HysSpin/spinConfig.js +32 -0
  106. package/dist/components/HysSpin/spinService.js +160 -0
  107. package/dist/components/HysSpin/spinStyle.js +39 -0
  108. package/dist/components/HysSpin/useHysSpinTask.js +92 -0
  109. package/dist/components/HysSpin/useSpinFullscreen.js +60 -0
  110. package/dist/components/HysSpin/useSpinVisibility.js +59 -0
  111. package/dist/components/HysSplitPane/HysSplitPane.vue.js +285 -204
  112. package/dist/components/HysSplitPane/splitPaneResize.js +75 -0
  113. package/dist/components/HysTabPane/HysTabPane.vue.js +49 -0
  114. package/dist/components/HysTabPane/HysTabPane2.vue.js +4 -0
  115. package/dist/components/HysTable/HysTable.vue.js +3 -3
  116. package/dist/components/HysTable/HysTable2.vue.js +412 -383
  117. package/dist/components/HysTable/tableSearch.js +24 -0
  118. package/dist/components/HysTabs/HysTabs.vue.js +172 -5
  119. package/dist/components/HysTabs/HysTabs2.vue.js +2 -275
  120. package/dist/components/HysTabs/TabsMore/TabsMore.vue.js +7 -0
  121. package/dist/components/HysTabs/TabsMore/TabsMore2.vue.js +133 -0
  122. package/dist/components/HysTabs/TabsPanels/TabsPanels.vue.js +161 -0
  123. package/dist/components/HysTabs/TabsPanels/TabsPanels2.vue.js +4 -0
  124. package/dist/components/HysTabs/TabsPrompts/TabsPrompts.vue.js +4 -0
  125. package/dist/components/HysTabs/TabsPrompts/TabsPrompts2.vue.js +88 -0
  126. package/dist/components/HysTabs/TabsSlot/TabsSlot.js +13 -0
  127. package/dist/components/HysTabs/TabsWorkbench/TabsWorkbench.vue.js +7 -0
  128. package/dist/components/HysTabs/TabsWorkbench/TabsWorkbench2.vue.js +687 -0
  129. package/dist/components/HysTabs/tabsConfig.js +35 -0
  130. package/dist/components/HysTabs/tabsItems.js +79 -0
  131. package/dist/components/HysTabs/tabsPersistence.js +118 -0
  132. package/dist/components/HysTabs/useHysRouteTabs.js +77 -0
  133. package/dist/components/HysTabs/useTabsDragGhost.js +47 -0
  134. package/dist/components/HysTabs/useTabsNav.js +127 -0
  135. package/dist/components/HysTabs/useTabsOverlays.js +52 -0
  136. package/dist/components/HysTabs/useTabsPanels.js +101 -0
  137. package/dist/components/HysTabs/useTabsPointer.js +131 -0
  138. package/dist/components/HysTabs/useTabsState.js +263 -0
  139. package/dist/composables/datePicker.js +153 -94
  140. package/dist/composables/datePickerModel.js +156 -0
  141. package/dist/composables/datePickerPanels.js +78 -0
  142. package/dist/composables/datePickerRules.js +166 -0
  143. package/dist/composables/floatingPosition.js +32 -13
  144. package/dist/composables/formLayout.js +20 -42
  145. package/dist/composables/popupSurfaceStyle.js +30 -0
  146. package/dist/composables/useContainerWidth.js +24 -0
  147. package/dist/composables/useDatePicker.js +274 -381
  148. package/dist/composables/useFloating.js +42 -41
  149. package/dist/composables/usePageVisibility.js +19 -0
  150. package/dist/composables/usePopupSurface.js +153 -162
  151. package/dist/composables/usePopupSurfaceInteractions.js +91 -90
  152. package/dist/composables/useSplitPaneDrag.js +29 -26
  153. package/dist/composables/useSvgInstanceId.js +15 -0
  154. package/dist/composables/useTable.js +321 -306
  155. package/dist/composables/useTabularRowNavigation.js +46 -0
  156. package/dist/index.js +229 -185
  157. package/dist/internal/MultiSplitPane.vue.js +246 -205
  158. package/dist/internal/PopupSurfacePanel.vue.js +2 -2
  159. package/dist/internal/PopupSurfacePanel2.vue.js +35 -30
  160. package/dist/style.css +1 -1
  161. package/dist/types/components/HysDataGrid/HysDataGrid.vue.d.ts +40 -2
  162. package/dist/types/components/HysDataGrid/gridColumnLayout.d.ts +22 -0
  163. package/dist/types/components/HysDataGrid/gridPresentation.d.ts +47 -0
  164. package/dist/types/components/HysDataGrid/useGridContextMenu.d.ts +14 -0
  165. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +6 -9
  166. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +12 -0
  167. package/dist/types/components/HysDatePicker/HysDatePickerPanel.vue.d.ts +6 -0
  168. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +6 -9
  169. package/dist/types/components/HysDescriptions/HysDescriptions.vue.d.ts +20 -0
  170. package/dist/types/components/HysDescriptions/descriptionsTypes.d.ts +54 -0
  171. package/dist/types/components/HysForm/HysForm.vue.d.ts +1 -1
  172. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
  173. package/dist/types/components/HysIcon/HysIcon.vue.d.ts +76 -0
  174. package/dist/types/components/HysIcon/IconGraphic/IconGraphic.vue.d.ts +43 -0
  175. package/dist/types/components/HysIcon/IconPickerPanel/IconPickerPanel.vue.d.ts +17 -0
  176. package/dist/types/components/HysIcon/IconReferenceGraphic/IconReferenceGraphic.vue.d.ts +10 -0
  177. package/dist/types/components/HysIcon/IconTooltip/IconTooltip.vue.d.ts +11 -0
  178. package/dist/types/components/HysIcon/builtins/access.d.ts +15 -0
  179. package/dist/types/components/HysIcon/builtins/actions.d.ts +30 -0
  180. package/dist/types/components/HysIcon/builtins/business.d.ts +31 -0
  181. package/dist/types/components/HysIcon/builtins/communication.d.ts +27 -0
  182. package/dist/types/components/HysIcon/builtins/documents.d.ts +29 -0
  183. package/dist/types/components/HysIcon/builtins/extendedCatalog.d.ts +2 -0
  184. package/dist/types/components/HysIcon/builtins/iconInCategory.d.ts +2 -0
  185. package/dist/types/components/HysIcon/builtins/media.d.ts +24 -0
  186. package/dist/types/components/HysIcon/builtins/navigation.d.ts +30 -0
  187. package/dist/types/components/HysIcon/builtins/technology.d.ts +18 -0
  188. package/dist/types/components/HysIcon/iconBuiltins.d.ts +2 -0
  189. package/dist/types/components/HysIcon/iconConfig.d.ts +10 -0
  190. package/dist/types/components/HysIcon/iconRegistry.d.ts +5 -0
  191. package/dist/types/components/HysIcon/iconSafety.d.ts +8 -0
  192. package/dist/types/components/HysIcon/iconStyle.d.ts +6 -0
  193. package/dist/types/components/HysIcon/iconTypes.d.ts +192 -0
  194. package/dist/types/components/HysIcon/useIconResource.d.ts +14 -0
  195. package/dist/types/components/HysPopconfirm/HysPopconfirm.vue.d.ts +85 -0
  196. package/dist/types/components/HysPopconfirm/popconfirmTypes.d.ts +72 -0
  197. package/dist/types/components/HysPopconfirm/usePopconfirmAction.d.ts +6 -0
  198. package/dist/types/components/HysProgress/HysProgress.vue.d.ts +1 -1
  199. package/dist/types/components/HysResult/HysResult.vue.d.ts +22 -0
  200. package/dist/types/components/HysResult/resultTypes.d.ts +32 -0
  201. package/dist/types/components/HysSpace/HysSpace.vue.d.ts +15 -0
  202. package/dist/types/components/HysSpace/spaceItems.d.ts +9 -0
  203. package/dist/types/components/HysSpace/spaceTypes.d.ts +20 -0
  204. package/dist/types/components/HysSpin/HysSpin.vue.d.ts +84 -0
  205. package/dist/types/components/HysSpin/SpinGlyph/SpinGlyph.vue.d.ts +16 -0
  206. package/dist/types/components/HysSpin/SpinPortal/SpinPortal.vue.d.ts +21 -0
  207. package/dist/types/components/HysSpin/SpinPortal/spinTarget.d.ts +3 -0
  208. package/dist/types/components/HysSpin/spinCatalog.d.ts +122 -0
  209. package/dist/types/components/HysSpin/spinConfig.d.ts +10 -0
  210. package/dist/types/components/HysSpin/spinService.d.ts +7 -0
  211. package/dist/types/components/HysSpin/spinStyle.d.ts +5 -0
  212. package/dist/types/components/HysSpin/spinTypes.d.ts +133 -0
  213. package/dist/types/components/HysSpin/useHysSpinTask.d.ts +4 -0
  214. package/dist/types/components/HysSpin/useSpinFullscreen.d.ts +17 -0
  215. package/dist/types/components/HysSpin/useSpinVisibility.d.ts +10 -0
  216. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +25 -2
  217. package/dist/types/components/HysSplitPane/splitPaneResize.d.ts +17 -0
  218. package/dist/types/components/HysTabPane/HysTabPane.vue.d.ts +11 -0
  219. package/dist/types/components/HysTable/HysTable.vue.d.ts +16 -10
  220. package/dist/types/components/HysTable/tableSearch.d.ts +2 -0
  221. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +83 -74
  222. package/dist/types/components/HysTabs/TabsMore/TabsMore.vue.d.ts +14 -0
  223. package/dist/types/components/HysTabs/TabsPanels/TabsPanels.vue.d.ts +17 -0
  224. package/dist/types/components/HysTabs/TabsPrompts/TabsPrompts.vue.d.ts +7 -0
  225. package/dist/types/components/HysTabs/TabsSlot/TabsSlot.d.ts +9 -0
  226. package/dist/types/components/HysTabs/TabsWorkbench/TabsWorkbench.vue.d.ts +32 -0
  227. package/dist/types/components/HysTabs/tabsConfig.d.ts +4 -0
  228. package/dist/types/components/HysTabs/tabsItems.d.ts +14 -0
  229. package/dist/types/components/HysTabs/tabsPersistence.d.ts +6 -0
  230. package/dist/types/components/HysTabs/tabsTypes.d.ts +236 -0
  231. package/dist/types/components/HysTabs/useHysRouteTabs.d.ts +22 -0
  232. package/dist/types/components/HysTabs/useTabsDragGhost.d.ts +22 -0
  233. package/dist/types/components/HysTabs/useTabsNav.d.ts +20 -0
  234. package/dist/types/components/HysTabs/useTabsOverlays.d.ts +54 -0
  235. package/dist/types/components/HysTabs/useTabsPanels.d.ts +14 -0
  236. package/dist/types/components/HysTabs/useTabsPointer.d.ts +30 -0
  237. package/dist/types/components/HysTabs/useTabsState.d.ts +32 -0
  238. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +2 -2
  239. package/dist/types/components/HysToast/toastPresentation.d.ts +1 -1
  240. package/dist/types/components/HysVirtualTable/HysVirtualTable.vue.d.ts +2 -2
  241. package/dist/types/composables/dataGrid.d.ts +34 -0
  242. package/dist/types/composables/datePicker.d.ts +14 -214
  243. package/dist/types/composables/datePickerModel.d.ts +63 -0
  244. package/dist/types/composables/datePickerPanels.d.ts +23 -0
  245. package/dist/types/composables/datePickerRules.d.ts +31 -0
  246. package/dist/types/composables/datePickerTypes.d.ts +277 -0
  247. package/dist/types/composables/floatingPosition.d.ts +1 -1
  248. package/dist/types/composables/formLayout.d.ts +1 -2
  249. package/dist/types/composables/popupSurfaceStyle.d.ts +7 -0
  250. package/dist/types/composables/table.d.ts +10 -1
  251. package/dist/types/composables/toastQueue.d.ts +4 -4
  252. package/dist/types/composables/toastQueueModel.d.ts +2 -2
  253. package/dist/types/composables/useColorPicker.d.ts +2 -4
  254. package/dist/types/composables/useContainerWidth.d.ts +2 -0
  255. package/dist/types/composables/useContextMenu.d.ts +2 -4
  256. package/dist/types/composables/useDatePicker.d.ts +20 -11
  257. package/dist/types/composables/useFloating.d.ts +4 -5
  258. package/dist/types/composables/usePageVisibility.d.ts +1 -0
  259. package/dist/types/composables/usePopupSurface.d.ts +9 -3
  260. package/dist/types/composables/usePopupSurfaceInteractions.d.ts +4 -2
  261. package/dist/types/composables/useSplitPaneDrag.d.ts +2 -2
  262. package/dist/types/composables/useSvgInstanceId.d.ts +1 -0
  263. package/dist/types/composables/useTable.d.ts +2 -0
  264. package/dist/types/composables/useTabularRowNavigation.d.ts +18 -0
  265. package/dist/types/index.d.ts +31 -3
  266. package/dist/types/internal/MultiSplitPane.vue.d.ts +10 -1
  267. package/dist/types/internal/PopupSurfacePanel.vue.d.ts +3 -0
  268. package/package.json +1 -1
@@ -1,46 +1,63 @@
1
- import { defineComponent as xa, ref as w, useId as Vt, computed as c, shallowRef as Me, watch as L, onMounted as za, onDeactivated as Ra, onBeforeUnmount as Ma, openBlock as s, createElementBlock as u, mergeProps as Ta, unref as m, createElementVNode as y, createVNode as g, createTextVNode as V, createCommentVNode as h, withCtx as z, toDisplayString as O, createBlock as D, normalizeStyle as $, normalizeClass as ve, Fragment as N, renderList as ye, withModifiers as q, withKeys as nt, renderSlot as $e, resolveDynamicComponent as Dt, nextTick as pe } from "vue";
2
- import { Settings2 as Ea, ChevronUp as Ka, ChevronDown as it, Search as Aa, ChevronRight as Ft } from "lucide-vue-next";
3
- import { useHysRootAttrs as Va } from "../../config.js";
4
- import Da from "../../motion/PopupMotion.js";
5
- import { useMotion as Fa } from "../../motion/useMotion.js";
6
- import { gridRows as La, gridValue as me, gridTree as Oa, gridToken as st, positiveInteger as Te, gridKey as Na } from "../../composables/dataGrid.js";
7
- import { useDataGridRemote as qa } from "../../composables/useDataGridRemote.js";
8
- import Ba from "../HysSortableList/HysSortableList.vue.js";
9
- import Lt from "../HysSelect/HysSelect.vue.js";
10
- import Ie from "../HysInput/HysInput.vue.js";
11
- import rt from "../HysCheckbox/HysCheckbox.vue.js";
12
- import Ha from "../HysRadio/HysRadio.vue.js";
13
- import T from "../HysButton/HysButton.vue.js";
14
- import Ua from "../HysPagination/HysPagination.vue.js";
15
- const $a = ["aria-busy"], Ia = { class: "hys-ui-pf-grid-toolbar" }, ja = { class: "hys-ui-pf-grid-search" }, Pa = {
1
+ import { defineComponent as ia, ref as C, useId as ol, computed as f, shallowRef as Ge, watch as F, onMounted as ra, onDeactivated as sa, onBeforeUnmount as ua, openBlock as r, createElementBlock as d, mergeProps as ee, unref as v, createElementVNode as y, createVNode as k, createTextVNode as T, createCommentVNode as g, withCtx as M, toDisplayString as z, createBlock as D, renderSlot as $, normalizeStyle as I, normalizeClass as pe, Fragment as N, renderList as te, withModifiers as U, withKeys as nl, resolveDynamicComponent as il, nextTick as ye } from "vue";
2
+ import { Settings2 as da, ChevronUp as ca, ChevronDown as St, Search as fa, Ellipsis as va, ChevronRight as rl } from "lucide-vue-next";
3
+ import { useHysRootAttrs as pa } from "../../config.js";
4
+ import ya from "../../motion/PopupMotion.js";
5
+ import { useMotion as ga } from "../../motion/useMotion.js";
6
+ import { gridRows as ma, gridValue as Ne, gridTree as ha, gridToken as W, positiveInteger as xt, gridKey as ba } from "../../composables/dataGrid.js";
7
+ import { useDataGridRemote as ka } from "../../composables/useDataGridRemote.js";
8
+ import { useTabularRowNavigation as wa } from "../../composables/useTabularRowNavigation.js";
9
+ import { normalizeGridColumnLayout as sl, gridMaxColumnWidth as ul, gridMinColumnWidth as dl, gridBoundColumnWidth as at } from "./gridColumnLayout.js";
10
+ import { gridHeaderGroups as Ca } from "./gridPresentation.js";
11
+ import { useGridContextMenu as Sa } from "./useGridContextMenu.js";
12
+ import xa from "../HysContextMenu/HysContextMenu.vue.js";
13
+ import Ra from "../HysSortableList/HysSortableList.vue.js";
14
+ import cl from "../HysSelect/HysSelect.vue.js";
15
+ import ot from "../HysInput/HysInput.vue.js";
16
+ import Rt from "../HysCheckbox/HysCheckbox.vue.js";
17
+ import Ma from "../HysRadio/HysRadio.vue.js";
18
+ import B from "../HysButton/HysButton.vue.js";
19
+ import za from "../HysPagination/HysPagination.vue.js";
20
+ const Ka = ["aria-busy"], Ta = { class: "hys-ui-pf-grid-toolbar" }, Da = { class: "hys-ui-pf-grid-search" }, Ea = {
16
21
  key: 0,
17
22
  class: "hys-ui-pf-grid-group-label"
18
- }, Qa = {
23
+ }, Na = {
19
24
  key: 1,
20
25
  class: "hys-ui-pf-grid-batch"
21
- }, Wa = { class: "hys-ui-pf-grid-count" }, Ja = {
26
+ }, Ba = { class: "hys-ui-pf-grid-count" }, Aa = {
22
27
  key: 0,
23
28
  class: "hys-ui-pf-grid-panel"
24
- }, Xa = {
29
+ }, La = { key: 0 }, Va = { key: 1 }, Oa = {
25
30
  key: 0,
26
- style: { width: "44px" }
27
- }, Ga = {
31
+ class: "hys-ui-pf-grid-header-groups"
32
+ }, Fa = {
33
+ key: 0,
34
+ class: "hys-ui-pf-grid-select-col"
35
+ }, qa = ["scope", "colspan"], Ha = {
28
36
  key: 0,
29
37
  scope: "col",
30
38
  class: "hys-ui-pf-grid-select-col"
31
- }, Ya = { key: 1 }, Za = ["data-column-key", "data-drop-position", "draggable", "onDragstart", "onDragover", "onDrop", "aria-sort"], _a = { class: "hys-ui-pf-grid-head" }, el = { class: "hys-ui-pf-grid-sort-group" }, tl = { class: "hys-ui-pf-grid-sort-label" }, al = ["aria-label"], ll = ["aria-label", "onPointerdown", "aria-valuemin", "aria-valuemax", "aria-valuenow", "onKeydown"], ol = ["id"], nl = {
39
+ }, $a = { key: 1 }, Ia = ["tabindex", "data-column-key", "data-drop-position", "draggable", "onDragstart", "onDragover", "onDrop", "onClick", "onContextmenu", "onKeydown", "aria-sort"], Ua = { class: "hys-ui-pf-grid-head" }, Pa = { class: "hys-ui-pf-grid-sort-label" }, ja = {
40
+ key: 1,
41
+ class: "hys-ui-pf-grid-sort-label"
42
+ }, Ga = ["aria-label"], Qa = ["aria-label", "onPointerdown", "aria-valuemin", "aria-valuemax", "aria-valuenow", "onKeydown"], Wa = ["id"], Ja = {
32
43
  key: 0,
33
44
  class: "hys-ui-pf-grid-select-col"
34
- }, il = ["data-filter-key", "data-column-key"], sl = { key: 0 }, rl = ["colspan"], ul = { role: "status" }, dl = { key: 1 }, cl = ["colspan"], fl = {
45
+ }, Xa = ["data-filter-key", "data-column-key"], Ya = { key: 0 }, Za = ["colspan"], _a = {
46
+ class: "hys-ui-pf-grid-state",
47
+ role: "status"
48
+ }, eo = { key: 1 }, to = ["colspan"], lo = { class: "hys-ui-pf-grid-state" }, ao = {
35
49
  key: 0,
36
50
  class: "hys-ui-pf-grid-group-row"
37
- }, vl = ["colspan"], yl = ["data-grid-row", "onClick"], pl = {
51
+ }, oo = ["colspan"], no = {
52
+ key: 0,
53
+ class: "hys-ui-pf-grid-group-summary"
54
+ }, io = { key: 0 }, ro = ["data-grid-row", "aria-current", "onClick", "onDblclick", "onContextmenu"], so = {
38
55
  key: 0,
39
56
  class: "hys-ui-pf-grid-select-col"
40
- }, ml = ["data-column-key", "title"], gl = ["onDblclick"], hl = { key: 0 }, kl = ["colspan"], bl = { key: 0 }, wl = { class: "hys-ui-pf-grid-summary-row" }, Sl = {
57
+ }, uo = ["data-column-key", "tabindex", "title", "onClick", "onDblclick", "onContextmenu", "onKeydown"], co = ["inert"], fo = { key: 0 }, vo = ["colspan"], po = { class: "hys-ui-pf-grid-state" }, yo = { key: 2 }, go = { class: "hys-ui-pf-grid-summary-row" }, mo = {
41
58
  key: 0,
42
59
  class: "hys-ui-pf-grid-select-col"
43
- }, Cl = ["data-column-key"], xl = { class: "hys-ui-pf-grid-footer" }, Bl = /* @__PURE__ */ xa({
60
+ }, ho = ["data-column-key"], bo = { class: "hys-ui-pf-grid-footer" }, qo = /* @__PURE__ */ ia({
44
61
  __name: "HysDataGrid",
45
62
  props: {
46
63
  columns: {},
@@ -69,300 +86,369 @@ const $a = ["aria-busy"], Ia = { class: "hys-ui-pf-grid-toolbar" }, ja = { class
69
86
  maxHeight: {},
70
87
  scrollToTopOnQuery: { type: Boolean },
71
88
  groupable: { type: Boolean },
89
+ groupBy: {},
90
+ defaultGroupBy: {},
91
+ groupSummary: { type: Boolean },
72
92
  showSummary: { type: Boolean },
93
+ summaryScope: { default: "filtered" },
73
94
  summaryMethod: {},
74
95
  treeMode: { type: Boolean },
75
96
  parentKey: { default: "parentId" },
76
97
  editable: { type: Boolean },
98
+ keyboardNavigation: { type: Boolean },
99
+ caption: {},
100
+ striped: { type: Boolean },
101
+ highlightCurrentRow: { type: Boolean },
102
+ currentRowKey: {},
103
+ defaultCurrentRowKey: {},
104
+ rowClassName: {},
105
+ rowStyle: {},
106
+ cellClassName: {},
107
+ cellStyle: {},
108
+ headerClassName: {},
109
+ headerStyle: {},
110
+ contextMenu: { type: [Boolean, Function] },
77
111
  popupTransition: {},
78
112
  popupTransitionDuration: {}
79
113
  },
80
- emits: ["rowClick", "selectionChange", "update:selectedRowKeys", "columnsChange", "sortChange", "pageChange", "pageSizeChange", "update:query", "queryChange", "loadError", "cellEdit", "batchEdit"],
81
- setup(v, { expose: Ot, emit: Nt }) {
82
- const i = v, x = Nt, qt = Va(), te = w(null), ge = w(null), je = w(null), I = w(!1), j = w(!1), ae = w(), ut = Vt(), Bt = Vt(), F = c(
114
+ emits: ["rowClick", "selectionChange", "update:selectedRowKeys", "columnsChange", "columnLayoutChange", "update:currentRowKey", "currentChange", "headerClick", "headerContextmenu", "rowDblclick", "rowContextmenu", "cellClick", "cellDblclick", "cellContextmenu", "contextMenuSelect", "update:groupBy", "groupChange", "sortChange", "pageChange", "pageSizeChange", "update:query", "queryChange", "loadError", "cellEdit", "batchEdit"],
115
+ setup(s, { expose: fl, emit: vl }) {
116
+ const i = s, p = vl, pl = pa(), ge = C(null), le = C(null), nt = C(null), ae = C(!1), oe = C(!1), me = C(), Mt = ol(), yl = ol(), S = f(
83
117
  () => new Map(i.columns.map((e) => [e.key, e]))
84
118
  );
85
- function le(e) {
86
- const a = [], t = /* @__PURE__ */ new Set();
119
+ function he(e) {
120
+ const l = [], t = /* @__PURE__ */ new Set();
87
121
  for (const o of e.sort ?? []) {
88
- const n = F.value.get(o.key);
89
- if (!(!n || n.sortable === !1 || t.has(o.key)) && !(o.direction !== "asc" && o.direction !== "desc") && (t.add(o.key), a.push({ key: o.key, direction: o.direction }), !i.multiSort))
122
+ const n = S.value.get(o.key);
123
+ if (!(!n || n.sortable === !1 || t.has(o.key)) && !(o.direction !== "asc" && o.direction !== "desc") && (t.add(o.key), l.push({ key: o.key, direction: o.direction }), !i.multiSort))
90
124
  break;
91
125
  }
92
- const l = Object.fromEntries(
126
+ const a = Object.fromEntries(
93
127
  Object.entries(e.filters ?? {}).filter(([o, n]) => {
94
- const r = F.value.get(o);
95
- return r && r.filterable !== !1 && typeof n == "string" && n !== "";
128
+ const c = S.value.get(o);
129
+ return c && c.filterable !== !1 && typeof n == "string" && n !== "";
96
130
  })
97
131
  );
98
132
  return {
99
- page: Te(e.page, 1),
100
- pageSize: Te(e.pageSize, 10),
101
- sort: a,
133
+ page: xt(e.page, 1),
134
+ pageSize: xt(e.pageSize, 10),
135
+ sort: l,
102
136
  search: e.search ?? "",
103
- filters: l
137
+ filters: a
104
138
  };
105
139
  }
106
- const dt = () => {
107
- var e, a;
108
- return le({
140
+ const zt = () => {
141
+ var e, l;
142
+ return he({
109
143
  ...i.defaultQuery,
110
144
  page: i.page ?? ((e = i.defaultQuery) == null ? void 0 : e.page),
111
- pageSize: i.pageSize ?? ((a = i.defaultQuery) == null ? void 0 : a.pageSize)
145
+ pageSize: i.pageSize ?? ((l = i.defaultQuery) == null ? void 0 : l.pageSize)
112
146
  });
113
- }, P = Me(dt()), oe = c(
114
- () => le(i.query ?? P.value)
115
- ), S = c(() => oe.value.sort), Pe = c({
116
- get: () => oe.value.search,
147
+ }, ne = Ge(zt()), be = f(
148
+ () => he(i.query ?? ne.value)
149
+ ), x = f(() => be.value.sort), it = f({
150
+ get: () => be.value.search,
117
151
  set: (e) => J({ search: e, page: 1 })
118
- }), Ee = c(() => oe.value.filters), ct = (e) => Object.hasOwn(Ee.value, e) ? Ee.value[e] : "", Q = c(() => oe.value.pageSize), ne = c(() => i.serverMode || !!i.loadRows), he = w(""), ie = Me(/* @__PURE__ */ new Set()), se = Me(/* @__PURE__ */ new Set()), W = w(null), Ke = w(""), ke = w(""), Ae = w(""), Ht = new Intl.Collator("zh-CN", { numeric: !0 }), ee = c(() => ({
119
- ...oe.value,
120
- page: Math.min(oe.value.page, Je.value)
152
+ }), Qe = f(() => be.value.filters), rt = (e) => Object.hasOwn(Qe.value, e) ? Qe.value[e] : "", ie = f(() => be.value.pageSize), ke = f(() => i.serverMode || !!i.loadRows), Kt = C(), we = f(() => {
153
+ const e = i.groupBy ?? Kt.value ?? i.defaultGroupBy ?? "";
154
+ return S.value.has(e) ? e : "";
155
+ });
156
+ function Tt(e) {
157
+ const l = S.value.has(e) ? e : "";
158
+ l !== we.value && (i.groupBy === void 0 && (Kt.value = l), p("update:groupBy", l));
159
+ }
160
+ const Ce = Ge(/* @__PURE__ */ new Set()), re = Ge(/* @__PURE__ */ new Set()), P = C(null), We = C(""), Be = C(""), Je = C(""), gl = new Intl.Collator("zh-CN", { numeric: !0 }), se = f(() => ({
161
+ ...be.value,
162
+ page: Math.min(be.value.page, dt.value)
121
163
  })), {
122
- pending: Ut,
123
- failure: Ve,
124
- reload: $t,
125
- sourceRows: ft,
126
- remoteTotal: De
127
- } = qa(i, ee, (e) => x("loadError", e)), Fe = c(() => i.loading || Ut.value), vt = c(
128
- () => La(
129
- ft.value,
164
+ pending: ml,
165
+ failure: Ae,
166
+ reload: hl,
167
+ sourceRows: Dt,
168
+ remoteTotal: Xe
169
+ } = ka(i, se, (e) => p("loadError", e)), ue = f(() => i.loading || ml.value), Et = f(
170
+ () => ma(
171
+ Dt.value,
130
172
  i.rowKey,
131
- ne.value ? (ee.value.page - 1) * Q.value : 0
173
+ ke.value ? (se.value.page - 1) * ie.value : 0
132
174
  )
133
- ), re = (e, a) => String(me(e, a) ?? ""), be = c(() => {
134
- const e = vt.value;
135
- if (ne.value) return e;
136
- const a = Pe.value.trim().toLocaleLowerCase(), t = Object.entries(Ee.value).flatMap(
175
+ ), Se = (e, l) => String(Ne(e, l) ?? ""), Le = f(() => {
176
+ const e = Et.value;
177
+ if (ke.value) return e;
178
+ const l = it.value.trim().toLocaleLowerCase(), t = Object.entries(Qe.value).flatMap(
137
179
  ([o, n]) => {
138
- const r = F.value.get(o);
139
- return r ? [{ column: r, value: n, term: n.toLocaleLowerCase() }] : [];
180
+ const c = S.value.get(o);
181
+ return c ? [{ column: c, value: n, term: n.toLocaleLowerCase() }] : [];
140
182
  }
141
- ), l = e.filter(
142
- ({ row: o }) => (!a || i.columns.some(
143
- (n) => re(o, n).toLocaleLowerCase().includes(a)
183
+ ), a = e.filter(
184
+ ({ row: o }) => (!l || i.columns.some(
185
+ (n) => Se(o, n).toLocaleLowerCase().includes(l)
144
186
  )) && t.every(
145
- (n) => n.column.filterMethod ? n.column.filterMethod(n.value, o) : re(o, n.column).toLocaleLowerCase().includes(n.term)
187
+ (n) => n.column.filterMethod ? n.column.filterMethod(n.value, o) : Se(o, n.column).toLocaleLowerCase().includes(n.term)
146
188
  )
147
189
  );
148
- return S.value.length ? l.sort((o, n) => {
149
- for (const { key: r, direction: f } of S.value) {
150
- const k = F.value.get(r), _ = me(o.row, k), d = me(n.row, k), M = k.sortMethod ? k.sortMethod(o.row, n.row) : typeof _ == "number" && typeof d == "number" ? _ - d : Ht.compare(String(_ ?? ""), String(d ?? ""));
151
- if (M) return f === "asc" ? M : -M;
190
+ return x.value.length ? a.sort((o, n) => {
191
+ for (const { key: c, direction: m } of x.value) {
192
+ const b = S.value.get(c), O = Ne(o.row, b), Z = Ne(n.row, b), u = b.sortMethod ? b.sortMethod(o.row, n.row) : typeof O == "number" && typeof Z == "number" ? O - Z : gl.compare(String(O ?? ""), String(Z ?? ""));
193
+ if (u) return m === "asc" ? u : -u;
152
194
  }
153
195
  return 0;
154
- }) : l;
155
- }), Qe = c(
156
- () => i.treeMode ? Oa(be.value, i.parentKey, ie.value) : be.value.map((e) => ({ ...e, depth: 0, hasChildren: !1 }))
157
- ), We = c(
158
- () => ne.value ? Math.max(
196
+ }) : a;
197
+ }), st = f(
198
+ () => i.treeMode ? ha(Le.value, i.parentKey, Ce.value) : Le.value.map((e) => ({ ...e, depth: 0, hasChildren: !1 }))
199
+ ), ut = f(
200
+ () => ke.value ? Math.max(
159
201
  0,
160
202
  Math.floor(
161
- Number.isFinite(De.value) ? De.value : ft.value.length
203
+ Number.isFinite(Xe.value) ? Xe.value : Dt.value.length
162
204
  )
163
- ) : Qe.value.length
164
- ), Je = c(
165
- () => i.loadRows && De.value === void 0 ? Number.MAX_SAFE_INTEGER : Math.max(1, Math.ceil(We.value / Q.value))
166
- ), ue = c(() => ee.value.page), Xe = c(
167
- () => ne.value ? Qe.value : Qe.value.slice(
168
- (ue.value - 1) * Q.value,
169
- ue.value * Q.value
205
+ ) : st.value.length
206
+ ), dt = f(
207
+ () => i.loadRows && Xe.value === void 0 ? Number.MAX_SAFE_INTEGER : Math.max(1, Math.ceil(ut.value / ie.value))
208
+ ), xe = f(() => se.value.page), Ve = f(
209
+ () => ke.value ? st.value : st.value.slice(
210
+ (xe.value - 1) * ie.value,
211
+ xe.value * ie.value
170
212
  )
171
- ), It = c(() => be.value.map((e) => e.row)), we = () => le(ee.value);
213
+ ), Oe = () => he(se.value);
172
214
  function J(e) {
173
- const a = le({ ...ee.value, ...e });
174
- JSON.stringify(a) !== JSON.stringify(ee.value) && (i.query === void 0 && (P.value = a), x("update:query", le(a)));
215
+ const l = he({ ...se.value, ...e });
216
+ JSON.stringify(l) !== JSON.stringify(se.value) && (i.query === void 0 && (ne.value = l), p("update:query", he(l)));
175
217
  }
176
- function jt() {
177
- J(dt());
218
+ function bl() {
219
+ J(zt());
178
220
  }
179
- function Ge() {
180
- i.loadRows ? $t() : x("queryChange", we());
221
+ function ct() {
222
+ i.loadRows ? hl() : p("queryChange", Oe());
181
223
  }
182
- function Pt(e, a) {
183
- J({ filters: { ...Ee.value, [e]: a }, page: 1 });
224
+ function Nt(e, l) {
225
+ J({ filters: { ...Qe.value, [e]: l }, page: 1 });
184
226
  }
185
- L(
227
+ F(
186
228
  [() => i.page, () => i.pageSize],
187
- ([e, a], [t, l]) => {
188
- const o = P.value;
189
- P.value = le({
229
+ ([e, l], [t, a]) => {
230
+ const o = ne.value;
231
+ ne.value = he({
190
232
  ...o,
191
- page: e !== t ? e : a !== l ? 1 : o.page,
192
- pageSize: a !== l ? a : o.pageSize
233
+ page: e !== t ? e : l !== a ? 1 : o.page,
234
+ pageSize: l !== a ? l : o.pageSize
193
235
  });
194
236
  }
195
- ), L([Je, () => P.value.page], ([e]) => {
196
- i.query === void 0 && P.value.page > e && (P.value = { ...P.value, page: e });
197
- }), L(
198
- () => JSON.stringify(ee.value),
237
+ ), F([dt, () => ne.value.page], ([e]) => {
238
+ i.query === void 0 && ne.value.page > e && (ne.value = { ...ne.value, page: e });
239
+ }), F(
240
+ () => JSON.stringify(se.value),
199
241
  () => {
200
- W.value = null, i.scrollToTopOnQuery && ge.value && (ge.value.scrollTop = 0), x("queryChange", we());
242
+ P.value = null, i.scrollToTopOnQuery && le.value && (le.value.scrollTop = 0), p("queryChange", Oe());
201
243
  },
202
244
  { flush: "post" }
203
- ), za(() => {
204
- i.immediateQuery && x("queryChange", we());
245
+ ), ra(() => {
246
+ i.immediateQuery && p("queryChange", Oe());
205
247
  });
206
- let Ye = !1;
207
- async function Qt(e) {
208
- if (Ye) return;
209
- const a = ue.value;
210
- J({ page: Math.min(e, Je.value) }), await pe(), ue.value !== a && x("pageChange", ue.value);
248
+ let ft = !1;
249
+ async function kl(e) {
250
+ if (ft) return;
251
+ const l = xe.value;
252
+ J({ page: Math.min(e, dt.value) }), await ye(), xe.value !== l && p("pageChange", xe.value);
211
253
  }
212
- async function Wt(e) {
213
- const a = Q.value;
214
- Ye = !0, J({ pageSize: e, page: 1 }), await pe(), Ye = !1, Q.value !== a && x("pageSizeChange", Q.value);
254
+ async function wl(e) {
255
+ const l = ie.value;
256
+ ft = !0, J({ pageSize: e, page: 1 }), await ye(), ft = !1, ie.value !== l && p("pageSizeChange", ie.value);
215
257
  }
216
- async function yt(e, a) {
258
+ async function Ye(e, l) {
217
259
  if (e.sortable === !1) return;
218
- const t = JSON.stringify(S.value), l = i.multiSort ? S.value.filter((o) => o.key !== e.key) : [];
219
- a && l.push({ key: e.key, direction: a }), J({ sort: l, page: 1 }), await pe(), JSON.stringify(S.value) !== t && x("sortChange", S.value[0] ?? null);
260
+ const t = JSON.stringify(x.value), a = i.multiSort ? x.value.filter((o) => o.key !== e.key) : [];
261
+ l && a.push({ key: e.key, direction: l }), J({ sort: a, page: 1 }), await ye(), JSON.stringify(x.value) !== t && p("sortChange", x.value[0] ?? null);
220
262
  }
221
- function Jt(e) {
263
+ function Cl(e) {
222
264
  var t;
223
- const a = (t = S.value.find(
224
- (l) => l.key === e.key
265
+ const l = (t = x.value.find(
266
+ (a) => a.key === e.key
225
267
  )) == null ? void 0 : t.direction;
226
- yt(
268
+ Ye(
227
269
  e,
228
- a === "asc" ? "desc" : a === "desc" ? null : "asc"
270
+ l === "asc" ? "desc" : l === "desc" ? null : "asc"
229
271
  );
230
272
  }
231
- function pt(e, a) {
232
- var l;
233
- const t = (l = S.value.find(
273
+ function Bt(e, l) {
274
+ var a;
275
+ const t = (a = x.value.find(
234
276
  (o) => o.key === e.key
235
- )) == null ? void 0 : l.direction;
236
- yt(e, t === a ? null : a);
277
+ )) == null ? void 0 : a.direction;
278
+ Ye(e, t === l ? null : l);
237
279
  }
238
- const Xt = c(
280
+ const Sl = f(
239
281
  () => i.columns.filter((e) => e.key !== i.rowKey)
240
282
  );
241
- function Gt(e, a) {
283
+ function xl(e, l) {
242
284
  try {
243
285
  return "group:" + JSON.stringify(e ?? null);
244
286
  } catch {
245
- return "group:" + typeof e + ":" + a;
287
+ return "group:" + typeof e + ":" + l;
246
288
  }
247
289
  }
248
- const Yt = c(() => {
249
- const e = Xe.value.map((o, n) => ({
290
+ const vt = f(() => {
291
+ const e = Ve.value.map((o, n) => ({
250
292
  kind: "row",
251
- key: "row:" + st(o.id),
293
+ key: "row:" + W(o.id),
252
294
  item: o,
253
295
  pageIndex: n
254
- })), a = F.value.get(he.value);
255
- if (!a) return e;
296
+ })), l = S.value.get(we.value);
297
+ if (!l) return e;
256
298
  const t = /* @__PURE__ */ new Map();
257
299
  for (const o of e) {
258
- const n = me(o.item.row, a), r = n == null || n === "" ? "(空)" : String(n), f = Gt(n, r), k = t.get(f);
259
- k ? k.rows.push(o) : t.set(f, { label: r, rows: [o] });
300
+ const n = Ne(o.item.row, l), c = n == null || n === "" ? "(空)" : String(n), m = xl(n, c), b = t.get(m);
301
+ b ? b.rows.push(o) : t.set(m, { label: c, rows: [o] });
260
302
  }
261
- const l = [];
303
+ const a = [];
262
304
  for (const [o, n] of t)
263
- l.push({
305
+ a.push({
264
306
  kind: "group",
265
307
  key: o,
266
308
  label: n.label,
267
- count: n.rows.length
268
- }), se.value.has(o) || l.push(...n.rows);
269
- return l;
309
+ rows: n.rows.map(({ item: c }) => c.row)
310
+ }), re.value.has(o) || a.push(...n.rows);
311
+ return a;
312
+ }), Fe = f(() => new Map(vt.value.flatMap(
313
+ (e) => e.kind === "row" ? [[W(e.item.id), e.item]] : []
314
+ ))), Rl = f(() => [...Fe.value.keys()]), At = wa({
315
+ enabled: () => !!i.keyboardNavigation && !ue.value && Ae.value == null,
316
+ table: () => {
317
+ var e;
318
+ return (e = le.value) == null ? void 0 : e.querySelector(":scope > table");
319
+ },
320
+ tokens: () => Rl.value,
321
+ attribute: "data-grid-row",
322
+ toggle(e) {
323
+ const l = Fe.value.get(e);
324
+ return !l || !i.selectable || !ze(l) ? !1 : (Ie(l.id), !0);
325
+ }
270
326
  });
271
- function mt(e, a) {
327
+ function Lt(e, l) {
272
328
  const t = new Set(e);
273
- return t.has(a) ? t.delete(a) : t.add(a), t;
329
+ return t.has(l) ? t.delete(l) : t.add(l), t;
274
330
  }
275
- function Zt(e) {
276
- ie.value = mt(ie.value, e);
331
+ function Ml(e) {
332
+ Ce.value = Lt(Ce.value, e);
277
333
  }
278
- function _t(e) {
279
- se.value = mt(se.value, e);
334
+ function zl(e) {
335
+ re.value = Lt(re.value, e);
280
336
  }
281
- L(he, () => {
282
- se.value = /* @__PURE__ */ new Set();
337
+ F(we, () => {
338
+ re.value = /* @__PURE__ */ new Set(), p("groupChange", we.value);
283
339
  });
284
- function ea(e, a) {
285
- !i.editable || !a.editable || (W.value = { id: e.id, key: a.key }, Ke.value = re(e.row, a));
340
+ function Kl(e) {
341
+ const l = vt.value.flatMap((a) => a.kind === "group" ? [a.key] : []), t = new Set(re.value);
342
+ for (const a of l)
343
+ e ? t.delete(a) : t.add(a);
344
+ re.value = t;
286
345
  }
287
- function gt(e, a) {
288
- var t, l;
289
- ((t = W.value) == null ? void 0 : t.id) !== e.id || ((l = W.value) == null ? void 0 : l.key) !== a.key || (W.value = null, x("cellEdit", {
346
+ function Vt(e, l) {
347
+ if (!i.editable || !l.editable) return;
348
+ const t = { id: e.id, key: l.key };
349
+ P.value = t, We.value = Se(e.row, l), ye(() => {
350
+ var n, c, m, b;
351
+ if (((n = P.value) == null ? void 0 : n.id) !== t.id || ((c = P.value) == null ? void 0 : c.key) !== t.key) return;
352
+ const a = Array.from(((m = le.value) == null ? void 0 : m.querySelectorAll("[data-grid-row]")) ?? []).find((O) => O.dataset.gridRow === W(t.id)), o = Array.from((a == null ? void 0 : a.cells) ?? []).find((O) => O.dataset.columnKey === t.key);
353
+ (b = o == null ? void 0 : o.querySelector("input")) == null || b.focus();
354
+ });
355
+ }
356
+ function Ot(e, l) {
357
+ var t, a;
358
+ ((t = P.value) == null ? void 0 : t.id) !== e.id || ((a = P.value) == null ? void 0 : a.key) !== l.key || (P.value = null, p("cellEdit", {
290
359
  row: e.row,
291
360
  rowKey: e.id,
292
- column: a.key,
293
- value: Ke.value
361
+ column: l.key,
362
+ value: We.value
294
363
  }));
295
364
  }
296
- function ta() {
297
- !ke.value || !b.value.length || (x("batchEdit", {
298
- keys: [...b.value],
299
- column: ke.value,
300
- value: Ae.value
301
- }), Ae.value = "");
365
+ function Ze(e, l) {
366
+ var t, a;
367
+ return ((t = P.value) == null ? void 0 : t.id) === e.id && ((a = P.value) == null ? void 0 : a.key) === l.key;
368
+ }
369
+ function Tl(e) {
370
+ !e.isComposing && e.keyCode !== 229 && (P.value = null);
371
+ }
372
+ function Dl() {
373
+ !Be.value || !w.value.length || (p("batchEdit", {
374
+ keys: [...w.value],
375
+ column: Be.value,
376
+ value: Je.value
377
+ }), Je.value = "");
302
378
  }
303
- const aa = new Intl.NumberFormat("zh-CN", {
379
+ const El = new Intl.NumberFormat("zh-CN", {
304
380
  maximumFractionDigits: 2
305
- });
306
- function la(e) {
307
- const a = It.value;
308
- if (i.summaryMethod) return i.summaryMethod(e, a);
381
+ }), Nl = f(() => Al(i.summaryScope));
382
+ function Ft(e, l = Nl.value) {
383
+ if (i.summaryMethod) return i.summaryMethod(e, l);
309
384
  if (!e.summary) return "";
310
- const t = a.map((r) => me(r, e)).filter((r) => r != null && r !== "");
385
+ const t = l.map((c) => Ne(c, e)).filter((c) => c != null && c !== "");
311
386
  if (e.summary === "count") return String(t.length);
312
- const l = t.map(Number).filter(Number.isFinite);
313
- if (!l.length) return "—";
314
- const o = l.reduce((r, f) => r + f, 0), n = e.summary === "sum" ? o : e.summary === "avg" ? o / l.length : l.reduce(
315
- (r, f) => e.summary === "min" ? Math.min(r, f) : Math.max(r, f)
387
+ const a = t.map(Number).filter(Number.isFinite);
388
+ if (!a.length) return "—";
389
+ const o = a.reduce((c, m) => c + m, 0), n = e.summary === "sum" ? o : e.summary === "avg" ? o / a.length : a.reduce(
390
+ (c, m) => e.summary === "min" ? Math.min(c, m) : Math.max(c, m)
316
391
  );
317
- return aa.format(n);
318
- }
319
- function Ze(e) {
320
- const a = [...new Set(e.filter(Na))];
321
- return i.selectionType === "radio" ? a.slice(0, 1) : a;
322
- }
323
- const ht = Me(
324
- Ze(i.defaultSelectedRowKeys ?? [])
325
- ), b = c(
326
- () => Ze(i.selectedRowKeys ?? ht.value)
327
- ), Le = c(() => new Set(b.value)), _e = c(
328
- () => new Map(vt.value.map((e) => [e.id, e]))
329
- ), Oe = (e) => {
330
- var a;
331
- return ((a = i.rowSelectable) == null ? void 0 : a.call(i, e.row, e.index)) !== !1;
332
- }, Se = c(
333
- () => Xe.value.filter(Oe).map((e) => e.id)
334
- ), kt = c(
335
- () => Se.value.length > 0 && Se.value.every((e) => Le.value.has(e))
336
- ), oa = c(
337
- () => Se.value.some((e) => Le.value.has(e))
338
- ), bt = () => [...b.value];
339
- function Ce(e) {
340
- const a = Ze(e);
341
- a.length === b.value.length && a.every((t, l) => t === b.value[l]) || (i.selectedRowKeys === void 0 && (ht.value = a), x("update:selectedRowKeys", [...a]));
342
- }
343
- L(
344
- () => JSON.stringify(b.value),
345
- () => x("selectionChange", bt())
346
- ), L([_e, () => i.reserveSelection, ne], () => {
347
- i.selectedRowKeys === void 0 && !(i.reserveSelection ?? ne.value) && Ce(b.value.filter((e) => _e.value.has(e)));
392
+ return El.format(n);
393
+ }
394
+ function pt(e) {
395
+ const l = [...new Set(e.filter(ba))];
396
+ return i.selectionType === "radio" ? l.slice(0, 1) : l;
397
+ }
398
+ const qt = Ge(
399
+ pt(i.defaultSelectedRowKeys ?? [])
400
+ ), w = f(
401
+ () => pt(i.selectedRowKeys ?? qt.value)
402
+ ), yt = C(), Re = f(() => i.currentRowKey !== void 0 ? i.currentRowKey : yt.value === void 0 ? i.defaultCurrentRowKey ?? null : yt.value);
403
+ function gt(e) {
404
+ e === Re.value || e !== null && !Me.value.has(e) || (i.currentRowKey === void 0 && (yt.value = e), p("update:currentRowKey", e));
405
+ }
406
+ F(Re, (e, l) => p("currentChange", e, l));
407
+ const qe = f(() => new Set(w.value)), Me = f(
408
+ () => new Map(Et.value.map((e) => [e.id, e]))
409
+ ), ze = (e) => {
410
+ var l;
411
+ return ((l = i.rowSelectable) == null ? void 0 : l.call(i, e.row, e.index)) !== !1;
412
+ }, He = f(
413
+ () => Ve.value.filter(ze).map((e) => e.id)
414
+ ), Ht = f(
415
+ () => He.value.length > 0 && He.value.every((e) => qe.value.has(e))
416
+ ), Bl = f(
417
+ () => He.value.some((e) => qe.value.has(e))
418
+ ), $t = () => [...w.value];
419
+ function Al(e) {
420
+ return e === "selected" ? w.value.flatMap((l) => {
421
+ const t = Me.value.get(l);
422
+ return t ? [t.row] : [];
423
+ }) : (e === "page" ? Ve.value : Le.value).map(({ row: l }) => l);
424
+ }
425
+ function $e(e) {
426
+ const l = pt(e);
427
+ l.length === w.value.length && l.every((t, a) => t === w.value[a]) || (i.selectedRowKeys === void 0 && (qt.value = l), p("update:selectedRowKeys", [...l]));
428
+ }
429
+ F(
430
+ () => JSON.stringify(w.value),
431
+ () => p("selectionChange", $t())
432
+ ), F([Me, () => i.reserveSelection, ke], () => {
433
+ i.selectedRowKeys === void 0 && !(i.reserveSelection ?? ke.value) && $e(w.value.filter((e) => Me.value.has(e)));
348
434
  });
349
- function et(e, a = !Le.value.has(e)) {
350
- const t = _e.value.get(e);
351
- !i.selectable || !t || !Oe(t) || Ce(
352
- a ? i.selectionType === "radio" ? [e] : [...b.value, e] : b.value.filter((l) => l !== e)
435
+ function Ie(e, l = !qe.value.has(e)) {
436
+ const t = Me.value.get(e);
437
+ !i.selectable || !t || !ze(t) || $e(
438
+ l ? i.selectionType === "radio" ? [e] : [...w.value, e] : w.value.filter((a) => a !== e)
353
439
  );
354
440
  }
355
- function na() {
356
- Ce([]);
441
+ function Ll() {
442
+ $e([]);
357
443
  }
358
- function ia(e) {
444
+ function Vl(e) {
359
445
  if (i.selectionType === "radio") return;
360
- const a = new Set(Se.value);
361
- Ce(
362
- e ? [...b.value, ...a] : b.value.filter((t) => !a.has(t))
446
+ const l = new Set(He.value);
447
+ $e(
448
+ e ? [...w.value, ...l] : w.value.filter((t) => !l.has(t))
363
449
  );
364
450
  }
365
- function sa() {
451
+ function Ol() {
366
452
  if (!i.storageKey || typeof localStorage > "u") return {};
367
453
  try {
368
454
  const e = JSON.parse(
@@ -373,884 +459,1100 @@ const $a = ["aria-busy"], Ia = { class: "hys-ui-pf-grid-toolbar" }, ja = { class
373
459
  return {};
374
460
  }
375
461
  }
376
- const X = sa(), E = w(
377
- Array.isArray(X.order) ? X.order.filter((e) => typeof e == "string") : []
378
- ), C = w(
379
- Array.isArray(X.hidden) ? X.hidden.filter((e) => typeof e == "string") : []
380
- ), K = w(
381
- X.widths && typeof X.widths == "object" && !Array.isArray(X.widths) ? Object.fromEntries(
382
- Object.entries(X.widths).filter(
383
- ([, e]) => typeof e == "number" && Number.isFinite(e)
384
- )
385
- ) : {}
386
- ), Ne = (e) => Te(e.minWidth, 80), tt = (e) => Math.max(Ne(e), Te(e.maxWidth, 800)), qe = (e, a) => Math.max(Ne(e), Math.min(tt(e), a)), Be = Me(), B = (e) => {
387
- var a;
388
- return ((a = Be.value) == null ? void 0 : a.key) === e.key ? Be.value.width : Object.hasOwn(K.value, e.key) ? K.value[e.key] : Te(e.width, 160);
462
+ const _e = sl(S.value, Ol()), j = C(_e.order), A = C(_e.hidden), R = C(_e.widths), G = C(_e.pins);
463
+ function mt() {
464
+ return {
465
+ order: [...j.value],
466
+ hidden: [...A.value],
467
+ widths: { ...R.value },
468
+ ...Object.keys(G.value).length ? { pins: { ...G.value } } : {}
469
+ };
470
+ }
471
+ function It(e) {
472
+ const l = sl(S.value, e);
473
+ j.value = l.order, A.value = l.hidden, R.value = l.widths, G.value = l.pins;
474
+ }
475
+ const et = Ge(), Q = (e) => {
476
+ var l;
477
+ return ((l = et.value) == null ? void 0 : l.key) === e.key ? et.value.width : Object.hasOwn(R.value, e.key) ? R.value[e.key] : xt(e.width, 160);
389
478
  };
390
- L(
479
+ F(
391
480
  () => i.columns.map((e) => [
392
481
  e.key,
393
482
  e.hideable,
483
+ e.pinnable,
394
484
  e.minWidth,
395
485
  e.maxWidth
396
486
  ]),
397
- (e, a) => {
398
- a && Y();
399
- const t = F.value, l = [...t.keys()];
400
- E.value = [
401
- .../* @__PURE__ */ new Set([...E.value.filter((o) => t.has(o)), ...l])
402
- ], C.value = [
403
- ...new Set(
404
- C.value.filter(
405
- (o) => {
406
- var n;
407
- return t.has(o) && ((n = t.get(o)) == null ? void 0 : n.hideable) !== !1;
408
- }
409
- )
410
- )
411
- ], l.every((o) => C.value.includes(o)) && (C.value = []), K.value = Object.fromEntries(
412
- Object.entries(K.value).flatMap(([o, n]) => {
413
- const r = t.get(o);
414
- return r ? [[o, qe(r, n)]] : [];
415
- })
416
- );
487
+ (e, l) => {
488
+ l && L(), It(mt());
417
489
  },
418
490
  { immediate: !0 }
419
491
  );
420
- const A = c(
421
- () => E.value.flatMap((e) => {
422
- const a = F.value.get(e);
423
- return a && !C.value.includes(e) ? [a] : [];
492
+ const K = f(
493
+ () => j.value.flatMap((e) => {
494
+ const l = S.value.get(e);
495
+ return l && !A.value.includes(e) ? [l] : [];
424
496
  })
425
- ), G = c(() => [
426
- ...A.value.filter((e) => e.pinned === "left"),
427
- ...A.value.filter((e) => !e.pinned),
428
- ...A.value.filter((e) => e.pinned === "right")
429
- ]), ra = c(
430
- () => E.value.flatMap((e) => {
431
- const a = F.value.get(e);
432
- return a ? [{ id: e, label: a.label }] : [];
497
+ );
498
+ function q(e) {
499
+ return (Object.hasOwn(G.value, e.key) ? G.value[e.key] : e.pinned) ?? void 0;
500
+ }
501
+ const H = f(() => [
502
+ ...K.value.filter((e) => q(e) === "left"),
503
+ ...K.value.filter((e) => !q(e)),
504
+ ...K.value.filter((e) => q(e) === "right")
505
+ ]), ht = f(() => Ca(H.value, q)), Fl = f(() => ht.value.some(({ group: e }) => !!e)), ql = f(
506
+ () => j.value.flatMap((e) => {
507
+ const l = S.value.get(e);
508
+ return l ? [{ id: e, label: l.label }] : [];
433
509
  })
434
510
  );
435
- L([E, C, K], () => {
511
+ F([j, A, R, G], () => {
436
512
  if (i.storageKey && typeof localStorage < "u")
437
513
  try {
438
514
  localStorage.setItem(
439
515
  "hys-ui-grid:" + i.storageKey,
440
516
  JSON.stringify({
441
- order: E.value,
442
- hidden: C.value,
443
- widths: K.value
517
+ order: j.value,
518
+ hidden: A.value,
519
+ widths: R.value,
520
+ pins: G.value
444
521
  })
445
522
  );
446
523
  } catch {
447
524
  }
448
- x(
525
+ p(
449
526
  "columnsChange",
450
- A.value.map((e) => e.key)
451
- );
527
+ H.value.map((e) => e.key)
528
+ ), p("columnLayoutChange", mt());
452
529
  });
453
- function ua(e) {
454
- e.hideable !== !1 && (C.value.includes(e.key) ? C.value = C.value.filter((a) => a !== e.key) : A.value.length > 1 && (C.value = [...C.value, e.key]));
530
+ function Hl(e) {
531
+ bt(e.key, A.value.includes(e.key));
532
+ }
533
+ function bt(e, l) {
534
+ const t = S.value.get(e);
535
+ return !t || l === !A.value.includes(e) || !l && (t.hideable === !1 || K.value.length <= 1) ? !1 : (L(), ce(), A.value = l ? A.value.filter((a) => a !== e) : [...A.value, e], !0);
536
+ }
537
+ function tt(e, l) {
538
+ const t = S.value.get(e);
539
+ return !t || t.pinnable === !1 || l !== null && l !== "left" && l !== "right" || q(t) === (l ?? void 0) ? !1 : (L(), ce(), De(), G.value = { ...G.value, [e]: l }, t.pinned === (l ?? void 0) && delete G.value[e], !0);
455
540
  }
456
- const da = c(
457
- () => G.value.reduce(
458
- (e, a) => e + B(a),
541
+ function $l(e, l) {
542
+ const t = S.value.get(e);
543
+ if (!t || t.resizable === !1 || !Number.isFinite(l)) return !1;
544
+ const a = at(t, l);
545
+ return a === Q(t) ? !1 : (L(), R.value = { ...R.value, [e]: a }, !0);
546
+ }
547
+ function Ut(e) {
548
+ if (!Object.hasOwn(R.value, e)) return !1;
549
+ L();
550
+ const l = { ...R.value };
551
+ return delete l[e], R.value = l, !0;
552
+ }
553
+ const Il = f(
554
+ () => H.value.reduce(
555
+ (e, l) => e + Q(l),
459
556
  i.selectable ? 44 : 0
460
557
  )
461
- ), ca = c(() => {
558
+ ), Ul = f(() => {
462
559
  const e = /* @__PURE__ */ new Map();
463
- let a = i.selectable ? 44 : 0;
464
- for (const l of G.value)
465
- l.pinned === "left" && (e.set(l.key, { left: a + "px" }), a += B(l));
560
+ let l = i.selectable ? 44 : 0;
561
+ for (const a of H.value)
562
+ q(a) === "left" && (e.set(a.key, { left: l + "px" }), l += Q(a));
466
563
  let t = 0;
467
- for (const l of [...G.value].reverse())
468
- l.pinned === "right" && (e.set(l.key, { right: t + "px" }), t += B(l));
564
+ for (const a of [...H.value].reverse())
565
+ q(a) === "right" && (e.set(a.key, { right: t + "px" }), t += Q(a));
469
566
  return e;
470
- }), He = (e, a = !1) => e.pinned ? {
567
+ }), Ue = (e, l = !1) => q(e) ? {
471
568
  position: "sticky",
472
- ...ca.value.get(e.key),
473
- zIndex: a ? 5 : 2
569
+ ...Ul.value.get(e.key),
570
+ zIndex: l ? 5 : 2
474
571
  } : {};
475
- async function wt(e = !0) {
572
+ async function Pt(e = !0) {
476
573
  var o, n;
477
- if (j.value = !1, !e) return;
478
- await pe();
574
+ if (oe.value = !1, !e) return;
575
+ await ye();
479
576
  const t = [
480
- ...((o = te.value) == null ? void 0 : o.querySelectorAll(
577
+ ...((o = ge.value) == null ? void 0 : o.querySelectorAll(
481
578
  "thead th[data-column-key]"
482
579
  )) ?? []
483
580
  ].find(
484
- (r) => r.dataset.columnKey === ae.value
485
- ), l = (t == null ? void 0 : t.querySelector(".hys-ui-pf-grid-filter")) ?? ((n = te.value) == null ? void 0 : n.querySelector(".hys-ui-pf-grid-filter"));
486
- l == null || l.focus({ preventScroll: !0 });
487
- }
488
- async function fa(e) {
489
- var t, l, o;
490
- if (j.value && ae.value === e.key) {
491
- await wt(!1);
581
+ (c) => c.dataset.columnKey === me.value
582
+ ), a = (t == null ? void 0 : t.querySelector(".hys-ui-pf-grid-filter")) ?? ((n = ge.value) == null ? void 0 : n.querySelector(".hys-ui-pf-grid-filter"));
583
+ a == null || a.focus({ preventScroll: !0 });
584
+ }
585
+ async function jt(e) {
586
+ var t, a, o;
587
+ if (oe.value && me.value === e.key) {
588
+ await Pt(!1);
492
589
  return;
493
590
  }
494
- ae.value = e.key, j.value = !0, await pe(), (o = (l = [
495
- ...((t = te.value) == null ? void 0 : t.querySelectorAll("[data-filter-key]")) ?? []
496
- ].find((n) => n.dataset.filterKey === e.key)) == null ? void 0 : l.querySelector("input")) == null || o.focus({ preventScroll: !0 });
591
+ me.value = e.key, oe.value = !0, await ye(), (o = (a = [
592
+ ...((t = ge.value) == null ? void 0 : t.querySelectorAll("[data-filter-key]")) ?? []
593
+ ].find((n) => n.dataset.filterKey === e.key)) == null ? void 0 : a.querySelector("input")) == null || o.focus({ preventScroll: !0 });
497
594
  }
498
- let p, xe = 0, St = 0;
499
- function Ct(e) {
500
- !p || e.pointerId !== p.pointer || (St = qe(
501
- p.column,
502
- p.width + e.clientX - p.start
503
- ), !xe && (xe = requestAnimationFrame(() => {
504
- xe = 0, p && (Be.value = { key: p.column.key, width: St });
595
+ let h, Pe = 0, Gt = 0;
596
+ function Qt(e) {
597
+ !h || e.pointerId !== h.pointer || (Gt = at(
598
+ h.column,
599
+ h.width + e.clientX - h.start
600
+ ), !Pe && (Pe = requestAnimationFrame(() => {
601
+ Pe = 0, h && (et.value = { key: h.column.key, width: Gt });
505
602
  })));
506
603
  }
507
- function Y() {
508
- p && (cancelAnimationFrame(xe), xe = 0, Be.value = void 0, document.body.style.cursor === "col-resize" && (document.body.style.cursor = p.cursor), p = void 0, window.removeEventListener("pointermove", Ct), window.removeEventListener("pointerup", Rt), window.removeEventListener("pointercancel", xt), window.removeEventListener("blur", Y), window.removeEventListener("keydown", zt, !0));
604
+ function L() {
605
+ h && (cancelAnimationFrame(Pe), Pe = 0, et.value = void 0, document.body.style.cursor === "col-resize" && (document.body.style.cursor = h.cursor), h = void 0, window.removeEventListener("pointermove", Qt), window.removeEventListener("pointerup", Xt), window.removeEventListener("pointercancel", Wt), window.removeEventListener("blur", L), window.removeEventListener("keydown", Jt, !0));
509
606
  }
510
- function xt(e) {
511
- e.pointerId === (p == null ? void 0 : p.pointer) && Y();
607
+ function Wt(e) {
608
+ e.pointerId === (h == null ? void 0 : h.pointer) && L();
512
609
  }
513
- function zt(e) {
514
- e.key === "Escape" && p && (e.preventDefault(), e.stopPropagation(), Y());
610
+ function Jt(e) {
611
+ e.key === "Escape" && h && (e.preventDefault(), e.stopPropagation(), L());
515
612
  }
516
- function Rt(e) {
517
- if (!p || e.pointerId !== p.pointer) return;
518
- const { column: a, start: t, width: l } = p, o = e.clientX - t, n = o === 0 ? l : qe(a, l + o);
519
- Y(), n !== l && (K.value = { ...K.value, [a.key]: n });
613
+ function Xt(e) {
614
+ if (!h || e.pointerId !== h.pointer) return;
615
+ const { column: l, start: t, width: a } = h, o = e.clientX - t, n = o === 0 ? a : at(l, a + o);
616
+ L(), n !== a && (R.value = { ...R.value, [l.key]: n });
520
617
  }
521
- function va(e, a) {
522
- a.resizable === !1 || e.button !== 0 || p || (e.preventDefault(), e.stopPropagation(), p = {
523
- column: a,
618
+ function Pl(e, l) {
619
+ l.resizable === !1 || e.button !== 0 || h || (e.preventDefault(), e.stopPropagation(), h = {
620
+ column: l,
524
621
  pointer: e.pointerId,
525
622
  start: e.clientX,
526
- width: B(a),
623
+ width: Q(l),
527
624
  cursor: document.body.style.cursor
528
- }, document.body.style.cursor = "col-resize", window.addEventListener("pointermove", Ct), window.addEventListener("pointerup", Rt), window.addEventListener("pointercancel", xt), window.addEventListener("blur", Y), window.addEventListener("keydown", zt, !0));
625
+ }, document.body.style.cursor = "col-resize", window.addEventListener("pointermove", Qt), window.addEventListener("pointerup", Xt), window.addEventListener("pointercancel", Wt), window.addEventListener("blur", L), window.addEventListener("keydown", Jt, !0));
529
626
  }
530
- function ya(e, a) {
531
- const t = e.shiftKey ? 40 : 10, l = B(a), o = e.key === "ArrowLeft" ? l - t : e.key === "ArrowRight" ? l + t : e.key === "Home" ? Ne(a) : e.key === "End" ? tt(a) : void 0;
627
+ function jl(e, l) {
628
+ const t = e.shiftKey ? 40 : 10, a = Q(l), o = e.key === "ArrowLeft" ? a - t : e.key === "ArrowRight" ? a + t : e.key === "Home" ? dl(l) : e.key === "End" ? ul(l) : void 0;
532
629
  if (o === void 0) return;
533
630
  e.preventDefault();
534
- const n = qe(a, o);
535
- n !== l && (K.value = { ...K.value, [a.key]: n });
536
- }
537
- const { effectiveMotion: Ue } = Fa(), de = w(null), Z = w(null);
538
- let H = 0, ce = null, at = 0;
539
- const ze = /* @__PURE__ */ new Set(), Mt = 160;
540
- function Re() {
541
- at++;
542
- for (const e of ze) e.cancel();
543
- ze.clear();
544
- }
545
- L(Ue, (e) => {
546
- e === "off" && Re();
631
+ const n = at(l, o);
632
+ n !== a && (R.value = { ...R.value, [l.key]: n });
633
+ }
634
+ const { effectiveMotion: lt } = ga(), Ke = C(null), de = C(null);
635
+ let X = 0, Te = null, kt = 0;
636
+ const je = /* @__PURE__ */ new Set(), Yt = 160;
637
+ function De() {
638
+ kt++;
639
+ for (const e of je) e.cancel();
640
+ je.clear();
641
+ }
642
+ F(lt, (e) => {
643
+ e === "off" && De();
547
644
  });
548
- function fe() {
549
- cancelAnimationFrame(H), H = 0, ce = null, de.value = null, Z.value = null;
645
+ function ce() {
646
+ cancelAnimationFrame(X), X = 0, Te = null, Ke.value = null, de.value = null;
550
647
  }
551
- function pa(e, a) {
552
- if (p || a.reorderable === !1 || !e.dataTransfer) {
648
+ function Gl(e, l) {
649
+ if (h || l.reorderable === !1 || !e.dataTransfer) {
553
650
  e.preventDefault();
554
651
  return;
555
652
  }
556
- Re(), de.value = a.key, e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", a.key);
653
+ De(), Ke.value = l.key, e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", l.key);
557
654
  }
558
- function lt(e) {
559
- const a = i.columns.find((t) => t.key === de.value);
560
- return !!a && a.key !== e.key && a.reorderable !== !1 && e.reorderable !== !1 && a.pinned === e.pinned;
655
+ function wt(e) {
656
+ const l = i.columns.find((t) => t.key === Ke.value);
657
+ return !!l && l.key !== e.key && l.reorderable !== !1 && e.reorderable !== !1 && q(l) === q(e);
561
658
  }
562
- function Tt(e, a, t) {
563
- const l = t.getBoundingClientRect();
659
+ function Zt(e, l, t) {
660
+ const a = t.getBoundingClientRect();
564
661
  return {
565
662
  key: e.key,
566
- position: a < l.left + l.width / 2 ? "before" : "after"
663
+ position: l < a.left + a.width / 2 ? "before" : "after"
567
664
  };
568
665
  }
569
- function ma(e, a) {
570
- if (!lt(a)) {
571
- cancelAnimationFrame(H), H = 0, ce = null, Z.value = null;
666
+ function Ql(e, l) {
667
+ if (!wt(l)) {
668
+ cancelAnimationFrame(X), X = 0, Te = null, de.value = null;
572
669
  return;
573
670
  }
574
- e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move"), ce = {
671
+ e.preventDefault(), e.dataTransfer && (e.dataTransfer.dropEffect = "move"), Te = {
575
672
  element: e.currentTarget,
576
- column: a,
673
+ column: l,
577
674
  x: e.clientX
578
- }, !H && (H = requestAnimationFrame(() => {
675
+ }, !X && (X = requestAnimationFrame(() => {
579
676
  var o;
580
- H = 0;
581
- const t = ce;
582
- if (ce = null, !t || !lt(t.column)) return;
583
- const l = Tt(t.column, t.x, t.element);
584
- (((o = Z.value) == null ? void 0 : o.key) !== l.key || Z.value.position !== l.position) && (Z.value = l);
677
+ X = 0;
678
+ const t = Te;
679
+ if (Te = null, !t || !wt(t.column)) return;
680
+ const a = Zt(t.column, t.x, t.element);
681
+ (((o = de.value) == null ? void 0 : o.key) !== a.key || de.value.position !== a.position) && (de.value = a);
585
682
  }));
586
683
  }
587
- function ga(e) {
588
- e.relatedTarget instanceof Element && e.relatedTarget.closest("th[data-column-key]") && e.currentTarget.contains(e.relatedTarget) || (cancelAnimationFrame(H), H = 0, ce = null, Z.value = null);
684
+ function Wl(e) {
685
+ e.relatedTarget instanceof Element && e.relatedTarget.closest("th[data-column-key]") && e.currentTarget.contains(e.relatedTarget) || (cancelAnimationFrame(X), X = 0, Te = null, de.value = null);
589
686
  }
590
- function Et() {
687
+ function _t() {
591
688
  var e;
592
689
  return new Map(
593
690
  Array.from(
594
- ((e = te.value) == null ? void 0 : e.querySelectorAll("th[data-column-key]")) || []
595
- ).map((a) => [
596
- a.dataset.columnKey,
597
- a.getBoundingClientRect()
691
+ ((e = ge.value) == null ? void 0 : e.querySelectorAll("th[data-column-key]")) || []
692
+ ).map((l) => [
693
+ l.dataset.columnKey,
694
+ l.getBoundingClientRect()
598
695
  ])
599
696
  );
600
697
  }
601
- function ha(e) {
602
- var d;
603
- if (Ue.value === "off") return;
604
- const a = (d = te.value) == null ? void 0 : d.querySelector(
698
+ function Jl(e) {
699
+ var Z;
700
+ if (lt.value === "off") return;
701
+ const l = (Z = ge.value) == null ? void 0 : Z.querySelector(
605
702
  ".hys-ui-pf-grid-scroll"
606
703
  );
607
- if (!a) return;
608
- const t = a.getBoundingClientRect(), l = Math.max(0, t.top), o = Math.min(window.innerHeight, t.bottom), n = Math.max(0, t.left), r = Math.min(window.innerWidth, t.right);
609
- if (l >= o || n >= r) return;
610
- const f = /* @__PURE__ */ new Map();
611
- for (const [M, U] of Et()) {
612
- const R = e.get(M);
613
- R && U.right > n && U.left < r && Math.abs(R.left - U.left) > 0.5 && f.set(M, R.left - U.left);
704
+ if (!l) return;
705
+ const t = l.getBoundingClientRect(), a = Math.max(0, t.top), o = Math.min(window.innerHeight, t.bottom), n = Math.max(0, t.left), c = Math.min(window.innerWidth, t.right);
706
+ if (a >= o || n >= c) return;
707
+ const m = /* @__PURE__ */ new Map();
708
+ for (const [u, _] of _t()) {
709
+ const E = e.get(u);
710
+ E && _.right > n && _.left < c && Math.abs(E.left - _.left) > 0.5 && m.set(u, E.left - _.left);
614
711
  }
615
- const k = [];
616
- for (const M of Array.from(
617
- a.querySelectorAll("thead tr,tbody tr,tfoot tr")
712
+ const b = [];
713
+ for (const u of Array.from(
714
+ l.querySelectorAll("thead tr,tbody tr,tfoot tr")
618
715
  )) {
619
- const U = M.getBoundingClientRect();
620
- if (U.top >= o) break;
621
- if (!(U.bottom <= l)) {
622
- for (const R of Array.from(M.children))
623
- if (R instanceof HTMLElement && f.has(R.dataset.columnKey || "") && k.push(R), k.length >= Mt) break;
624
- if (k.length >= Mt) break;
716
+ const _ = u.getBoundingClientRect();
717
+ if (_.top >= o) break;
718
+ if (!(_.bottom <= a)) {
719
+ for (const E of Array.from(u.children))
720
+ if (E instanceof HTMLElement && m.has(E.dataset.columnKey || "") && b.push(E), b.length >= Yt) break;
721
+ if (b.length >= Yt) break;
625
722
  }
626
723
  }
627
- const _ = Ue.value === "full" ? 280 : 180;
628
- for (const M of k) {
629
- const U = f.get(M.dataset.columnKey), R = M.animate(
724
+ const O = lt.value === "full" ? 280 : 180;
725
+ for (const u of b) {
726
+ const _ = m.get(u.dataset.columnKey), E = u.animate(
630
727
  [
631
- { transform: "translateX(" + U + "px)" },
728
+ { transform: "translateX(" + _ + "px)" },
632
729
  { transform: "translateX(0)" }
633
730
  ],
634
- { duration: _, easing: "cubic-bezier(.2,.8,.2,1)" }
731
+ { duration: O, easing: "cubic-bezier(.2,.8,.2,1)" }
635
732
  );
636
- ze.add(R), R.onfinish = () => ze.delete(R), R.oncancel = () => ze.delete(R);
733
+ je.add(E), E.onfinish = () => je.delete(E), E.oncancel = () => je.delete(E);
637
734
  }
638
735
  }
639
- async function ka(e, a) {
640
- if (!lt(a)) {
641
- fe();
736
+ async function Xl(e, l) {
737
+ if (!wt(l)) {
738
+ ce();
642
739
  return;
643
740
  }
644
741
  e.preventDefault();
645
- const t = Tt(
646
- a,
742
+ const t = Zt(
743
+ l,
647
744
  e.clientX,
648
745
  e.currentTarget
649
- ), l = E.value.filter((f) => f !== de.value), o = l.indexOf(t.key);
746
+ ), a = j.value.filter((m) => m !== Ke.value), o = a.indexOf(t.key);
650
747
  if (o < 0) {
651
- fe();
748
+ ce();
652
749
  return;
653
750
  }
654
- if (l.splice(
751
+ if (a.splice(
655
752
  o + (t.position === "after" ? 1 : 0),
656
753
  0,
657
- de.value
658
- ), fe(), l.every((f, k) => f === E.value[k])) return;
659
- Re();
660
- const n = at, r = Ue.value === "off" ? /* @__PURE__ */ new Map() : Et();
661
- E.value = l, await pe(), n === at && ha(r);
662
- }
663
- function Kt() {
664
- Y(), fe(), Re(), E.value = [...F.value.keys()], C.value = [], K.value = {};
665
- }
666
- function ba() {
667
- const e = A.value, a = (n) => '"' + n.replace(/"/g, '""') + '"', t = [
668
- e.map((n) => a(n.label)).join(","),
669
- ...be.value.map(
670
- ({ row: n }) => e.map((r) => a(re(n, r))).join(",")
754
+ Ke.value
755
+ ), ce(), a.every((m, b) => m === j.value[b])) return;
756
+ De();
757
+ const n = kt, c = lt.value === "off" ? /* @__PURE__ */ new Map() : _t();
758
+ j.value = a, await ye(), n === kt && Jl(c);
759
+ }
760
+ function el(e) {
761
+ L(), ce(), De(), It(e);
762
+ }
763
+ function tl() {
764
+ el({});
765
+ }
766
+ function Yl() {
767
+ const e = K.value, l = (n) => '"' + n.replace(/"/g, '""') + '"', t = [
768
+ e.map((n) => l(n.label)).join(","),
769
+ ...Le.value.map(
770
+ ({ row: n }) => e.map((c) => l(Se(n, c))).join(",")
671
771
  )
672
- ], l = URL.createObjectURL(
772
+ ], a = URL.createObjectURL(
673
773
  new Blob(["\uFEFF" + t.join(`\r
674
774
  `)], {
675
775
  type: "text/csv;charset=utf-8"
676
776
  })
677
777
  ), o = document.createElement("a");
678
- o.href = l, o.download = "projectflow-table.csv", o.click(), setTimeout(() => URL.revokeObjectURL(l), 1e3);
778
+ o.href = a, o.download = "projectflow-table.csv", o.click(), setTimeout(() => URL.revokeObjectURL(a), 1e3);
679
779
  }
680
- const wa = c(
780
+ const Zl = f(
681
781
  () => typeof i.maxHeight == "number" ? i.maxHeight > 0 && Number.isFinite(i.maxHeight) ? i.maxHeight + "px" : void 0 : i.maxHeight
682
782
  );
683
- function Sa(e) {
684
- var a;
685
- (a = ge.value) == null || a.scrollTo(e);
783
+ function _l(e) {
784
+ var l;
785
+ (l = le.value) == null || l.scrollTo(e);
786
+ }
787
+ function ea(e) {
788
+ var t;
789
+ const l = [
790
+ ...((t = le.value) == null ? void 0 : t.querySelectorAll("[data-grid-row]")) ?? []
791
+ ].find((a) => a.dataset.gridRow === W(e));
792
+ return l == null || l.scrollIntoView({ block: "nearest", inline: "nearest" }), !!l;
686
793
  }
687
- function Ca(e) {
794
+ function ve(e) {
795
+ const { item: l, pageIndex: t } = e;
796
+ return {
797
+ row: l.row,
798
+ rowKey: l.id,
799
+ index: l.index,
800
+ pageIndex: t,
801
+ depth: l.depth,
802
+ selected: qe.value.has(l.id),
803
+ current: Re.value === l.id
804
+ };
805
+ }
806
+ function fe(e, l, t) {
807
+ return { ...ve(e), column: l, columnIndex: t, value: Ne(e.item.row, l) };
808
+ }
809
+ function Y(e, l) {
688
810
  var t;
689
- const a = [
690
- ...((t = ge.value) == null ? void 0 : t.querySelectorAll("[data-grid-row]")) ?? []
691
- ].find((l) => l.dataset.gridRow === st(e));
692
- return a == null || a.scrollIntoView({ block: "nearest", inline: "nearest" }), !!a;
693
- }
694
- Ot({
695
- resetColumns: Kt,
696
- getQuery: we,
811
+ return {
812
+ column: e,
813
+ columnIndex: l,
814
+ sort: (t = x.value.find((a) => a.key === e.key)) == null ? void 0 : t.direction,
815
+ filter: rt(e.key),
816
+ pinned: q(e)
817
+ };
818
+ }
819
+ function Ee(e, l) {
820
+ return typeof e == "function" ? e(l) : e;
821
+ }
822
+ function ta(e, l) {
823
+ i.highlightCurrentRow && !l.target.closest("button,a,input,select,textarea,[contenteditable]") && gt(e.item.id), p("rowClick", e.item.row);
824
+ }
825
+ function ll(e, l, t) {
826
+ const a = Y(l, t);
827
+ e.type === "contextmenu" && p("headerContextmenu", a, e), V.open({ ...a, type: "header" }, e);
828
+ }
829
+ function la(e, l) {
830
+ const t = ve(l);
831
+ p("rowContextmenu", t, e), V.open({ ...t, type: "row" }, e);
832
+ }
833
+ function aa(e, l, t, a) {
834
+ const o = fe(l, t, a);
835
+ p("cellContextmenu", o, e), p("rowContextmenu", ve(l), e), !e.target.closest("input,textarea,[contenteditable]") && V.open({ ...o, type: "cell" }, e);
836
+ }
837
+ function oa(e, l, t, a) {
838
+ p("cellDblclick", fe(l, t, a), e), !e.defaultPrevented && !e.target.closest("button,a,input,select,textarea,[contenteditable]") && Vt(l.item, t);
839
+ }
840
+ function na(e) {
841
+ if (e.type === "header") {
842
+ const { column: t, pinned: a, sort: o, filter: n } = e;
843
+ return [
844
+ ...t.sortable === !1 ? [] : [
845
+ { label: "升序排列", value: "sort-asc", disabled: o === "asc" },
846
+ { label: "降序排列", value: "sort-desc", disabled: o === "desc" },
847
+ { label: "清除本列排序", value: "clear-sort", disabled: !o }
848
+ ],
849
+ ...t.filterable === !1 ? [] : [
850
+ { label: "筛选此列", value: "filter" },
851
+ { label: "清除本列筛选", value: "clear-filter", disabled: !n }
852
+ ],
853
+ ...t.pinnable === !1 ? [] : [
854
+ { label: "固定在左侧", value: "pin-left", disabled: a === "left" },
855
+ { label: "固定在右侧", value: "pin-right", disabled: a === "right" },
856
+ { label: "取消固定", value: "unpin", disabled: !a }
857
+ ],
858
+ { label: "隐藏此列", value: "hide-column", disabled: t.hideable === !1 || K.value.length <= 1 },
859
+ { label: "恢复列宽", value: "reset-width", disabled: !Object.hasOwn(R.value, t.key) }
860
+ ];
861
+ }
862
+ const l = Me.value.get(e.rowKey);
863
+ return [
864
+ ...i.selectable ? [{ label: e.selected ? "取消选择此行" : "选择此行", value: "toggle-selection", disabled: !l || !ze(l) }] : [],
865
+ ...i.highlightCurrentRow ? [{ label: "设为当前行", value: "current-row", disabled: e.current }] : [],
866
+ ...e.type === "cell" && i.editable && e.column.editable ? [{ label: "编辑此单元格", value: "edit-cell" }] : []
867
+ ];
868
+ }
869
+ const V = Sa({
870
+ enabled: (e) => !!i.contextMenu && !ue.value && (e.type === "header" ? K.value.some((l) => l.key === e.column.key) : Fe.value.has(W(e.rowKey))),
871
+ config: () => i.contextMenu,
872
+ defaults: na,
873
+ select(e, l, t) {
874
+ if (l.type === "header") {
875
+ const a = S.value.get(l.column.key);
876
+ e === "sort-asc" && Ye(a, "asc"), e === "sort-desc" && Ye(a, "desc"), e === "clear-sort" && J({ sort: x.value.filter((o) => o.key !== a.key), page: 1 }), e === "filter" && requestAnimationFrame(() => {
877
+ var o;
878
+ (o = le.value) != null && o.isConnected && K.value.includes(a) && jt(a);
879
+ }), e === "clear-filter" && Nt(a.key, ""), e === "pin-left" && tt(a.key, "left"), e === "pin-right" && tt(a.key, "right"), e === "unpin" && tt(a.key, null), e === "hide-column" && bt(a.key, !1), e === "reset-width" && Ut(a.key);
880
+ } else if (e === "toggle-selection" && Ie(l.rowKey), e === "current-row" && gt(l.rowKey), e === "edit-cell" && l.type === "cell") {
881
+ const a = Fe.value.get(W(l.rowKey)), o = S.value.get(l.column.key);
882
+ a && o && requestAnimationFrame(() => {
883
+ !ue.value && Fe.value.get(W(l.rowKey)) === a && K.value.includes(o) && Vt(a, o);
884
+ });
885
+ }
886
+ p("contextMenuSelect", e, l, t);
887
+ }
888
+ });
889
+ F([ue, () => i.contextMenu, Ve, H], V.close), fl({
890
+ resetColumns: tl,
891
+ getColumnLayout: mt,
892
+ applyColumnLayout: el,
893
+ setGroupBy: Tt,
894
+ setGroupsExpanded: Kl,
895
+ getQuery: Oe,
697
896
  setQuery: J,
698
- resetQuery: jt,
699
- reload: Ge,
700
- getSelection: bt,
701
- clearSelection: na,
702
- toggleRowSelection: et,
703
- scrollTo: Sa,
704
- scrollToRow: Ca
897
+ resetQuery: bl,
898
+ reload: ct,
899
+ getSelection: $t,
900
+ clearSelection: Ll,
901
+ toggleRowSelection: Ie,
902
+ scrollTo: _l,
903
+ scrollToRow: ea,
904
+ focusRow: (e) => At.focusRow(W(e)),
905
+ getCurrentRowKey: () => Re.value,
906
+ setCurrentRow: gt,
907
+ setColumnVisibility: bt,
908
+ pinColumn: tt,
909
+ resizeColumn: $l,
910
+ resetColumnWidth: Ut
705
911
  });
706
- function ot(e) {
707
- je.value && !je.value.contains(e.target) && (I.value = !1);
912
+ function Ct(e) {
913
+ nt.value && !nt.value.contains(e.target) && (ae.value = !1);
708
914
  }
709
- L(I, (e) => {
710
- e ? document.addEventListener("pointerdown", ot) : document.removeEventListener("pointerdown", ot);
915
+ F(ae, (e) => {
916
+ e ? document.addEventListener("pointerdown", Ct) : document.removeEventListener("pointerdown", Ct);
711
917
  });
712
- function At() {
713
- fe(), Re(), Y(), I.value = !1, document.removeEventListener("pointerdown", ot);
918
+ function al() {
919
+ V.close(), ce(), De(), L(), ae.value = !1, document.removeEventListener("pointerdown", Ct);
714
920
  }
715
- return Ra(At), Ma(At), (e, a) => (s(), u("section", Ta(m(qt), {
716
- class: ["hys-ui-pf-grid", "hys-ui-pf-grid--" + v.density],
921
+ return sa(al), ua(al), (e, l) => (r(), d("section", ee(v(pl), {
922
+ class: ["hys-ui-pf-grid", ["hys-ui-pf-grid--" + s.density, { "hys-ui-pf-grid-striped": s.striped }]],
717
923
  "aria-label": "数据表格",
718
924
  ref_key: "tableRef",
719
- ref: te,
720
- "aria-busy": Fe.value || void 0
925
+ ref: ge,
926
+ "aria-busy": ue.value || void 0
721
927
  }), [
722
- y("div", Ia, [
723
- y("label", ja, [
724
- a[14] || (a[14] = y("span", null, "搜索", -1)),
725
- g(Ie, {
928
+ y("div", Ta, [
929
+ y("label", Da, [
930
+ l[14] || (l[14] = y("span", null, "搜索", -1)),
931
+ k(ot, {
726
932
  size: "sm",
727
- modelValue: Pe.value,
728
- "onUpdate:modelValue": a[0] || (a[0] = (t) => Pe.value = t),
933
+ modelValue: it.value,
934
+ "onUpdate:modelValue": l[0] || (l[0] = (t) => it.value = t),
729
935
  type: "search",
730
936
  placeholder: "搜索全部列…",
731
937
  "aria-label": "搜索表格",
732
938
  clearable: ""
733
939
  }, null, 8, ["modelValue"])
734
940
  ]),
735
- v.groupable ? (s(), u("label", Pa, [
736
- a[15] || (a[15] = V("分组 ", -1)),
737
- g(Lt, {
941
+ s.groupable ? (r(), d("label", Ea, [
942
+ l[15] || (l[15] = T("分组 ", -1)),
943
+ k(cl, {
738
944
  size: "sm",
739
- modelValue: he.value,
740
- "onUpdate:modelValue": a[1] || (a[1] = (t) => he.value = t),
945
+ "model-value": we.value,
946
+ "onUpdate:modelValue": l[1] || (l[1] = (t) => Tt(String(t ?? ""))),
741
947
  "aria-label": "按列分组",
742
948
  options: [
743
949
  { label: "不分组", value: "" },
744
- ...Xt.value.map((t) => ({ label: t.label, value: t.key }))
950
+ ...Sl.value.map((t) => ({ label: t.label, value: t.key }))
745
951
  ]
746
- }, null, 8, ["modelValue", "options"])
747
- ])) : h("", !0),
748
- v.editable && b.value.length ? (s(), u("div", Qa, [
749
- g(Lt, {
952
+ }, null, 8, ["model-value", "options"])
953
+ ])) : g("", !0),
954
+ s.editable && w.value.length ? (r(), d("div", Na, [
955
+ k(cl, {
750
956
  size: "sm",
751
- modelValue: ke.value,
752
- "onUpdate:modelValue": a[2] || (a[2] = (t) => ke.value = t),
957
+ modelValue: Be.value,
958
+ "onUpdate:modelValue": l[2] || (l[2] = (t) => Be.value = t),
753
959
  "aria-label": "批量编辑字段",
754
960
  options: [
755
961
  { label: "选择编辑列", value: "" },
756
- ...v.columns.filter((t) => t.editable).map((t) => ({ label: t.label, value: t.key }))
962
+ ...s.columns.filter((t) => t.editable).map((t) => ({ label: t.label, value: t.key }))
757
963
  ]
758
964
  }, null, 8, ["modelValue", "options"]),
759
- g(Ie, {
965
+ k(ot, {
760
966
  size: "sm",
761
- modelValue: Ae.value,
762
- "onUpdate:modelValue": a[3] || (a[3] = (t) => Ae.value = t),
967
+ modelValue: Je.value,
968
+ "onUpdate:modelValue": l[3] || (l[3] = (t) => Je.value = t),
763
969
  "aria-label": "批量编辑值",
764
970
  placeholder: "新值"
765
971
  }, null, 8, ["modelValue"]),
766
- g(T, {
972
+ k(B, {
767
973
  variant: "ghost",
768
974
  size: "sm",
769
975
  type: "button",
770
- disabled: !ke.value,
771
- onClick: ta
976
+ disabled: !Be.value,
977
+ onClick: Dl
772
978
  }, {
773
- default: z(() => [
774
- V("应用到 " + O(b.value.length) + " 行", 1)
979
+ default: M(() => [
980
+ T("应用到 " + z(w.value.length) + " 行", 1)
775
981
  ]),
776
982
  _: 1
777
983
  }, 8, ["disabled"])
778
- ])) : h("", !0),
779
- j.value ? (s(), D(T, {
984
+ ])) : g("", !0),
985
+ oe.value ? (r(), D(B, {
780
986
  key: 2,
781
987
  variant: "ghost",
782
988
  size: "sm",
783
989
  type: "button",
784
- onClick: a[4] || (a[4] = (t) => J({ filters: {}, page: 1 }))
990
+ onClick: l[4] || (l[4] = (t) => J({ filters: {}, page: 1 }))
785
991
  }, {
786
- default: z(() => [...a[16] || (a[16] = [
787
- V("清空筛选", -1)
992
+ default: M(() => [...l[16] || (l[16] = [
993
+ T("清空筛选", -1)
788
994
  ])]),
789
995
  _: 1
790
- })) : h("", !0),
791
- y("span", Wa, O(We.value) + " 条记录 · 已选 " + O(b.value.length), 1),
996
+ })) : g("", !0),
997
+ y("span", Ba, z(ut.value) + " 条记录 · 已选 " + z(w.value.length), 1),
792
998
  y("div", {
793
999
  class: "hys-ui-pf-grid-menu",
794
1000
  ref_key: "menuRef",
795
- ref: je
1001
+ ref: nt
796
1002
  }, [
797
- g(T, {
1003
+ k(B, {
798
1004
  variant: "ghost",
799
1005
  size: "sm",
800
1006
  type: "button",
801
- onClick: a[5] || (a[5] = (t) => I.value = !I.value),
802
- "aria-expanded": I.value,
1007
+ onClick: l[5] || (l[5] = (t) => ae.value = !ae.value),
1008
+ "aria-expanded": ae.value,
803
1009
  "aria-label": "配置显示列"
804
1010
  }, {
805
- default: z(() => [
806
- g(m(Ea), {
1011
+ default: M(() => [
1012
+ k(v(da), {
807
1013
  size: 16,
808
1014
  "aria-hidden": "true"
809
1015
  }),
810
- a[17] || (a[17] = V(" 列设置", -1))
1016
+ l[17] || (l[17] = T(" 列设置", -1))
811
1017
  ]),
812
1018
  _: 1
813
1019
  }, 8, ["aria-expanded"]),
814
- g(m(Da), {
1020
+ k(v(ya), {
815
1021
  "popup-transition": i.popupTransition,
816
1022
  "popup-transition-duration": i.popupTransitionDuration,
817
- onInactive: a[7] || (a[7] = (t) => I.value = !1)
1023
+ onInactive: l[7] || (l[7] = (t) => ae.value = !1)
818
1024
  }, {
819
- default: z(() => [
820
- I.value ? (s(), u("div", Ja, [
821
- a[19] || (a[19] = y("strong", null, "显示列与排序", -1)),
822
- g(Ba, {
1025
+ default: M(() => [
1026
+ ae.value ? (r(), d("div", Aa, [
1027
+ l[19] || (l[19] = y("strong", null, "显示列与排序", -1)),
1028
+ k(Ra, {
823
1029
  class: "hys-ui-pf-grid-settings-list",
824
- "model-value": ra.value,
825
- "onUpdate:modelValue": a[6] || (a[6] = (t) => E.value = t.map((l) => l.id))
1030
+ "model-value": ql.value,
1031
+ "onUpdate:modelValue": l[6] || (l[6] = (t) => j.value = t.map((a) => a.id))
826
1032
  }, {
827
- item: z(({ item: t }) => {
828
- var l;
1033
+ item: M(({ item: t }) => {
1034
+ var a;
829
1035
  return [
830
- g(rt, {
831
- "model-value": !C.value.includes(t.id),
1036
+ k(Rt, {
1037
+ "model-value": !A.value.includes(t.id),
832
1038
  label: t.label,
833
- disabled: ((l = v.columns.find((o) => o.key === t.id)) == null ? void 0 : l.hideable) === !1 || !C.value.includes(t.id) && A.value.length === 1,
834
- "onUpdate:modelValue": (o) => ua(
835
- v.columns.find((n) => n.key === t.id)
1039
+ disabled: ((a = s.columns.find((o) => o.key === t.id)) == null ? void 0 : a.hideable) === !1 || !A.value.includes(t.id) && K.value.length === 1,
1040
+ "onUpdate:modelValue": (o) => Hl(
1041
+ s.columns.find((n) => n.key === t.id)
836
1042
  )
837
1043
  }, null, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])
838
1044
  ];
839
1045
  }),
840
1046
  _: 1
841
1047
  }, 8, ["model-value"]),
842
- g(T, {
1048
+ k(B, {
843
1049
  variant: "ghost",
844
1050
  size: "sm",
845
1051
  type: "button",
846
- onClick: Kt
1052
+ onClick: tl
847
1053
  }, {
848
- default: z(() => [...a[18] || (a[18] = [
849
- V("恢复默认列", -1)
1054
+ default: M(() => [...l[18] || (l[18] = [
1055
+ T("恢复默认列", -1)
850
1056
  ])]),
851
1057
  _: 1
852
1058
  })
853
- ])) : h("", !0)
1059
+ ])) : g("", !0)
854
1060
  ]),
855
1061
  _: 1
856
1062
  }, 8, ["popup-transition", "popup-transition-duration"])
857
1063
  ], 512),
858
- g(T, {
1064
+ k(B, {
859
1065
  variant: "ghost",
860
1066
  size: "sm",
861
1067
  type: "button",
862
- onClick: ba
1068
+ onClick: Yl
863
1069
  }, {
864
- default: z(() => [...a[20] || (a[20] = [
865
- V("导出 CSV", -1)
1070
+ default: M(() => [...l[20] || (l[20] = [
1071
+ T("导出 CSV", -1)
866
1072
  ])]),
867
1073
  _: 1
868
- })
1074
+ }),
1075
+ $(e.$slots, "toolbar-actions", {
1076
+ query: se.value,
1077
+ selectedKeys: w.value
1078
+ }, void 0, !0)
869
1079
  ]),
870
1080
  y("div", {
871
1081
  ref_key: "scrollRef",
872
- ref: ge,
1082
+ ref: le,
873
1083
  class: "hys-ui-pf-grid-scroll",
874
- style: $({ maxHeight: wa.value }),
1084
+ style: I({ maxHeight: Zl.value }),
875
1085
  tabindex: "0",
876
1086
  role: "region",
877
1087
  "aria-label": "表格滚动区域",
878
- onDragleave: ga
1088
+ onDragleave: Wl,
1089
+ onScroll: l[13] || (l[13] = //@ts-ignore
1090
+ (...t) => v(V).close && v(V).close(...t))
879
1091
  }, [
880
1092
  y("table", {
881
- class: ve({ "hys-ui-pf-grid-sticky-head": v.stickyHeader }),
882
- style: $({ minWidth: da.value + "px" })
1093
+ class: pe({ "hys-ui-pf-grid-sticky-head": s.stickyHeader }),
1094
+ style: I({ minWidth: Il.value + "px" })
883
1095
  }, [
884
- y("colgroup", null, [
885
- v.selectable ? (s(), u("col", Xa)) : h("", !0),
886
- (s(!0), u(N, null, ye(G.value, (t) => (s(), u("col", {
887
- key: t.key,
888
- style: $({ width: B(t) + "px" })
1096
+ s.caption ? (r(), d("caption", La, z(s.caption), 1)) : g("", !0),
1097
+ s.selectable ? (r(), d("colgroup", Va, [...l[21] || (l[21] = [
1098
+ y("col", { style: { width: "44px" } }, null, -1)
1099
+ ])])) : g("", !0),
1100
+ (r(!0), d(N, null, te(ht.value, (t) => (r(), d("colgroup", {
1101
+ key: t.id
1102
+ }, [
1103
+ (r(!0), d(N, null, te(t.columns, (a) => (r(), d("col", {
1104
+ key: a.key,
1105
+ style: I({ width: Q(a) + "px" })
889
1106
  }, null, 4))), 128))
890
- ]),
1107
+ ]))), 128)),
891
1108
  y("thead", null, [
1109
+ Fl.value ? (r(), d("tr", Oa, [
1110
+ s.selectable ? (r(), d("th", Fa)) : g("", !0),
1111
+ (r(!0), d(N, null, te(ht.value, (t) => (r(), d("th", {
1112
+ key: t.id,
1113
+ scope: t.group ? "colgroup" : void 0,
1114
+ colspan: t.columns.length,
1115
+ style: I(Ue(t.pinned === "right" ? t.columns[t.columns.length - 1] : t.columns[0], !0))
1116
+ }, [
1117
+ t.group ? $(e.$slots, "header-group", {
1118
+ group: t.group,
1119
+ columns: t.columns,
1120
+ pinned: t.pinned
1121
+ }, () => [
1122
+ T(z(t.group.label), 1)
1123
+ ], !0, 0) : g("", !0)
1124
+ ], 12, qa))), 128))
1125
+ ])) : g("", !0),
892
1126
  y("tr", null, [
893
- v.selectable ? (s(), u("th", Ga, [
894
- v.selectionType !== "radio" ? (s(), D(rt, {
1127
+ s.selectable ? (r(), d("th", Ha, [
1128
+ s.selectionType !== "radio" ? (r(), D(Rt, {
895
1129
  key: 0,
896
1130
  "aria-label": "选择当前页全部行",
897
- "model-value": kt.value,
898
- indeterminate: oa.value && !kt.value,
899
- disabled: !Se.value.length || Fe.value || !!m(Ve),
900
- "onUpdate:modelValue": ia
901
- }, null, 8, ["model-value", "indeterminate", "disabled"])) : (s(), u("span", Ya, "选择"))
902
- ])) : h("", !0),
903
- (s(!0), u(N, null, ye(G.value, (t) => {
904
- var l, o, n, r, f, k, _;
905
- return s(), u("th", {
1131
+ "model-value": Ht.value,
1132
+ indeterminate: Bl.value && !Ht.value,
1133
+ disabled: !He.value.length || ue.value || !!v(Ae),
1134
+ "onUpdate:modelValue": Vl
1135
+ }, null, 8, ["model-value", "indeterminate", "disabled"])) : (r(), d("span", $a, "选择"))
1136
+ ])) : g("", !0),
1137
+ (r(!0), d(N, null, te(H.value, (t, a) => {
1138
+ var o, n, c, m, b, O, Z;
1139
+ return r(), d("th", {
906
1140
  key: t.key,
907
1141
  scope: "col",
1142
+ tabindex: s.contextMenu ? -1 : void 0,
908
1143
  "data-column-key": t.key,
909
- class: ve({ "hys-ui-is-column-dragging": de.value === t.key }),
910
- "data-drop-position": ((l = Z.value) == null ? void 0 : l.key) === t.key ? Z.value.position : void 0,
1144
+ class: pe([Ee(s.headerClassName, Y(t, a)), { "hys-ui-is-column-dragging": Ke.value === t.key, "hys-ui-pf-grid-header-wrap": t.headerWrap }]),
1145
+ "data-drop-position": ((o = de.value) == null ? void 0 : o.key) === t.key ? de.value.position : void 0,
911
1146
  draggable: t.reorderable !== !1,
912
- onDragstart: (d) => pa(d, t),
913
- onDragend: fe,
914
- onDragover: (d) => ma(d, t),
915
- onDrop: (d) => ka(d, t),
916
- "aria-sort": ((o = S.value.find((d) => d.key === t.key)) == null ? void 0 : o.direction) === "asc" ? "ascending" : ((n = S.value.find((d) => d.key === t.key)) == null ? void 0 : n.direction) === "desc" ? "descending" : "none",
917
- style: $({ ...He(t, !0), textAlign: t.align || "left" })
1147
+ onDragstart: (u) => Gl(u, t),
1148
+ onDragend: ce,
1149
+ onDragover: (u) => Ql(u, t),
1150
+ onDrop: (u) => Xl(u, t),
1151
+ onClick: (u) => p("headerClick", Y(t, a), u),
1152
+ onContextmenu: (u) => ll(u, t, a),
1153
+ onKeydown: (u) => v(V).keydown({ ...Y(t, a), type: "header" }, u),
1154
+ "aria-sort": ((n = x.value.find((u) => u.key === t.key)) == null ? void 0 : n.direction) === "asc" ? "ascending" : ((c = x.value.find((u) => u.key === t.key)) == null ? void 0 : c.direction) === "desc" ? "descending" : "none",
1155
+ style: I([Ee(s.headerStyle, Y(t, a)), { ...Ue(t, !0), textAlign: t.headerAlign || t.align || "left" }])
918
1156
  }, [
919
- y("div", _a, [
920
- y("div", el, [
921
- g(T, {
1157
+ y("div", Ua, [
1158
+ y("div", {
1159
+ class: "hys-ui-pf-grid-sort-group",
1160
+ style: I({ justifyContent: (t.headerAlign ?? t.align) === "center" ? "center" : (t.headerAlign ?? t.align) === "right" ? "end" : "start" })
1161
+ }, [
1162
+ t.sortable !== !1 ? (r(), D(B, {
1163
+ key: 0,
922
1164
  variant: "ghost",
923
1165
  size: "sm",
924
1166
  type: "button",
925
- class: ve(["hys-ui-pf-grid-sort", {
926
- "hys-ui-is-sorted": S.value.some(
927
- (d) => d.key === t.key
1167
+ class: pe(["hys-ui-pf-grid-sort", {
1168
+ "hys-ui-is-sorted": x.value.some(
1169
+ (u) => u.key === t.key
928
1170
  )
929
1171
  }]),
930
- onClick: (d) => Jt(t)
1172
+ onClick: (u) => Cl(t)
931
1173
  }, {
932
- default: z(() => [
933
- y("span", tl, O(t.label), 1)
1174
+ default: M(() => [
1175
+ y("span", Pa, [
1176
+ $(e.$slots, "header-" + t.key, ee({ ref_for: !0 }, Y(t, a)), () => [
1177
+ $(e.$slots, "header-cell", ee({ ref_for: !0 }, Y(t, a)), () => [
1178
+ T(z(t.label), 1)
1179
+ ], !0)
1180
+ ], !0)
1181
+ ])
934
1182
  ]),
935
1183
  _: 2
936
- }, 1032, ["class", "onClick"]),
937
- t.sortable !== !1 ? (s(), u("span", {
938
- key: 0,
1184
+ }, 1032, ["class", "onClick"])) : (r(), d("span", ja, [
1185
+ $(e.$slots, "header-" + t.key, ee({ ref_for: !0 }, Y(t, a)), () => [
1186
+ $(e.$slots, "header-cell", ee({ ref_for: !0 }, Y(t, a)), () => [
1187
+ T(z(t.label), 1)
1188
+ ], !0)
1189
+ ], !0)
1190
+ ])),
1191
+ t.sortable !== !1 ? (r(), d("span", {
1192
+ key: 2,
939
1193
  class: "hys-ui-pf-grid-sort-controls",
940
1194
  role: "group",
941
1195
  "aria-label": t.label + "排序"
942
1196
  }, [
943
- g(T, {
1197
+ k(B, {
944
1198
  type: "button",
945
1199
  variant: "ghost",
946
1200
  size: "sm",
947
- class: ve(["hys-ui-pf-grid-sort-direction", {
948
- "hys-ui-is-active": ((r = S.value.find((d) => d.key === t.key)) == null ? void 0 : r.direction) === "asc"
1201
+ class: pe(["hys-ui-pf-grid-sort-direction", {
1202
+ "hys-ui-is-active": ((m = x.value.find((u) => u.key === t.key)) == null ? void 0 : m.direction) === "asc"
949
1203
  }]),
950
1204
  "aria-label": t.label + "升序",
951
- "aria-pressed": ((f = S.value.find((d) => d.key === t.key)) == null ? void 0 : f.direction) === "asc",
952
- onClick: q((d) => pt(t, "asc"), ["stop"])
1205
+ "aria-pressed": ((b = x.value.find((u) => u.key === t.key)) == null ? void 0 : b.direction) === "asc",
1206
+ onClick: U((u) => Bt(t, "asc"), ["stop"])
953
1207
  }, {
954
- default: z(() => [
955
- g(m(Ka), {
1208
+ default: M(() => [
1209
+ k(v(ca), {
956
1210
  size: 11,
957
1211
  "aria-hidden": "true"
958
1212
  })
959
1213
  ]),
960
1214
  _: 1
961
1215
  }, 8, ["class", "aria-label", "aria-pressed", "onClick"]),
962
- g(T, {
1216
+ k(B, {
963
1217
  type: "button",
964
1218
  variant: "ghost",
965
1219
  size: "sm",
966
- class: ve(["hys-ui-pf-grid-sort-direction", {
967
- "hys-ui-is-active": ((k = S.value.find((d) => d.key === t.key)) == null ? void 0 : k.direction) === "desc"
1220
+ class: pe(["hys-ui-pf-grid-sort-direction", {
1221
+ "hys-ui-is-active": ((O = x.value.find((u) => u.key === t.key)) == null ? void 0 : O.direction) === "desc"
968
1222
  }]),
969
1223
  "aria-label": t.label + "降序",
970
- "aria-pressed": ((_ = S.value.find((d) => d.key === t.key)) == null ? void 0 : _.direction) === "desc",
971
- onClick: q((d) => pt(t, "desc"), ["stop"])
1224
+ "aria-pressed": ((Z = x.value.find((u) => u.key === t.key)) == null ? void 0 : Z.direction) === "desc",
1225
+ onClick: U((u) => Bt(t, "desc"), ["stop"])
972
1226
  }, {
973
- default: z(() => [
974
- g(m(it), {
1227
+ default: M(() => [
1228
+ k(v(St), {
975
1229
  size: 11,
976
1230
  "aria-hidden": "true"
977
1231
  })
978
1232
  ]),
979
1233
  _: 1
980
1234
  }, 8, ["class", "aria-label", "aria-pressed", "onClick"])
981
- ], 8, al)) : h("", !0)
982
- ]),
983
- t.filterable !== !1 ? (s(), D(T, {
1235
+ ], 8, Ga)) : g("", !0)
1236
+ ], 4),
1237
+ t.filterable !== !1 ? (r(), D(B, {
984
1238
  key: 0,
985
1239
  variant: "ghost",
986
1240
  size: "sm",
987
1241
  type: "button",
988
- class: ve(["hys-ui-pf-grid-filter", {
989
- "hys-ui-is-filtered": !!ct(t.key),
990
- "hys-ui-is-filtering": j.value && ae.value === t.key
1242
+ class: pe(["hys-ui-pf-grid-filter", {
1243
+ "hys-ui-is-filtered": !!rt(t.key),
1244
+ "hys-ui-is-filtering": oe.value && me.value === t.key
991
1245
  }]),
992
1246
  "aria-label": "筛选" + t.label,
993
- "aria-expanded": j.value,
994
- "aria-controls": m(ut),
995
- title: j.value && ae.value === t.key ? "再次点击收起筛选(Esc)" : "筛选" + t.label,
996
- onClick: (d) => fa(t)
1247
+ "aria-expanded": oe.value,
1248
+ "aria-controls": v(Mt),
1249
+ title: oe.value && me.value === t.key ? "再次点击收起筛选(Esc)" : "筛选" + t.label,
1250
+ onClick: (u) => jt(t)
997
1251
  }, {
998
- default: z(() => [
999
- g(m(Aa), {
1252
+ default: M(() => [
1253
+ k(v(fa), {
1000
1254
  size: 13,
1001
1255
  "aria-hidden": "true"
1002
1256
  })
1003
1257
  ]),
1004
1258
  _: 1
1005
- }, 8, ["aria-label", "aria-expanded", "aria-controls", "title", "class", "onClick"])) : h("", !0),
1006
- t.resizable !== !1 ? (s(), u("span", {
1259
+ }, 8, ["aria-label", "aria-expanded", "aria-controls", "title", "class", "onClick"])) : g("", !0),
1260
+ s.contextMenu ? (r(), D(B, {
1007
1261
  key: 1,
1262
+ variant: "ghost",
1263
+ size: "sm",
1264
+ type: "button",
1265
+ class: "hys-ui-pf-grid-column-menu",
1266
+ "aria-label": "列操作 · " + t.label,
1267
+ "aria-haspopup": "menu",
1268
+ onClick: U((u) => ll(u, t, a), ["stop"])
1269
+ }, {
1270
+ default: M(() => [
1271
+ k(v(va), {
1272
+ size: 14,
1273
+ "aria-hidden": "true"
1274
+ })
1275
+ ]),
1276
+ _: 1
1277
+ }, 8, ["aria-label", "onClick"])) : g("", !0),
1278
+ t.resizable !== !1 ? (r(), d("span", {
1279
+ key: 2,
1008
1280
  class: "hys-ui-pf-grid-resize",
1009
1281
  role: "separator",
1010
1282
  tabindex: "0",
1011
1283
  "aria-label": "调整" + t.label + "列宽",
1012
- onPointerdown: (d) => va(d, t),
1284
+ onPointerdown: (u) => Pl(u, t),
1013
1285
  "aria-orientation": "vertical",
1014
- "aria-valuemin": Math.min(Ne(t), B(t)),
1015
- "aria-valuemax": Math.max(tt(t), B(t)),
1016
- "aria-valuenow": B(t),
1017
- onKeydown: (d) => ya(d, t)
1018
- }, null, 40, ll)) : h("", !0)
1286
+ "aria-valuemin": Math.min(v(dl)(t), Q(t)),
1287
+ "aria-valuemax": Math.max(v(ul)(t), Q(t)),
1288
+ "aria-valuenow": Q(t),
1289
+ onKeydown: (u) => jl(u, t)
1290
+ }, null, 40, Qa)) : g("", !0)
1019
1291
  ])
1020
- ], 46, Za);
1292
+ ], 46, Ia);
1021
1293
  }), 128))
1022
1294
  ]),
1023
- j.value ? (s(), u("tr", {
1024
- key: 0,
1295
+ oe.value ? (r(), d("tr", {
1296
+ key: 1,
1025
1297
  class: "hys-ui-pf-grid-filter-row",
1026
- id: m(ut),
1027
- onKeydown: a[8] || (a[8] = nt(q((t) => wt(), ["stop", "prevent"]), ["esc"])),
1298
+ id: v(Mt),
1299
+ onKeydown: l[8] || (l[8] = nl(U((t) => Pt(), ["stop", "prevent"]), ["esc"])),
1028
1300
  "aria-label": "列筛选"
1029
1301
  }, [
1030
- v.selectable ? (s(), u("td", nl)) : h("", !0),
1031
- (s(!0), u(N, null, ye(G.value, (t) => (s(), u("td", {
1302
+ s.selectable ? (r(), d("td", Ja)) : g("", !0),
1303
+ (r(!0), d(N, null, te(H.value, (t) => (r(), d("td", {
1032
1304
  key: t.key,
1033
1305
  "data-filter-key": t.key,
1034
1306
  "data-column-key": t.key,
1035
- style: $(He(t))
1307
+ style: I(Ue(t))
1036
1308
  }, [
1037
- t.filterable !== !1 ? (s(), D(Ie, {
1309
+ t.filterable !== !1 ? (r(), D(ot, {
1038
1310
  key: 0,
1039
- "model-value": ct(t.key),
1040
- "onUpdate:modelValue": (l) => Pt(t.key, l),
1041
- onFocus: (l) => ae.value = t.key,
1311
+ "model-value": rt(t.key),
1312
+ "onUpdate:modelValue": (a) => Nt(t.key, a),
1313
+ onFocus: (a) => me.value = t.key,
1042
1314
  "aria-label": "过滤" + t.label,
1043
1315
  placeholder: "筛选…",
1044
1316
  clearable: ""
1045
- }, null, 8, ["model-value", "onUpdate:modelValue", "onFocus", "aria-label"])) : h("", !0)
1046
- ], 12, il))), 128))
1047
- ], 40, ol)) : h("", !0)
1317
+ }, null, 8, ["model-value", "onUpdate:modelValue", "onFocus", "aria-label"])) : g("", !0)
1318
+ ], 12, Xa))), 128))
1319
+ ], 40, Wa)) : g("", !0)
1048
1320
  ]),
1049
1321
  y("tbody", null, [
1050
- Fe.value ? (s(), u("tr", sl, [
1322
+ ue.value ? (r(), d("tr", Ya, [
1051
1323
  y("td", {
1052
- colspan: Math.max(1, A.value.length + Number(v.selectable)),
1324
+ colspan: Math.max(1, K.value.length + Number(s.selectable)),
1053
1325
  class: "hys-ui-pf-grid-empty"
1054
1326
  }, [
1055
- y("div", ul, [
1056
- $e(e.$slots, "loading", {}, () => [
1057
- a[21] || (a[21] = V("正在加载…", -1))
1327
+ y("div", _a, [
1328
+ $(e.$slots, "loading", {}, () => [
1329
+ l[22] || (l[22] = T("正在加载…", -1))
1058
1330
  ], !0)
1059
1331
  ])
1060
- ], 8, rl)
1061
- ])) : m(Ve) ? (s(), u("tr", dl, [
1332
+ ], 8, Za)
1333
+ ])) : v(Ae) ? (r(), d("tr", eo, [
1062
1334
  y("td", {
1063
- colspan: Math.max(1, A.value.length + Number(v.selectable)),
1335
+ colspan: Math.max(1, K.value.length + Number(s.selectable)),
1064
1336
  class: "hys-ui-pf-grid-empty"
1065
1337
  }, [
1066
- $e(e.$slots, "error", {
1067
- error: m(Ve).error,
1068
- retry: Ge
1069
- }, () => [
1070
- a[23] || (a[23] = y("span", { role: "status" }, "加载失败", -1)),
1071
- g(T, {
1072
- size: "sm",
1073
- variant: "ghost",
1074
- onClick: Ge
1075
- }, {
1076
- default: z(() => [...a[22] || (a[22] = [
1077
- V("重试", -1)
1078
- ])]),
1079
- _: 1
1080
- })
1081
- ], !0)
1082
- ], 8, cl)
1083
- ])) : (s(), u(N, { key: 2 }, [
1084
- (s(!0), u(N, null, ye(Yt.value, (t) => (s(), u(N, {
1338
+ y("div", lo, [
1339
+ $(e.$slots, "error", {
1340
+ error: v(Ae).error,
1341
+ retry: ct
1342
+ }, () => [
1343
+ l[24] || (l[24] = y("span", { role: "status" }, "加载失败", -1)),
1344
+ k(B, {
1345
+ size: "sm",
1346
+ variant: "ghost",
1347
+ onClick: ct
1348
+ }, {
1349
+ default: M(() => [...l[23] || (l[23] = [
1350
+ T("重试", -1)
1351
+ ])]),
1352
+ _: 1
1353
+ })
1354
+ ], !0)
1355
+ ])
1356
+ ], 8, to)
1357
+ ])) : (r(), d(N, { key: 2 }, [
1358
+ (r(!0), d(N, null, te(vt.value, (t) => (r(), d(N, {
1085
1359
  key: t.key
1086
1360
  }, [
1087
- t.kind === "group" ? (s(), u("tr", fl, [
1361
+ t.kind === "group" ? (r(), d("tr", ao, [
1088
1362
  y("td", {
1089
- colspan: A.value.length + Number(v.selectable)
1363
+ colspan: K.value.length + Number(s.selectable)
1090
1364
  }, [
1091
- g(T, {
1365
+ k(B, {
1092
1366
  variant: "ghost",
1093
1367
  size: "sm",
1094
- "aria-expanded": !se.value.has(t.key),
1095
- onClick: (l) => _t(t.key)
1368
+ "aria-expanded": !re.value.has(t.key),
1369
+ onClick: (a) => zl(t.key)
1096
1370
  }, {
1097
- default: z(() => {
1098
- var l;
1371
+ default: M(() => {
1372
+ var a;
1099
1373
  return [
1100
- (s(), D(Dt(
1101
- se.value.has(t.key) ? m(Ft) : m(it)
1374
+ (r(), D(il(
1375
+ re.value.has(t.key) ? v(rl) : v(St)
1102
1376
  ), {
1103
1377
  size: 15,
1104
1378
  "aria-hidden": "true"
1105
1379
  })),
1106
- V(" " + O((l = F.value.get(he.value)) == null ? void 0 : l.label) + ":" + O(t.label) + " ", 1),
1107
- y("span", null, "(" + O(t.count) + ")", 1)
1380
+ T(" " + z((a = S.value.get(we.value)) == null ? void 0 : a.label) + ":" + z(t.label) + " ", 1),
1381
+ y("span", null, "(" + z(t.rows.length) + ")", 1)
1108
1382
  ];
1109
1383
  }),
1110
1384
  _: 2
1111
- }, 1032, ["aria-expanded", "onClick"])
1112
- ], 8, vl)
1113
- ])) : (s(), u("tr", {
1385
+ }, 1032, ["aria-expanded", "onClick"]),
1386
+ s.groupSummary ? (r(), d("span", no, [
1387
+ (r(!0), d(N, null, te(H.value, (a) => (r(), d(N, {
1388
+ key: a.key
1389
+ }, [
1390
+ a.summary ? (r(), d("span", io, z(a.label) + " " + z(Ft(a, t.rows)), 1)) : g("", !0)
1391
+ ], 64))), 128))
1392
+ ])) : g("", !0)
1393
+ ], 8, oo)
1394
+ ])) : (r(), d("tr", ee({
1114
1395
  key: 1,
1115
- "data-grid-row": m(st)(t.item.id),
1116
- onClick: (l) => x("rowClick", t.item.row)
1117
- }, [
1118
- v.selectable ? (s(), u("td", pl, [
1119
- v.selectionType === "radio" ? (s(), D(Ha, {
1396
+ ref_for: !0
1397
+ }, ee(s.contextMenu ? { tabindex: -1, onKeydown: (a) => v(V).keydown({ ...ve(t), type: "row" }, a) } : {}, v(At).rowNavigationAttrs(v(W)(t.item.id))), {
1398
+ "data-grid-row": v(W)(t.item.id),
1399
+ class: [s.rowClassName && Ee(s.rowClassName, ve(t)), { "hys-ui-pf-grid-current-row": s.highlightCurrentRow && Re.value === t.item.id, "hys-ui-pf-grid-even-row": s.striped && t.pageIndex % 2 === 1 }],
1400
+ style: s.rowStyle && Ee(s.rowStyle, ve(t)),
1401
+ "aria-current": s.highlightCurrentRow && Re.value === t.item.id ? "true" : void 0,
1402
+ onClick: (a) => ta(t, a),
1403
+ onDblclick: (a) => p("rowDblclick", ve(t), a),
1404
+ onContextmenu: (a) => la(a, t)
1405
+ }), [
1406
+ s.selectable ? (r(), d("td", so, [
1407
+ s.selectionType === "radio" ? (r(), D(Ma, {
1120
1408
  key: 0,
1121
- name: m(Bt),
1409
+ name: v(yl),
1122
1410
  "aria-label": "选择第" + (t.pageIndex + 1) + "行",
1123
- "model-value": b.value[0] ?? null,
1411
+ "model-value": w.value[0] ?? null,
1124
1412
  value: t.item.id,
1125
- disabled: !Oe(t.item),
1126
- onClick: a[9] || (a[9] = q(() => {
1413
+ disabled: !ze(t.item),
1414
+ onClick: l[9] || (l[9] = U(() => {
1127
1415
  }, ["stop"])),
1128
- "onUpdate:modelValue": (l) => et(t.item.id, !0)
1129
- }, null, 8, ["name", "aria-label", "model-value", "value", "disabled", "onUpdate:modelValue"])) : (s(), D(rt, {
1416
+ "onUpdate:modelValue": (a) => Ie(t.item.id, !0)
1417
+ }, null, 8, ["name", "aria-label", "model-value", "value", "disabled", "onUpdate:modelValue"])) : (r(), D(Rt, {
1130
1418
  key: 1,
1131
1419
  "aria-label": "选择第" + (t.pageIndex + 1) + "行",
1132
- "model-value": Le.value.has(t.item.id),
1133
- disabled: !Oe(t.item),
1134
- onClick: a[10] || (a[10] = q(() => {
1420
+ "model-value": qe.value.has(t.item.id),
1421
+ disabled: !ze(t.item),
1422
+ onClick: l[10] || (l[10] = U(() => {
1135
1423
  }, ["stop"])),
1136
- "onUpdate:modelValue": (l) => et(t.item.id, l)
1424
+ "onUpdate:modelValue": (a) => Ie(t.item.id, a)
1137
1425
  }, null, 8, ["aria-label", "model-value", "disabled", "onUpdate:modelValue"]))
1138
- ])) : h("", !0),
1139
- (s(!0), u(N, null, ye(G.value, (l, o) => {
1140
- var n, r;
1141
- return s(), u("td", {
1142
- key: l.key,
1143
- "data-column-key": l.key,
1144
- style: $({
1145
- ...He(l),
1146
- textAlign: l.align || "left"
1147
- }),
1148
- title: re(t.item.row, l)
1426
+ ])) : g("", !0),
1427
+ (r(!0), d(N, null, te(H.value, (a, o) => (r(), d("td", {
1428
+ key: a.key,
1429
+ "data-column-key": a.key,
1430
+ tabindex: s.contextMenu ? -1 : void 0,
1431
+ class: pe([s.cellClassName && Ee(s.cellClassName, fe(t, a, o)), { "hys-ui-pf-grid-cell-editing": Ze(t.item, a) }]),
1432
+ style: I([s.cellStyle && Ee(s.cellStyle, fe(t, a, o)), {
1433
+ ...Ue(a),
1434
+ textAlign: a.align || "left"
1435
+ }]),
1436
+ title: Ze(t.item, a) ? void 0 : Se(t.item.row, a),
1437
+ onClick: (n) => p("cellClick", fe(t, a, o), n),
1438
+ onDblclick: (n) => oa(n, t, a, o),
1439
+ onContextmenu: U((n) => aa(n, t, a, o), ["stop"]),
1440
+ onKeydown: U((n) => v(V).keydown({ ...fe(t, a, o), type: "cell" }, n), ["self"])
1441
+ }, [
1442
+ Ze(t.item, a) ? (r(), D(ot, {
1443
+ key: 0,
1444
+ modelValue: We.value,
1445
+ "onUpdate:modelValue": l[11] || (l[11] = (n) => We.value = n),
1446
+ class: "hys-ui-pf-grid-edit",
1447
+ "aria-label": "编辑" + a.label,
1448
+ onClick: l[12] || (l[12] = U(() => {
1449
+ }, ["stop"])),
1450
+ onPressEnter: (n) => Ot(t.item, a),
1451
+ onKeydown: nl(U(Tl, ["stop"]), ["esc"]),
1452
+ onFocusout: (n) => Ot(t.item, a)
1453
+ }, null, 8, ["modelValue", "aria-label", "onPressEnter", "onKeydown", "onFocusout"])) : g("", !0),
1454
+ y("span", {
1455
+ class: "hys-ui-pf-grid-cell-display",
1456
+ inert: Ze(t.item, a)
1149
1457
  }, [
1150
- ((n = W.value) == null ? void 0 : n.id) === t.item.id && ((r = W.value) == null ? void 0 : r.key) === l.key ? (s(), D(Ie, {
1151
- key: 0,
1152
- modelValue: Ke.value,
1153
- "onUpdate:modelValue": a[11] || (a[11] = (f) => Ke.value = f),
1154
- class: "hys-ui-pf-grid-edit",
1155
- "aria-label": "编辑" + l.label,
1156
- onClick: a[12] || (a[12] = q(() => {
1157
- }, ["stop"])),
1158
- onKeydown: [
1159
- nt(q((f) => gt(t.item, l), ["stop"]), ["enter"]),
1160
- a[13] || (a[13] = nt(q((f) => W.value = null, ["stop"]), ["esc"]))
1161
- ],
1162
- onFocusout: (f) => gt(t.item, l)
1163
- }, null, 8, ["modelValue", "aria-label", "onKeydown", "onFocusout"])) : (s(), u(N, { key: 1 }, [
1164
- v.treeMode && o === 0 ? (s(), u(N, { key: 0 }, [
1165
- t.item.hasChildren ? (s(), D(T, {
1166
- key: 0,
1167
- variant: "ghost",
1168
- size: "sm",
1169
- class: "hys-ui-pf-grid-tree-toggle",
1170
- style: $({ marginLeft: t.item.depth * 16 + "px" }),
1171
- "aria-expanded": ie.value.has(t.item.id),
1172
- "aria-label": ie.value.has(t.item.id) ? "折叠子行" : "展开子行",
1173
- onClick: q((f) => Zt(t.item.id), ["stop"])
1174
- }, {
1175
- default: z(() => [
1176
- (s(), D(Dt(
1177
- ie.value.has(t.item.id) ? m(it) : m(Ft)
1178
- ), {
1179
- size: 15,
1180
- "aria-hidden": "true"
1181
- }))
1182
- ]),
1183
- _: 2
1184
- }, 1032, ["style", "aria-expanded", "aria-label", "onClick"])) : (s(), u("span", {
1185
- key: 1,
1186
- style: $({
1187
- display: "inline-block",
1188
- width: t.item.depth * 16 + 20 + "px"
1189
- })
1190
- }, null, 4))
1191
- ], 64)) : h("", !0),
1192
- y("span", {
1193
- onDblclick: q((f) => ea(t.item, l), ["stop"])
1194
- }, [
1195
- $e(e.$slots, l.key, {
1196
- row: t.item.row,
1197
- value: m(me)(t.item.row, l),
1198
- index: t.item.index
1199
- }, () => [
1200
- V(O(re(t.item.row, l)), 1)
1458
+ s.treeMode && o === 0 ? (r(), d(N, { key: 0 }, [
1459
+ t.item.hasChildren ? (r(), D(B, {
1460
+ key: 0,
1461
+ variant: "ghost",
1462
+ size: "sm",
1463
+ class: "hys-ui-pf-grid-tree-toggle",
1464
+ style: I({ marginLeft: t.item.depth * 16 + "px" }),
1465
+ "aria-expanded": Ce.value.has(t.item.id),
1466
+ "aria-label": Ce.value.has(t.item.id) ? "折叠子行" : "展开子行",
1467
+ onClick: U((n) => Ml(t.item.id), ["stop"])
1468
+ }, {
1469
+ default: M(() => [
1470
+ (r(), D(il(
1471
+ Ce.value.has(t.item.id) ? v(St) : v(rl)
1472
+ ), {
1473
+ size: 15,
1474
+ "aria-hidden": "true"
1475
+ }))
1476
+ ]),
1477
+ _: 2
1478
+ }, 1032, ["style", "aria-expanded", "aria-label", "onClick"])) : (r(), d("span", {
1479
+ key: 1,
1480
+ style: I({
1481
+ display: "inline-block",
1482
+ width: t.item.depth * 16 + 20 + "px"
1483
+ })
1484
+ }, null, 4))
1485
+ ], 64)) : g("", !0),
1486
+ y("span", null, [
1487
+ $(e.$slots, a.key, ee({ ref_for: !0 }, fe(t, a, o)), () => [
1488
+ $(e.$slots, "body-cell", ee({ ref_for: !0 }, fe(t, a, o)), () => [
1489
+ T(z(Se(t.item.row, a)), 1)
1201
1490
  ], !0)
1202
- ], 40, gl)
1203
- ], 64))
1204
- ], 12, ml);
1205
- }), 128))
1206
- ], 8, yl))
1491
+ ], !0)
1492
+ ])
1493
+ ], 8, co)
1494
+ ], 46, uo))), 128))
1495
+ ], 16, ro))
1207
1496
  ], 64))), 128)),
1208
- Xe.value.length ? h("", !0) : (s(), u("tr", hl, [
1497
+ Ve.value.length ? g("", !0) : (r(), d("tr", fo, [
1209
1498
  y("td", {
1210
- colspan: Math.max(1, A.value.length + Number(v.selectable)),
1499
+ colspan: Math.max(1, K.value.length + Number(s.selectable)),
1211
1500
  class: "hys-ui-pf-grid-empty"
1212
1501
  }, [
1213
- $e(e.$slots, "empty", {
1214
- query: we()
1215
- }, () => [
1216
- V(O(v.emptyText), 1)
1217
- ], !0)
1218
- ], 8, kl)
1502
+ y("div", po, [
1503
+ $(e.$slots, "empty", {
1504
+ query: Oe()
1505
+ }, () => [
1506
+ T(z(s.emptyText), 1)
1507
+ ], !0)
1508
+ ])
1509
+ ], 8, vo)
1219
1510
  ]))
1220
1511
  ], 64))
1221
1512
  ]),
1222
- v.showSummary && !Fe.value && !m(Ve) && be.value.length ? (s(), u("tfoot", bl, [
1223
- y("tr", wl, [
1224
- v.selectable ? (s(), u("td", Sl, "合计")) : h("", !0),
1225
- (s(!0), u(N, null, ye(G.value, (t, l) => (s(), u("td", {
1513
+ s.showSummary && !ue.value && !v(Ae) && Le.value.length ? (r(), d("tfoot", yo, [
1514
+ y("tr", go, [
1515
+ s.selectable ? (r(), d("td", mo, "合计")) : g("", !0),
1516
+ (r(!0), d(N, null, te(H.value, (t, a) => (r(), d("td", {
1226
1517
  key: t.key,
1227
1518
  "data-column-key": t.key,
1228
- style: $({
1229
- ...He(t),
1519
+ style: I({
1520
+ ...Ue(t),
1230
1521
  textAlign: t.align || "left"
1231
1522
  })
1232
- }, O(t.summary || v.summaryMethod ? la(t) : !v.selectable && l === 0 ? "合计" : ""), 13, Cl))), 128))
1523
+ }, z(t.summary || s.summaryMethod ? Ft(t) : !s.selectable && a === 0 ? "合计" : ""), 13, ho))), 128))
1233
1524
  ])
1234
- ])) : h("", !0)
1525
+ ])) : g("", !0)
1235
1526
  ], 6)
1236
1527
  ], 36),
1237
- y("footer", xl, [
1238
- !v.loadRows || m(De) !== void 0 ? (s(), D(Ua, {
1528
+ y("footer", bo, [
1529
+ !s.loadRows || v(Xe) !== void 0 ? (r(), D(za, {
1239
1530
  key: 0,
1240
- page: ue.value,
1241
- total: We.value,
1242
- "page-size": Q.value,
1531
+ page: xe.value,
1532
+ total: ut.value,
1533
+ "page-size": ie.value,
1243
1534
  "show-size-changer": "",
1244
1535
  "show-quick-jumper": "",
1245
- disabled: v.loading,
1536
+ disabled: s.loading,
1246
1537
  "page-size-options": [10, 12, 20, 50, 100],
1247
- onChange: Qt,
1248
- "onUpdate:pageSize": Wt
1249
- }, null, 8, ["page", "total", "page-size", "disabled"])) : h("", !0)
1250
- ])
1251
- ], 16, $a));
1538
+ onChange: kl,
1539
+ "onUpdate:pageSize": wl
1540
+ }, null, 8, ["page", "total", "page-size", "disabled"])) : g("", !0)
1541
+ ]),
1542
+ s.contextMenu ? (r(), D(xa, {
1543
+ key: 0,
1544
+ ref: "gridContextMenu",
1545
+ trigger: [],
1546
+ items: v(V).items.value,
1547
+ class: "hys-ui-pf-grid-menu-anchor",
1548
+ "aria-label": "表格操作",
1549
+ "popup-transition": s.popupTransition,
1550
+ "popup-transition-duration": s.popupTransitionDuration,
1551
+ onSelect: v(V).select
1552
+ }, null, 8, ["items", "popup-transition", "popup-transition-duration", "onSelect"])) : g("", !0)
1553
+ ], 16, Ka));
1252
1554
  }
1253
1555
  });
1254
1556
  export {
1255
- Bl as default
1557
+ qo as default
1256
1558
  };