@astryx-vue/core 0.11.0 → 0.12.1

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 (250) hide show
  1. package/dist/AlertDialog/index.js +1 -1
  2. package/dist/{AlertDialog-BO2LucRK.js → AlertDialog-igjA8kZr.js} +6 -6
  3. package/dist/AppShell/index.js +1 -1
  4. package/dist/{AppShell-kqwLt4ez.js → AppShell-DUHcLJWD.js} +2 -2
  5. package/dist/Avatar/index.js +1 -1
  6. package/dist/{Avatar-Bdnu3col.js → Avatar-KmdgVaAb.js} +1 -1
  7. package/dist/AvatarGroup/index.d.ts +1 -1
  8. package/dist/Banner/index.d.ts +1 -1
  9. package/dist/Banner/index.js +1 -1
  10. package/dist/{Banner-C-8DEWdJ.js → Banner-Bf_nMW3-.js} +1 -1
  11. package/dist/BottomSheet/index.js +2 -2
  12. package/dist/{BottomSheet-CgOzQHaA.js → BottomSheet-B57XUJV3.js} +3 -2
  13. package/dist/{BottomSheet-BECeWtEy.js → BottomSheet-BMqjymuf.js} +3 -3
  14. package/dist/Breadcrumbs/index.js +1 -1
  15. package/dist/{Breadcrumbs-Dxjz2Dxn.js → Breadcrumbs-aTPAdLdg.js} +1 -1
  16. package/dist/Button/index.js +1 -1
  17. package/dist/{Button-BeNp2zq_.js → Button-sUkQ0Ufo.js} +5 -4
  18. package/dist/ButtonGroup/index.d.ts +1 -1
  19. package/dist/ButtonGroup/index.js +1 -1
  20. package/dist/{ButtonGroup-CosYAili.js → ButtonGroup-CWra-KDj.js} +3 -2
  21. package/dist/Calendar/index.d.ts +1 -1
  22. package/dist/Carousel/index.d.ts +1 -1
  23. package/dist/Carousel/index.js +1 -1
  24. package/dist/{Carousel-BCcyDFRy.js → Carousel-DmXceU9h.js} +1 -1
  25. package/dist/Chat/index.d.ts +1 -1
  26. package/dist/Chat/index.js +1 -1
  27. package/dist/{Chat-D3UDsL7W.js → Chat-CeibAkxn.js} +4 -4
  28. package/dist/CheckboxInput/index.d.ts +1 -1
  29. package/dist/CheckboxInput/index.js +1 -1
  30. package/dist/{CheckboxInput-iCg8FgRv.js → CheckboxInput-PvzPV1N1.js} +1 -1
  31. package/dist/CheckboxList/index.d.ts +1 -1
  32. package/dist/CheckboxList/index.js +1 -1
  33. package/dist/{CheckboxList-Dr40y9ME.js → CheckboxList-DKtNzb0t.js} +3 -3
  34. package/dist/ClickableCard/index.d.ts +1 -1
  35. package/dist/Code/index.js +1 -1
  36. package/dist/{CodeBlock-B0LPcu-J.js → CodeBlock-CTPuBH_r.js} +1 -1
  37. package/dist/CommandPalette/index.js +1 -1
  38. package/dist/{CommandPalette-D_lf06eE.js → CommandPalette-DIoT_vZh.js} +1 -1
  39. package/dist/ComplexSelector/index.js +1 -1
  40. package/dist/{ComplexSelector-BzGKWYEv.js → ComplexSelector-B_5mzJjR.js} +2 -2
  41. package/dist/ContextMenu/index.d.ts +1 -1
  42. package/dist/ContextMenu/index.js +1 -1
  43. package/dist/{ContextMenu-6AnjpPJg.js → ContextMenu-DYnyk5rs.js} +4 -4
  44. package/dist/DateInput/index.d.ts +1 -1
  45. package/dist/DateInput/index.js +1 -1
  46. package/dist/{DateInput-OkjtSKwt.js → DateInput-DgPIsWPu.js} +4 -4
  47. package/dist/DateRangeInput/index.d.ts +1 -1
  48. package/dist/DateRangeInput/index.js +1 -1
  49. package/dist/{DateRangeInput-B4HT9NfM.js → DateRangeInput-oOfhUt1Q.js} +3 -3
  50. package/dist/DateTimeInput/index.d.ts +1 -1
  51. package/dist/DateTimeInput/index.js +1 -1
  52. package/dist/{DateTimeInput-B_tQlraA.js → DateTimeInput-DZfghF2h.js} +5 -5
  53. package/dist/Dialog/index.js +3 -3
  54. package/dist/{Dialog-BtPktuiy.js → Dialog-Dkwt3mVt.js} +25 -8
  55. package/dist/{Dialog-3MKo31xn.js → Dialog-qIL4DUot.js} +1 -1
  56. package/dist/{DialogHeader-cr9rFLYM.js → DialogHeader-w4TCzYEj.js} +2 -2
  57. package/dist/Drawer/index.d.ts +1 -1
  58. package/dist/Drawer/index.js +1 -1
  59. package/dist/{Drawer-Ba-yG1rk.js → Drawer-DBHSNUAa.js} +2 -2
  60. package/dist/DropdownMenu/index.js +2 -2
  61. package/dist/{DropdownMenu-DJK_xIUd.js → DropdownMenu-Cncx4FbU.js} +3 -3
  62. package/dist/{DropdownMenu-B9eUWp_X.js → DropdownMenu-DHvAlqSj.js} +5 -5
  63. package/dist/EmptyState/index.js +1 -1
  64. package/dist/{EmptyState-v1cvHKav.js → EmptyState-uWyPaIR1.js} +2 -2
  65. package/dist/Field/index.js +3 -3
  66. package/dist/{Field-Dc15m78p.js → Field-CqDOsI3P.js} +1 -1
  67. package/dist/{FieldInfoTip-BouJddgS.js → FieldInfoTip-CUh2koNc.js} +1 -1
  68. package/dist/{FieldLabel-CfO3zaZ5.js → FieldLabel-BMHNRAG3.js} +1 -1
  69. package/dist/FileInput/index.d.ts +1 -1
  70. package/dist/FileInput/index.js +1 -1
  71. package/dist/{FileInput-hNPjfW1i.js → FileInput-C6dK2pvX.js} +2 -2
  72. package/dist/Heading/index.js +1 -1
  73. package/dist/{Heading-C10qO8wg.js → Heading-C0axugQa.js} +1 -1
  74. package/dist/HoverCard/index.d.ts +1 -1
  75. package/dist/HoverCard/index.js +1 -1
  76. package/dist/{HoverCard-3S3axq-o.js → HoverCard-C6Gxekg0.js} +3 -3
  77. package/dist/IconButton/index.js +1 -1
  78. package/dist/{IconButton-C91rhbvu.js → IconButton-Bv2eIsJy.js} +1 -1
  79. package/dist/InfoTip/index.d.ts +1 -1
  80. package/dist/InfoTip/index.js +1 -1
  81. package/dist/{InfoTip-iKOp_vUV.js → InfoTip-BKsbmGA6.js} +4 -2
  82. package/dist/{InputClearButton-BiF7qGMR.js → InputClearButton-CSS2Tjat.js} +2 -2
  83. package/dist/InputGroup/index.js +1 -1
  84. package/dist/{InputGroup-CIKleAu8.js → InputGroup-DTGh1ylC.js} +1 -1
  85. package/dist/InternationalizationProvider/index.d.ts +1 -1
  86. package/dist/InternationalizationProvider/index.js +1 -1
  87. package/dist/{InternationalizationProvider-DA3I14xV.js → InternationalizationProvider-CyDjQn5Z.js} +1 -1
  88. package/dist/{LayerContentBoundary-CvsKxwwm.js → LayerContentBoundary-DwTkbifx.js} +1 -1
  89. package/dist/Layout/index.d.ts +1 -1
  90. package/dist/Layout/index.js +2 -2
  91. package/dist/{Layout-OHKb6r7D.js → Layout-BeYYiLFm.js} +1 -1
  92. package/dist/{LayoutPanel-D-rpTtC-.js → LayoutPanel-DDLcJgzG.js} +3 -0
  93. package/dist/Lightbox/index.d.ts +1 -1
  94. package/dist/Lightbox/index.js +1 -1
  95. package/dist/{Lightbox-DZrWvhCQ.js → Lightbox-BZ-zBvly.js} +106 -28
  96. package/dist/Link/index.d.ts +1 -1
  97. package/dist/Link/index.js +1 -1
  98. package/dist/{Link-CnlFkwpY.js → Link-Ddu0KjPZ.js} +1 -1
  99. package/dist/Markdown/index.js +1 -1
  100. package/dist/{Markdown-YVv-0uFI.js → Markdown-D7bQGV9u.js} +3 -3
  101. package/dist/MobileNav/index.js +1 -1
  102. package/dist/{MobileNavToggle-lgEHlilz.js → MobileNavToggle-Dfshmrdy.js} +3 -2
  103. package/dist/MoreMenu/index.d.ts +1 -1
  104. package/dist/MoreMenu/index.js +1 -1
  105. package/dist/{MoreMenu-DaLb4bgr.js → MoreMenu-Bie4B7Jr.js} +4 -4
  106. package/dist/MultiSelector/index.d.ts +1 -1
  107. package/dist/MultiSelector/index.js +1 -1
  108. package/dist/{MultiSelector-stzuffs3.js → MultiSelector-BdedjB6u.js} +5 -5
  109. package/dist/{NavDisclosure-DG4jls5z.js → NavDisclosure-1otbO71l.js} +1 -1
  110. package/dist/{NavHeadingSurface-9JQsxTxs.js → NavHeadingSurface-BkMR3V5m.js} +1 -1
  111. package/dist/NavMenu/index.js +3 -3
  112. package/dist/{NavMenu-ChlWdHfi.js → NavMenu-dyGZS1yM.js} +2 -2
  113. package/dist/{NavMenuItem-DIMQohIa.js → NavMenuItem-CirgE73a.js} +1 -1
  114. package/dist/NumberInput/index.d.ts +1 -1
  115. package/dist/NumberInput/index.js +1 -1
  116. package/dist/{NumberInput-DH0Cb7L6.js → NumberInput-0KbcEF3_.js} +3 -3
  117. package/dist/OverflowList/index.d.ts +1 -1
  118. package/dist/OverflowList/index.js +1 -1
  119. package/dist/{OverflowList-BGzqG78e.js → OverflowList-BdcaX1bz.js} +2 -2
  120. package/dist/Overlay/index.d.ts +1 -1
  121. package/dist/Pagination/index.js +1 -1
  122. package/dist/{Pagination-DMG9KvKa.js → Pagination-uttop2ls.js} +1 -1
  123. package/dist/Popover/index.d.ts +1 -1
  124. package/dist/Popover/index.js +1 -1
  125. package/dist/{Popover-cnfHz2tm.js → Popover-BOQo9UPf.js} +78 -26
  126. package/dist/PowerSearch/index.d.ts +1 -1
  127. package/dist/PowerSearch/index.js +1 -1
  128. package/dist/{PowerSearch-Dv2AHgE5.js → PowerSearch-DDuYfvNh.js} +16 -16
  129. package/dist/ProgressBar/index.js +1 -1
  130. package/dist/{ProgressBar-gsm2A_cR.js → ProgressBar-BS3VSoE9.js} +1 -1
  131. package/dist/Radio/index.d.ts +1 -1
  132. package/dist/Radio/index.js +1 -1
  133. package/dist/{RadioGroup-D3TXgdwV.js → RadioGroup-DKaSstyl.js} +2 -2
  134. package/dist/RadioList/index.d.ts +1 -1
  135. package/dist/RadioList/index.js +1 -1
  136. package/dist/{RadioList-Boj8QfPe.js → RadioList-DtKm9spP.js} +1 -1
  137. package/dist/Resizable/index.d.ts +1 -1
  138. package/dist/ScrollableArea/index.d.ts +1 -1
  139. package/dist/SelectableCard/index.d.ts +1 -1
  140. package/dist/Selector/index.d.ts +1 -1
  141. package/dist/Selector/index.js +1 -1
  142. package/dist/{Selector-CyY6vVUg.js → Selector-OpczmkqS.js} +4 -4
  143. package/dist/SideNav/index.d.ts +1 -1
  144. package/dist/SideNav/index.js +1 -1
  145. package/dist/{SideNav-s9yTmKX3.js → SideNav-L6CWk5fV.js} +5 -5
  146. package/dist/Slider/index.js +1 -1
  147. package/dist/{Slider-BQ4Dhxdx.js → Slider-DZS8mGZA.js} +1 -1
  148. package/dist/Stack/index.d.ts +1 -1
  149. package/dist/StatusDot/index.js +1 -1
  150. package/dist/{StatusDot-DF5wK42f.js → StatusDot-DaQGq8YN.js} +1 -1
  151. package/dist/Stepper/index.d.ts +1 -1
  152. package/dist/Switch/index.d.ts +1 -1
  153. package/dist/Switch/index.js +1 -1
  154. package/dist/{Switch-B0E8cZy7.js → Switch-BN_NnBuc.js} +1 -1
  155. package/dist/TabList/index.d.ts +1 -1
  156. package/dist/TabList/index.js +1 -1
  157. package/dist/{TabList-DBSXa5QT.js → TabList-Bmj4tGT-.js} +1 -1
  158. package/dist/Table/index.d.ts +3 -3
  159. package/dist/Table/index.js +2 -2
  160. package/dist/{Table-D4vQdv-Z.js → Table-_pSoEiGP.js} +705 -278
  161. package/dist/Text/index.js +1 -1
  162. package/dist/{Text-WB-fpFne.js → Text-IijvZmW-.js} +1 -1
  163. package/dist/TextArea/index.d.ts +1 -1
  164. package/dist/TextArea/index.js +1 -1
  165. package/dist/{TextArea-CSoebCLx.js → TextArea-BDR179q1.js} +4 -4
  166. package/dist/TextInput/index.d.ts +1 -1
  167. package/dist/TextInput/index.js +1 -1
  168. package/dist/{TextInput-B3qNW95s.js → TextInput-kUzxl99M.js} +4 -4
  169. package/dist/Theme/index.js +1 -1
  170. package/dist/{Theme-1r_aWHvr.js → Theme-PyAl8nM0.js} +4 -0
  171. package/dist/Thumbnail/index.js +1 -1
  172. package/dist/{Thumbnail-CTkLFo-A.js → Thumbnail-Disi5yDb.js} +2 -2
  173. package/dist/{TimeField-CMZxZ6gI.js → TimeField-C0la1AtP.js} +4 -4
  174. package/dist/TimeInput/index.d.ts +1 -1
  175. package/dist/TimeInput/index.js +1 -1
  176. package/dist/{TimeInput-BFWgRaV-.js → TimeInput-C_jTijHh.js} +2 -2
  177. package/dist/Timer/index.js +1 -1
  178. package/dist/{Timer-BD2gSoQ3.js → Timer-DifGERP8.js} +1 -1
  179. package/dist/Timestamp/index.d.ts +1 -1
  180. package/dist/Timestamp/index.js +1 -1
  181. package/dist/{Timestamp-DWnbOvnI.js → Timestamp-BjXZGAvO.js} +3 -3
  182. package/dist/Toast/index.js +1 -1
  183. package/dist/{Toast-aI9QMW-L.js → Toast-DBo0WRAd.js} +1 -1
  184. package/dist/ToggleButton/index.d.ts +1 -1
  185. package/dist/ToggleButton/index.js +1 -1
  186. package/dist/{ToggleButton-DI9I-LBH.js → ToggleButton-B5HNykOh.js} +4 -3
  187. package/dist/Token/index.d.ts +1 -1
  188. package/dist/Tokenizer/index.js +1 -1
  189. package/dist/{Tokenizer-Caqr8y0B.js → Tokenizer-BNazaZsP.js} +3 -3
  190. package/dist/Toolbar/index.d.ts +2 -2
  191. package/dist/Tooltip/index.d.ts +1 -1
  192. package/dist/Tooltip/index.js +2 -2
  193. package/dist/{Tooltip-CGHpFMnc.js → Tooltip-4APVAlN9.js} +1 -1
  194. package/dist/TopNav/index.d.ts +1 -1
  195. package/dist/TopNav/index.js +1 -1
  196. package/dist/{TopNav-Cm_Hn6Ub.js → TopNav-XSZWAR-7.js} +4 -4
  197. package/dist/Typeahead/index.js +1 -1
  198. package/dist/{Typeahead-tz2lm5qb.js → Typeahead-BgQVQw-0.js} +3 -3
  199. package/dist/composables/index.d.ts +2 -2
  200. package/dist/composables/index.js +7 -6
  201. package/dist/context-Cgkyk-b7.js +10 -0
  202. package/dist/{index-DTvnURvQ.d.ts → index-B3FE7s7V.d.ts} +2 -2
  203. package/dist/{index-DTfA4uE3.d.ts → index-B44fLswd.d.ts} +7 -6
  204. package/dist/{index-BB9acgK8.d.ts → index-BgT6mH3U.d.ts} +1 -1
  205. package/dist/{index-CqMchGHu.d.ts → index-Bmqz1lVz.d.ts} +1 -1
  206. package/dist/{index-BDZCJ9ri.d.ts → index-BuubzuE8.d.ts} +2 -2
  207. package/dist/{index-1AZ4KZhg.d.ts → index-CCpcerMA.d.ts} +2 -2
  208. package/dist/{index-COizkrYV.d.ts → index-CGDmjlec.d.ts} +53 -26
  209. package/dist/{index-DWff2hPl.d.ts → index-CKtrcglY.d.ts} +3 -3
  210. package/dist/{index-Cun6cXGP.d.ts → index-Cb-HJUhK.d.ts} +1 -1
  211. package/dist/{index-D2-umYbX.d.ts → index-CcYSAva-.d.ts} +1 -1
  212. package/dist/{index-CYMoCPfU.d.ts → index-D-YoRrfP.d.ts} +1 -1
  213. package/dist/{index-dWlCpnua.d.ts → index-DhcjuwQq.d.ts} +1 -1
  214. package/dist/{index-BkYcznbj.d.ts → index-DydQ5Ngj.d.ts} +1 -1
  215. package/dist/{index-CO9GW-ik.d.ts → index-Q1oG9yIT.d.ts} +1 -1
  216. package/dist/{index-DzENUj3W.d.ts → index-_5purQow.d.ts} +4 -4
  217. package/dist/{index-FzAAjCFZ.d.ts → index-a1jCiQP7.d.ts} +1 -1
  218. package/dist/{index-MEix_m1o.d.ts → index-lmd9LZKB.d.ts} +6 -3
  219. package/dist/{index-C2E1Peae.d.ts → index-wTwhcFQx.d.ts} +1 -1
  220. package/dist/index.d.ts +22 -22
  221. package/dist/index.js +88 -87
  222. package/dist/{layerDepth-CNDh-IHb.js → layerDepth-BF74Cctw.js} +38 -14
  223. package/dist/layerFocusReturn-DMJaFgcY.js +121 -0
  224. package/dist/{loadCatalog-BC0o_2p_.d.ts → loadCatalog-CQEYXGuI.d.ts} +9 -0
  225. package/dist/{loadCatalog-DAEqYLgh.js → loadCatalog-XbgoqaRp.js} +37 -0
  226. package/dist/locale/index.d.ts +2 -2
  227. package/dist/locale/index.js +2 -2
  228. package/dist/{locale-DNGKtpHA.js → locale-BwnZeppK.js} +1 -1
  229. package/dist/{tooltipTriggerRules-Bg4tG8w2.js → tooltipTriggerRules-BY3LAtUl.js} +1 -1
  230. package/dist/{useActionGroupTracking-B4niQ_tR.js → useActionGroupTracking-BJMRaXil.js} +1 -1
  231. package/dist/{useAnchoredListbox-9Gn8asBR.js → useAnchoredListbox-CuRfVgKl.js} +1 -1
  232. package/dist/{useDismiss-0-Z-9D0A.js → useDismiss-BWd-sQ18.js} +26 -5
  233. package/dist/{useRestoreFocus-CEG0n2AK.js → useFocusTrap-FJt5QhEd.js} +2 -36
  234. package/dist/{useHoverLayerDismiss-kYJ_NqL4.js → useHoverLayerDismiss-uhfzmZyf.js} +1 -1
  235. package/dist/{useInputStatusIcon-Da2FiXwF.js → useInputStatusIcon-C3Q-q_wI.js} +1 -1
  236. package/dist/{useLayer-CED-g4Q2.js → useLayer-BGv_wRSG.js} +1 -1
  237. package/dist/{useResizable-I3BCiLSL.js → useResizable-DTDhsLip.js} +1 -1
  238. package/dist/{useResizable-OTSgW_VF.d.ts → useResizable-DziUYD5W.d.ts} +8 -1
  239. package/dist/useRestoreFocus-D2-pGoOk.js +38 -0
  240. package/dist/{useTooltip-D8Tq7-yd.js → useTooltip-md1tr6ef.js} +61 -29
  241. package/dist/{context-BJ9RkXYX.js → useTouchHitArea-1WtV3u6F.js} +1 -10
  242. package/dist/{useTruncationTooltip-BNk2xslw.js → useTruncationTooltip-BGsFITq5.js} +3 -3
  243. package/dist/{useTypeahead-DSMObTtg.js → useTypeahead-BrUwR-kv.js} +1 -1
  244. package/package.json +1 -1
  245. package/styles/dialog.css +0 -1
  246. package/styles/info-tip.css +0 -9
  247. package/styles/lightbox.css +7 -2
  248. package/styles/popover.css +2 -0
  249. package/styles/table.css +132 -4
  250. package/dist/{index-BqhgeAT4.d.ts → index-J6YRJ7Ul.d.ts} +1 -1
@@ -1,25 +1,27 @@
1
- import { t as _sfc_main$15 } from "./Icon-BCHo7W0x.js";
2
- import { i as _sfc_main$17, r as useCutTextOnKeyboardFocus, t as _sfc_main$16 } from "./Button-BeNp2zq_.js";
1
+ import { t as _sfc_main$16 } from "./Icon-BCHo7W0x.js";
2
+ import { i as _sfc_main$18, r as useCutTextOnKeyboardFocus, t as _sfc_main$17 } from "./Button-sUkQ0Ufo.js";
3
3
  import { n as useLayerTeleportTarget } from "./useLayerMountTarget-BmZyeKWE.js";
4
- import { t as _sfc_main$18 } from "./VisuallyHidden-cpmsV-0M.js";
4
+ import { t as _sfc_main$19 } from "./VisuallyHidden-cpmsV-0M.js";
5
5
  import { n as firstCharacter } from "./characters-wTnzjkkR.js";
6
+ import { t as devWarn } from "./useDevWarning-B2fsk2B-.js";
6
7
  import { o as useComponentMessages } from "./context-B8IEFCDR.js";
7
8
  import { t as useScrollableArea } from "./useScrollableArea-BE8b3qm7.js";
8
- import { t as _sfc_main$19 } from "./Tooltip-CGHpFMnc.js";
9
+ import { t as _sfc_main$20 } from "./Tooltip-4APVAlN9.js";
10
+ import { n as observeResize } from "./sharedResizeObserver-BekhnB3E.js";
9
11
  import { t as useScrollbars } from "./useScrollbars-Ch0xqJWO.js";
10
- import { t as _sfc_main$20 } from "./CheckboxInput-iCg8FgRv.js";
11
- import { t as _sfc_main$21 } from "./ComponentIcon-BRXBBKeG.js";
12
- import { t as _sfc_main$22 } from "./Popover-cnfHz2tm.js";
13
- import { t as _sfc_main$23 } from "./DateInput-OkjtSKwt.js";
14
- import { s as tableMessages } from "./loadCatalog-DAEqYLgh.js";
15
- import { r as useCollator } from "./locale-DNGKtpHA.js";
16
- import { t as _sfc_main$24 } from "./MultiSelector-stzuffs3.js";
17
- import { t as _sfc_main$25 } from "./NumberInput-DH0Cb7L6.js";
18
- import { t as _sfc_main$26 } from "./Pagination-DMG9KvKa.js";
19
- import { t as _sfc_main$27 } from "./Selector-CyY6vVUg.js";
20
- import { t as _sfc_main$28 } from "./TextInput-B3qNW95s.js";
21
- import { t as _sfc_main$29 } from "./Toolbar-BH_E0F0G.js";
22
- import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, h, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, openBlock, ref, renderList, renderSlot, shallowRef, toDisplayString, toValue, unref, useAttrs, useId, watch, withCtx, withModifiers } from "vue";
12
+ import { t as _sfc_main$21 } from "./CheckboxInput-PvzPV1N1.js";
13
+ import { t as _sfc_main$22 } from "./ComponentIcon-BRXBBKeG.js";
14
+ import { t as _sfc_main$23 } from "./Popover-BOQo9UPf.js";
15
+ import { t as _sfc_main$24 } from "./DateInput-DgPIsWPu.js";
16
+ import { s as tableMessages } from "./loadCatalog-XbgoqaRp.js";
17
+ import { r as useCollator } from "./locale-BwnZeppK.js";
18
+ import { t as _sfc_main$25 } from "./MultiSelector-BdedjB6u.js";
19
+ import { t as _sfc_main$26 } from "./NumberInput-0KbcEF3_.js";
20
+ import { t as _sfc_main$27 } from "./Pagination-uttop2ls.js";
21
+ import { t as _sfc_main$28 } from "./Selector-OpczmkqS.js";
22
+ import { t as _sfc_main$29 } from "./TextInput-kUzxl99M.js";
23
+ import { t as _sfc_main$30 } from "./Toolbar-BH_E0F0G.js";
24
+ import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, h, inject, isVNode, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, onScopeDispose, onUpdated, openBlock, provide, reactive, ref, renderList, renderSlot, shallowRef, toDisplayString, toValue, unref, useAttrs, useId, watch, withCtx, withModifiers } from "vue";
23
25
  import "../styles/layer.css";
24
26
  import "../styles/table.css";
25
27
  function proportional(value = 1, options) {
@@ -219,8 +221,12 @@ function capitalize(value) {
219
221
  const first = firstCharacter(value);
220
222
  return first.toUpperCase() + value.slice(first.length);
221
223
  }
224
+ /** 没有时间的 Date(`new Date('not a date')`)。表格把它当缺失值:空格子,排序时和 null 放在一起。 */
225
+ function isInvalidDate(value) {
226
+ return value instanceof Date && Number.isNaN(value.getTime());
227
+ }
222
228
  function cellText(value) {
223
- if (value == null) return "";
229
+ if (value == null || isInvalidDate(value)) return "";
224
230
  if (value instanceof Date) return value.toISOString();
225
231
  if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
226
232
  return "";
@@ -278,13 +284,23 @@ function sortRows(rows, sort, columns = [], collator) {
278
284
  });
279
285
  return copy;
280
286
  }
287
+ /** 排序时当缺失值的:null、undefined、NaN 和 Invalid Date。它们升序排最后,降序排最前。 */
288
+ function isMissingSortValue(value) {
289
+ return value == null || typeof value === "number" && Number.isNaN(value) || isInvalidDate(value);
290
+ }
291
+ /**
292
+ * 缺失值不进下面的比较:NaN 结果会被 Array.sort 当成相等,打乱其余行的顺序;
293
+ * Invalid Date 转 ISO 字符串会抛错。日期按 ISO 字符串比,和时间先后一致。
294
+ */
281
295
  function compareValues(a, b, collator) {
282
- if (a == null && b == null) return 0;
283
- if (a == null) return 1;
284
- if (b == null) return -1;
296
+ const aMissing = isMissingSortValue(a);
297
+ const bMissing = isMissingSortValue(b);
298
+ if (aMissing && bMissing) return 0;
299
+ if (aMissing) return 1;
300
+ if (bMissing) return -1;
285
301
  if (typeof a === "number" && typeof b === "number") return a - b;
286
- const left = String(a);
287
- const right = String(b);
302
+ const left = cellText(a);
303
+ const right = cellText(b);
288
304
  return collator ? collator.compare(left, right) : left.localeCompare(right);
289
305
  }
290
306
  //#endregion
@@ -639,6 +655,150 @@ function useTableGroupedRows(config) {
639
655
  };
640
656
  }
641
657
  //#endregion
658
+ //#region src/Table/TableLoadMore.vue
659
+ const _sfc_main$15 = /*@__PURE__*/ defineComponent({
660
+ name: "AstryxTableLoadMore",
661
+ __name: "TableLoadMore",
662
+ props: { runtime: {} },
663
+ setup(__props) {
664
+ const props = __props;
665
+ const messages = useComponentMessages({ table: tableMessages });
666
+ const surface = shallowRef(null);
667
+ const sentinel = shallowRef(null);
668
+ const hasMore = computed(() => props.runtime.config().hasMore);
669
+ const isBusy = computed(() => props.runtime.config().isLoading || props.runtime.state.isPending);
670
+ const canObserve = computed(() => hasMore.value && !isBusy.value && !props.runtime.state.isAutoPaused);
671
+ /**
672
+ * 看见表格末尾就自动加载一批。观察以浏览器视口为根,不往上找滚动祖先,也不提前量。
673
+ * 每次能发请求时都重新观察:一批太短、末尾还在视口里时,重新观察会再报一次可见,接着加载下一批。
674
+ */
675
+ watch([canObserve, sentinel], ([observe, node], _previous, onCleanup) => {
676
+ if (!observe || node == null) return;
677
+ if (typeof IntersectionObserver === "undefined") {
678
+ devWarn("useTableInfiniteScroll", "IntersectionObserver is unavailable; use the manual Load more command.");
679
+ return;
680
+ }
681
+ const observer = new IntersectionObserver((entries) => {
682
+ if (entries.some((entry) => entry.isIntersecting)) props.runtime.request(true);
683
+ }, {
684
+ root: null,
685
+ rootMargin: "0px",
686
+ threshold: 0
687
+ });
688
+ observer.observe(node);
689
+ onCleanup(() => observer.disconnect());
690
+ }, { flush: "post" });
691
+ /**
692
+ * 数据加载完、按钮被拿掉时,如果焦点正在按钮上,就交给表格的滚动区,不滚动页面。
693
+ * 滚动区本身不是 Tab 停靠点时临时借一个 `tabindex="-1"`,焦点离开就还回去。
694
+ */
695
+ function handOffFocus() {
696
+ const owner = surface.value;
697
+ const scrollRegion = owner?.closest(".astryx-table-scroll");
698
+ if (owner == null || scrollRegion == null || !owner.contains(document.activeElement)) return;
699
+ if (!scrollRegion.hasAttribute("tabindex")) {
700
+ scrollRegion.setAttribute("tabindex", "-1");
701
+ scrollRegion.addEventListener("blur", () => scrollRegion.removeAttribute("tabindex"), { once: true });
702
+ }
703
+ scrollRegion.focus({ preventScroll: true });
704
+ }
705
+ watch(hasMore, (next, previous) => {
706
+ if (previous && !next) handOffFocus();
707
+ }, { flush: "pre" });
708
+ return (_ctx, _cache) => {
709
+ return hasMore.value ? (openBlock(), createElementBlock("div", {
710
+ key: 0,
711
+ ref_key: "surface",
712
+ ref: surface,
713
+ class: "astryx-table__load-more"
714
+ }, [createElementVNode("div", {
715
+ ref_key: "sentinel",
716
+ ref: sentinel,
717
+ class: "astryx-table__load-more-sentinel",
718
+ "aria-hidden": "true"
719
+ }, null, 512), createVNode(_sfc_main$17, {
720
+ class: "astryx-table__load-more-command",
721
+ label: unref(messages).table.loadMore,
722
+ "is-loading": isBusy.value,
723
+ onClick: _cache[0] || (_cache[0] = ($event) => __props.runtime.request(false))
724
+ }, null, 8, ["label", "is-loading"])], 512)) : createCommentVNode("v-if", true);
725
+ };
726
+ }
727
+ });
728
+ //#endregion
729
+ //#region src/Table/plugins/infiniteScroll.ts
730
+ function createRuntime(config) {
731
+ const state = reactive({
732
+ isPending: false,
733
+ isSettled: false,
734
+ isAutoPaused: false
735
+ });
736
+ let generation = 0;
737
+ let lastSuccess = false;
738
+ watch(() => [state.isSettled, config().isLoading], ([isSettled, isLoading]) => {
739
+ if (!isSettled || isLoading) return;
740
+ state.isPending = false;
741
+ state.isSettled = false;
742
+ if (lastSuccess) state.isAutoPaused = false;
743
+ }, { flush: "post" });
744
+ function canRequest(isAutomatic) {
745
+ const current = config();
746
+ return current.hasMore && !current.isLoading && !state.isPending && !(isAutomatic && state.isAutoPaused);
747
+ }
748
+ function settle(id, isSuccessful) {
749
+ if (id !== generation || !state.isPending) return;
750
+ lastSuccess = isSuccessful;
751
+ if (!isSuccessful) state.isAutoPaused = true;
752
+ state.isSettled = true;
753
+ }
754
+ function request(isAutomatic) {
755
+ if (!canRequest(isAutomatic)) return;
756
+ generation += 1;
757
+ const id = generation;
758
+ state.isPending = true;
759
+ state.isSettled = false;
760
+ try {
761
+ const result = config().onLoadMore();
762
+ if (result == null || typeof result.then !== "function") {
763
+ state.isPending = false;
764
+ state.isAutoPaused = true;
765
+ devWarn("useTableInfiniteScroll", "onLoadMore must return a Promise<void>; automatic loading is paused.");
766
+ return;
767
+ }
768
+ Promise.resolve(result).then(() => settle(id, true), () => settle(id, false));
769
+ } catch {
770
+ settle(id, false);
771
+ }
772
+ }
773
+ onScopeDispose(() => {
774
+ generation += 1;
775
+ });
776
+ return {
777
+ state,
778
+ canRequest,
779
+ request,
780
+ config
781
+ };
782
+ }
783
+ /**
784
+ * 按批加载扁平数据。行、游标、错误提示都留在调用方。
785
+ * 只要 `hasMore` 为 true,表格下方就一直有一个「加载更多」按钮;IntersectionObserver 看见表格末尾时自动加载。
786
+ * 第一批还在加载时,表格不显示默认的空状态。
787
+ */
788
+ function useTableInfiniteScroll(config) {
789
+ const runtime = createRuntime(() => toValue(config));
790
+ return {
791
+ loadingState() {
792
+ const current = toValue(config);
793
+ return {
794
+ hasMore: current.hasMore,
795
+ isLoading: current.hasMore && (current.isLoading || runtime.state.isPending)
796
+ };
797
+ },
798
+ below: () => h(_sfc_main$15, { runtime })
799
+ };
800
+ }
801
+ //#endregion
642
802
  //#region src/Table/plugins/interaction.ts
643
803
  const INTERACTIVE = "button, a, input, select, textarea, label, [role=\"button\"], [role=\"link\"], [role=\"menuitem\"]";
644
804
  /**
@@ -680,7 +840,7 @@ function useTablePagination(config) {
680
840
  "class": "astryx-table__pagination",
681
841
  "data-align": current.align ?? "center",
682
842
  "data-place": place
683
- }, [h(_sfc_main$26, {
843
+ }, [h(_sfc_main$27, {
684
844
  "page": current.page,
685
845
  pageSize,
686
846
  "total": current.totalItems ?? 0,
@@ -714,19 +874,28 @@ const _hoisted_1$11 = ["aria-expanded", "aria-label"];
714
874
  const _sfc_main$14 = /*@__PURE__*/ defineComponent({
715
875
  name: "AstryxTableExpansionChevron",
716
876
  __name: "TableExpansionChevron",
717
- props: { expanded: { type: Boolean } },
877
+ props: {
878
+ expanded: { type: Boolean },
879
+ rowLabel: {}
880
+ },
718
881
  emits: ["toggle"],
719
882
  setup(__props, { emit: __emit }) {
883
+ const props = __props;
720
884
  const emit = __emit;
721
885
  const messages = useComponentMessages({ table: tableMessages });
886
+ const label = computed(() => {
887
+ const table = messages.value.table;
888
+ if (props.rowLabel) return props.expanded ? table.collapseRowNamed(props.rowLabel) : table.expandRowNamed(props.rowLabel);
889
+ return props.expanded ? table.collapseRow : table.expandRow;
890
+ });
722
891
  return (_ctx, _cache) => {
723
892
  return openBlock(), createElementBlock("button", {
724
893
  type: "button",
725
894
  class: "astryx-table__expander astryx-table__expander--column",
726
895
  "aria-expanded": __props.expanded ? "true" : "false",
727
- "aria-label": __props.expanded ? unref(messages).table.collapseRow : unref(messages).table.expandRow,
896
+ "aria-label": label.value,
728
897
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emit("toggle"), ["stop"]))
729
- }, [createElementVNode("span", { class: normalizeClass(["astryx-table__chevron-icon astryx-table__chevron-icon--slot", { "is-expanded": __props.expanded }]) }, [createVNode(_sfc_main$21, {
898
+ }, [createElementVNode("span", { class: normalizeClass(["astryx-table__chevron-icon astryx-table__chevron-icon--slot", { "is-expanded": __props.expanded }]) }, [createVNode(_sfc_main$22, {
730
899
  "icon-slot": "table-row-expand",
731
900
  state: { expanded: __props.expanded },
732
901
  fallback: {
@@ -756,6 +925,7 @@ function useTableRowExpansion(config) {
756
925
  const key = current.getRowKey(item);
757
926
  return h(_sfc_main$14, {
758
927
  expanded: current.expandedKeys.has(key),
928
+ rowLabel: current.getRowLabel?.(item)?.trim() || void 0,
759
929
  onToggle: () => current.onToggle(key)
760
930
  });
761
931
  }
@@ -799,7 +969,22 @@ function useTableRowExpansion(config) {
799
969
  //#endregion
800
970
  //#region src/Table/plugins/rowIndex.ts
801
971
  const ROW_INDEX_COLUMN_KEY = "__rowIndex";
802
- function useTableRowIndex(config) {
972
+ /** 按 `data` 里的位置查行号:分组头不占号,键或对象身份对上就算同一行。 */
973
+ function createLookup(data, getRowKey) {
974
+ const positions = /* @__PURE__ */ new Map();
975
+ let seen = 0;
976
+ for (const row of data) {
977
+ if (isTableGroupHeader(row)) continue;
978
+ positions.set(getRowKey ? getRowKey(row) : row, seen);
979
+ seen += 1;
980
+ }
981
+ return (item) => positions.get(getRowKey ? getRowKey(item) : item);
982
+ }
983
+ function useTableRowIndex(config = {}) {
984
+ const lookup = computed(() => {
985
+ const { data, getRowKey } = toValue(config);
986
+ return data == null ? null : createLookup(data, getRowKey);
987
+ });
803
988
  return { transformColumns(columns) {
804
989
  return [{
805
990
  key: ROW_INDEX_COLUMN_KEY,
@@ -807,17 +992,12 @@ function useTableRowIndex(config) {
807
992
  width: pixel(48),
808
993
  align: "end",
809
994
  resizable: false,
810
- renderCell(item) {
811
- const live = toValue(config);
995
+ renderCell(item, index) {
812
996
  if (isTableGroupHeader(item)) return null;
813
- const start = live.startFrom ?? 1;
814
- let seen = 0;
815
- for (const row of live.data) {
816
- if (isTableGroupHeader(row)) continue;
817
- if (live.getRowKey ? live.getRowKey(row) === live.getRowKey(item) : row === item) return h("span", { class: "astryx-table__row-index" }, String(start + seen));
818
- seen += 1;
819
- }
820
- return null;
997
+ const position = lookup.value == null ? index : lookup.value(item);
998
+ if (position == null) return null;
999
+ const start = toValue(config).startFrom ?? 1;
1000
+ return h("span", { class: "astryx-table__row-index" }, String(start + position));
821
1001
  }
822
1002
  }, ...columns];
823
1003
  } };
@@ -854,18 +1034,18 @@ const SEMANTIC_ICON = {
854
1034
  error: "error"
855
1035
  };
856
1036
  function statusMark(status) {
857
- if (status.status != null) return h(_sfc_main$15, {
1037
+ if (status.status != null) return h(_sfc_main$16, {
858
1038
  icon: SEMANTIC_ICON[status.status],
859
1039
  size: "xsm",
860
1040
  color: status.status
861
1041
  });
862
1042
  if (status.icon) {
863
1043
  const named = NAMED_ICON_COLOR[status.color];
864
- return status.icon.includes(":") ? h(_sfc_main$15, {
1044
+ return status.icon.includes(":") ? h(_sfc_main$16, {
865
1045
  name: status.icon,
866
1046
  size: "xsm",
867
1047
  color: named ?? "inherit"
868
- }) : h(_sfc_main$15, {
1048
+ }) : h(_sfc_main$16, {
869
1049
  icon: status.icon,
870
1050
  size: "xsm",
871
1051
  color: named ?? "inherit"
@@ -890,7 +1070,7 @@ function useTableRowStatus(config) {
890
1070
  const status = toValue(config).getStatus(item);
891
1071
  if (status == null) return null;
892
1072
  const customColor = status.status == null && status.icon != null && NAMED_ICON_COLOR[status.color] == null ? status.color : void 0;
893
- return h(_sfc_main$19, { content: status.label }, { default: () => h("span", {
1073
+ return h(_sfc_main$20, { content: status.label }, { default: () => h("span", {
894
1074
  "class": "astryx-table__status",
895
1075
  "role": "img",
896
1076
  "aria-label": status.label,
@@ -1145,6 +1325,12 @@ function useTableStickyColumns(config) {
1145
1325
  if ((current.startKeys?.length ?? 0) > 0) element.style.setProperty("--table-sticky-shadow-start", hasOverflow && position > 1 ? "1" : "0");
1146
1326
  if ((current.endKeys?.length ?? 0) > 0) element.style.setProperty("--table-sticky-shadow-end", hasOverflow && position < maxScroll - 1 ? "1" : "0");
1147
1327
  };
1328
+ const fadeOff = () => {
1329
+ const current = toValue(config);
1330
+ element.style.setProperty("--_table-fade-start", (current.startKeys?.length ?? 0) > 0 ? "0px" : "");
1331
+ element.style.setProperty("--_table-fade-end", (current.endKeys?.length ?? 0) > 0 ? "0px" : "");
1332
+ };
1333
+ fadeOff();
1148
1334
  element.addEventListener("scroll", update, { passive: true });
1149
1335
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(update);
1150
1336
  observer?.observe(element);
@@ -1152,6 +1338,8 @@ function useTableStickyColumns(config) {
1152
1338
  detach = () => {
1153
1339
  element.removeEventListener("scroll", update);
1154
1340
  observer?.disconnect();
1341
+ element.style.removeProperty("--_table-fade-start");
1342
+ element.style.removeProperty("--_table-fade-end");
1155
1343
  };
1156
1344
  }
1157
1345
  onScopeDispose(() => {
@@ -1179,6 +1367,29 @@ function selectColumn() {
1179
1367
  };
1180
1368
  }
1181
1369
  //#endregion
1370
+ //#region src/Table/treeRowAria.ts
1371
+ /**
1372
+ * 树形表格按披露模式(disclosure)标注,不按 treegrid:表格没有在格子和行之间用方向键移动的键盘模型,
1373
+ * 声明 treegrid 等于承诺了不存在的操作方式。所以行上不带 `aria-level`、`aria-expanded`,
1374
+ * 展开状态在每个父行的展开按钮上;缩进只是视觉上的。行只带一个非 ARIA 的层级标记,
1375
+ * 让展开按钮找到自己的直接子行,用 `aria-controls` 指过去。
1376
+ */
1377
+ const TREE_LEVEL_ATTRIBUTE = "data-tree-level";
1378
+ let fallbackPrefix = 0;
1379
+ /** 一张树形表格的行 id 前缀。在组件外面调用插件时退回自增编号。 */
1380
+ function useTreeRowIdPrefix() {
1381
+ if (getCurrentInstance() != null) return useId();
1382
+ fallbackPrefix += 1;
1383
+ return `astryx-tree-${fallbackPrefix}`;
1384
+ }
1385
+ /**
1386
+ * 行的 DOM id:表格前缀加行自己的 id。`[A-Za-z0-9-]` 以外的字符(含 `_`)都写成 `_<十六进制码>_`,
1387
+ * 不同的行 id 一定得到不同的 DOM id。
1388
+ */
1389
+ function treeRowDomId(prefix, id) {
1390
+ return `${prefix}-${id.replace(/[^A-Z0-9-]/giu, (char) => `_${char.codePointAt(0)?.toString(16)}_`)}`;
1391
+ }
1392
+ //#endregion
1182
1393
  //#region src/Table/TableTreeCell.vue
1183
1394
  const _hoisted_1$10 = ["aria-expanded", "aria-label"];
1184
1395
  const _hoisted_2$3 = {
@@ -1193,13 +1404,15 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
1193
1404
  level: {},
1194
1405
  hasChildren: { type: Boolean },
1195
1406
  expanded: { type: Boolean },
1196
- indent: { default: "md" }
1407
+ indent: { default: "md" },
1408
+ rowLabel: {}
1197
1409
  },
1198
1410
  emits: ["toggle"],
1199
1411
  setup(__props, { emit: __emit }) {
1200
1412
  const props = __props;
1201
1413
  const emit = __emit;
1202
1414
  const messages = useComponentMessages({ table: tableMessages });
1415
+ const expander = shallowRef(null);
1203
1416
  const step = computed(() => {
1204
1417
  if (props.indent === "sm") return "var(--astryx-spacing-3, 12px)";
1205
1418
  if (props.indent === "lg") return "var(--astryx-spacing-6, 24px)";
@@ -1209,18 +1422,45 @@ const _sfc_main$13 = /*@__PURE__*/ defineComponent({
1209
1422
  "--astryx-table-tree-level": String(props.level),
1210
1423
  "--astryx-table-tree-step": step.value
1211
1424
  }));
1425
+ const label = computed(() => {
1426
+ const table = messages.value.table;
1427
+ const name = props.rowLabel?.trim();
1428
+ if (name) return props.expanded ? table.treeCollapseRowNamed(name) : table.treeExpandRowNamed(name);
1429
+ return props.expanded ? table.treeCollapseRow : table.treeExpandRow;
1430
+ });
1431
+ /**
1432
+ * 披露模式:展开时,按钮用 `aria-controls` 指向它的直接子行。
1433
+ * 子行紧跟在这一行后面,层级正好深一级;遇到同级或更浅的行就到头了。
1434
+ */
1435
+ function linkChildRows() {
1436
+ const button = expander.value;
1437
+ if (button == null) return;
1438
+ const row = button.closest("tr");
1439
+ const ids = [];
1440
+ if (row != null && props.hasChildren && props.expanded) for (let next = row.nextElementSibling; next != null; next = next.nextElementSibling) {
1441
+ const level = Number(next.getAttribute("data-tree-level") ?? NaN);
1442
+ if (Number.isNaN(level) || level <= props.level) break;
1443
+ if (level === props.level + 1 && next.id !== "") ids.push(next.id);
1444
+ }
1445
+ if (ids.length > 0) button.setAttribute("aria-controls", ids.join(" "));
1446
+ else button.removeAttribute("aria-controls");
1447
+ }
1448
+ onMounted(linkChildRows);
1449
+ onUpdated(linkChildRows);
1212
1450
  return (_ctx, _cache) => {
1213
1451
  return openBlock(), createElementBlock("div", {
1214
1452
  class: "astryx-table__tree",
1215
1453
  style: normalizeStyle(treeStyle.value)
1216
1454
  }, [__props.hasChildren ? (openBlock(), createElementBlock("button", {
1217
1455
  key: 0,
1456
+ ref_key: "expander",
1457
+ ref: expander,
1218
1458
  type: "button",
1219
1459
  class: "astryx-table__expander",
1220
1460
  "aria-expanded": __props.expanded ? "true" : "false",
1221
- "aria-label": __props.expanded ? unref(messages).table.collapseRow : unref(messages).table.expandRow,
1461
+ "aria-label": label.value,
1222
1462
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emit("toggle"), ["stop"]))
1223
- }, [createElementVNode("span", { class: normalizeClass(["astryx-table__chevron-icon", { "is-expanded": __props.expanded }]) }, [createVNode(_sfc_main$15, {
1463
+ }, [createElementVNode("span", { class: normalizeClass(["astryx-table__chevron-icon", { "is-expanded": __props.expanded }]) }, [createVNode(_sfc_main$16, {
1224
1464
  icon: "chevronRight",
1225
1465
  size: "xsm"
1226
1466
  })], 2)], 8, _hoisted_1$10)) : (openBlock(), createElementBlock("span", _hoisted_2$3)), createElementVNode("span", _hoisted_3$3, [renderSlot(_ctx.$slots, "default")])], 4);
@@ -1303,6 +1543,7 @@ function treeColumnKey(columns, preferred) {
1303
1543
  function useTableTreeData(config) {
1304
1544
  const messages = useComponentMessages({ table: tableMessages });
1305
1545
  const resolvedKey = ref();
1546
+ const rowIdPrefix = useTreeRowIdPrefix();
1306
1547
  return {
1307
1548
  transformColumns(columns) {
1308
1549
  const current = toValue(config);
@@ -1324,6 +1565,7 @@ function useTableTreeData(config) {
1324
1565
  hasChildren: meta.hasChildren,
1325
1566
  expanded: meta.isExpanded,
1326
1567
  indent: live.indent ?? "md",
1568
+ rowLabel: live.getRowLabel?.(item),
1327
1569
  onToggle: () => live.onToggleItem(item)
1328
1570
  }, { default: () => body });
1329
1571
  }
@@ -1338,14 +1580,14 @@ function useTableTreeData(config) {
1338
1580
  return { before: () => h("button", {
1339
1581
  "type": "button",
1340
1582
  "class": "astryx-table__expander",
1341
- "aria-label": allExpanded ? messages.value.table.collapseAllRows : messages.value.table.expandAllRows,
1583
+ "aria-label": allExpanded ? messages.value.table.treeCollapseAllRows : messages.value.table.treeExpandAllRows,
1342
1584
  "aria-expanded": String(allExpanded),
1343
1585
  "onClick": (event) => {
1344
1586
  event.stopPropagation();
1345
1587
  if (allExpanded) current.onCollapseAll?.();
1346
1588
  else current.onExpandAll?.();
1347
1589
  }
1348
- }, [h("span", { class: ["astryx-table__chevron-icon", allExpanded ? "is-expanded" : void 0] }, [h(_sfc_main$15, {
1590
+ }, [h("span", { class: ["astryx-table__chevron-icon", allExpanded ? "is-expanded" : void 0] }, [h(_sfc_main$16, {
1349
1591
  icon: "chevronRight",
1350
1592
  size: "xsm"
1351
1593
  })])]) };
@@ -1356,8 +1598,8 @@ function useTableTreeData(config) {
1356
1598
  if (meta == null && !current.hasExpandableRows) return null;
1357
1599
  const attrs = {};
1358
1600
  if (meta != null) {
1359
- attrs["aria-level"] = String(meta.level + 1);
1360
- if (meta.hasChildren) attrs["aria-expanded"] = String(meta.isExpanded);
1601
+ attrs.id = treeRowDomId(rowIdPrefix, meta.id);
1602
+ attrs[TREE_LEVEL_ATTRIBUTE] = String(meta.level);
1361
1603
  }
1362
1604
  const clickable = current.hasRowClickExpansion === true && meta?.hasChildren === true;
1363
1605
  return {
@@ -1418,6 +1660,32 @@ function useTableTreeState(config) {
1418
1660
  };
1419
1661
  }
1420
1662
  //#endregion
1663
+ //#region src/Table/headerText.ts
1664
+ /**
1665
+ * 从渲染结果里收集能直接读到的文字:字符串、数字、元素的文本子节点和数组。
1666
+ * 组件节点要渲染后才知道内容,这里读不到,返回空串。
1667
+ */
1668
+ function vnodeText(node) {
1669
+ if (node == null || typeof node === "boolean") return "";
1670
+ if (typeof node === "string" || typeof node === "number") return String(node);
1671
+ if (Array.isArray(node)) return node.map((child) => vnodeText(child)).join("");
1672
+ if (isVNode(node)) {
1673
+ if (typeof node.type !== "string" && typeof node.type !== "symbol") return "";
1674
+ const children = node.children;
1675
+ if (typeof children === "string") return children;
1676
+ if (Array.isArray(children)) return children.map((child) => vnodeText(child)).join("");
1677
+ }
1678
+ return "";
1679
+ }
1680
+ /**
1681
+ * 列头的可见文字,拼无障碍名称用。函数式列头读它渲染出的文字;读不到文字时才退回列 key。
1682
+ */
1683
+ function columnHeaderText(column) {
1684
+ const header = column.header;
1685
+ const trimmed = (typeof header === "function" ? vnodeText(header()) : header ?? "").replace(/\s+/g, " ").trim();
1686
+ return trimmed === "" ? column.key : trimmed;
1687
+ }
1688
+ //#endregion
1421
1689
  //#region src/Table/rowPatch.ts
1422
1690
  /**
1423
1691
  * 把多个插件的行事件合成一个处理器,按插件顺序依次调用。
@@ -1646,7 +1914,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1646
1914
  return openBlock(), createElementBlock("div", {
1647
1915
  class: "astryx-table__filter",
1648
1916
  "data-variant": __props.filter.variant
1649
- }, [__props.filter.variant === "inline" || __props.filter.variant === "inline-compact" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [__props.filter.field.type === "string" ? (openBlock(), createBlock(_sfc_main$28, {
1917
+ }, [__props.filter.variant === "inline" || __props.filter.variant === "inline-compact" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [__props.filter.field.type === "string" ? (openBlock(), createBlock(_sfc_main$29, {
1650
1918
  key: 0,
1651
1919
  "model-value": textValue(draft.value),
1652
1920
  label: __props.filter.field.label,
@@ -1658,7 +1926,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1658
1926
  "model-value",
1659
1927
  "label",
1660
1928
  "placeholder"
1661
- ])) : __props.filter.field.type === "number" ? (openBlock(), createBlock(_sfc_main$25, {
1929
+ ])) : __props.filter.field.type === "number" ? (openBlock(), createBlock(_sfc_main$26, {
1662
1930
  key: 1,
1663
1931
  "model-value": numberValue(draft.value),
1664
1932
  label: __props.filter.field.label,
@@ -1679,7 +1947,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1679
1947
  "max",
1680
1948
  "step",
1681
1949
  "is-integer-only"
1682
- ])) : __props.filter.field.type === "date" ? (openBlock(), createBlock(_sfc_main$23, {
1950
+ ])) : __props.filter.field.type === "date" ? (openBlock(), createBlock(_sfc_main$24, {
1683
1951
  key: 2,
1684
1952
  "model-value": dateValue(draft.value),
1685
1953
  label: __props.filter.field.label,
@@ -1692,7 +1960,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1692
1960
  "model-value",
1693
1961
  "label",
1694
1962
  "placeholder"
1695
- ])) : __props.filter.field.type === "multi-select" ? (openBlock(), createBlock(_sfc_main$24, {
1963
+ ])) : __props.filter.field.type === "multi-select" ? (openBlock(), createBlock(_sfc_main$25, {
1696
1964
  key: 3,
1697
1965
  "model-value": listValue(draft.value),
1698
1966
  label: __props.filter.field.label,
@@ -1710,7 +1978,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1710
1978
  "options",
1711
1979
  "placeholder",
1712
1980
  "searchable"
1713
- ])) : (openBlock(), createBlock(_sfc_main$27, {
1981
+ ])) : (openBlock(), createBlock(_sfc_main$28, {
1714
1982
  key: 4,
1715
1983
  "model-value": textValue(draft.value) || null,
1716
1984
  label: __props.filter.field.label,
@@ -1724,13 +1992,13 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1724
1992
  "label",
1725
1993
  "placeholder",
1726
1994
  "options"
1727
- ]))], 64)) : (openBlock(), createBlock(_sfc_main$22, {
1995
+ ]))], 64)) : (openBlock(), createBlock(_sfc_main$23, {
1728
1996
  key: 1,
1729
1997
  label: triggerLabel.value,
1730
1998
  "has-close-button": false,
1731
1999
  width: 240
1732
2000
  }, {
1733
- content: withCtx(() => [createElementVNode("div", _hoisted_3$2, [__props.filter.field.type === "string" ? (openBlock(), createBlock(_sfc_main$28, {
2001
+ content: withCtx(() => [createElementVNode("div", _hoisted_3$2, [__props.filter.field.type === "string" ? (openBlock(), createBlock(_sfc_main$29, {
1734
2002
  key: 0,
1735
2003
  "model-value": textValue(draft.value),
1736
2004
  label: __props.filter.field.label,
@@ -1742,7 +2010,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1742
2010
  "model-value",
1743
2011
  "label",
1744
2012
  "placeholder"
1745
- ])) : __props.filter.field.type === "number" ? (openBlock(), createBlock(_sfc_main$25, {
2013
+ ])) : __props.filter.field.type === "number" ? (openBlock(), createBlock(_sfc_main$26, {
1746
2014
  key: 1,
1747
2015
  "model-value": numberValue(draft.value),
1748
2016
  label: __props.filter.field.label,
@@ -1762,7 +2030,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1762
2030
  "max",
1763
2031
  "step",
1764
2032
  "is-integer-only"
1765
- ])) : __props.filter.field.type === "date" ? (openBlock(), createBlock(_sfc_main$23, {
2033
+ ])) : __props.filter.field.type === "date" ? (openBlock(), createBlock(_sfc_main$24, {
1766
2034
  key: 2,
1767
2035
  "model-value": dateValue(draft.value),
1768
2036
  label: __props.filter.field.label,
@@ -1774,7 +2042,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1774
2042
  "model-value",
1775
2043
  "label",
1776
2044
  "placeholder"
1777
- ])) : __props.filter.field.type === "multi-select" ? (openBlock(), createBlock(_sfc_main$24, {
2045
+ ])) : __props.filter.field.type === "multi-select" ? (openBlock(), createBlock(_sfc_main$25, {
1778
2046
  key: 3,
1779
2047
  "model-value": listValue(draft.value),
1780
2048
  label: __props.filter.field.label,
@@ -1789,7 +2057,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1789
2057
  "label",
1790
2058
  "options",
1791
2059
  "placeholder"
1792
- ])) : (openBlock(), createBlock(_sfc_main$27, {
2060
+ ])) : (openBlock(), createBlock(_sfc_main$28, {
1793
2061
  key: 4,
1794
2062
  "model-value": textValue(draft.value) || null,
1795
2063
  label: __props.filter.field.label,
@@ -1803,7 +2071,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1803
2071
  "label",
1804
2072
  "placeholder",
1805
2073
  "options"
1806
- ])), createElementVNode("div", _hoisted_4$2, [createVNode(_sfc_main$16, {
2074
+ ])), createElementVNode("div", _hoisted_4$2, [createVNode(_sfc_main$17, {
1807
2075
  variant: "ghost",
1808
2076
  size: "sm",
1809
2077
  label: unref(messages).table.reset,
@@ -1814,7 +2082,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1814
2082
  }, {
1815
2083
  default: withCtx(() => [createTextVNode(toDisplayString(unref(messages).table.reset), 1)]),
1816
2084
  _: 1
1817
- }, 8, ["label"]), createVNode(_sfc_main$16, {
2085
+ }, 8, ["label"]), createVNode(_sfc_main$17, {
1818
2086
  variant: "primary",
1819
2087
  size: "sm",
1820
2088
  label: unref(messages).table.apply,
@@ -1828,7 +2096,7 @@ const _sfc_main$12 = /*@__PURE__*/ defineComponent({
1828
2096
  class: "astryx-table__filter-trigger",
1829
2097
  "aria-label": triggerLabel.value,
1830
2098
  "data-active": hasValue.value || void 0
1831
- }, [createVNode(_sfc_main$15, {
2099
+ }, [createVNode(_sfc_main$16, {
1832
2100
  icon: "funnel",
1833
2101
  size: "xsm",
1834
2102
  color: hasValue.value ? "accent" : "secondary"
@@ -1872,7 +2140,7 @@ const _sfc_main$11 = /*@__PURE__*/ defineComponent({
1872
2140
  "aria-expanded": __props.collapsed ? "false" : "true",
1873
2141
  "aria-label": __props.collapsed ? unref(messages).table.expandGroup(__props.groupKey) : unref(messages).table.collapseGroup(__props.groupKey),
1874
2142
  onClick: _cache[0] || (_cache[0] = withModifiers(($event) => emit("toggle"), ["stop"]))
1875
- }, [createElementVNode("span", { class: normalizeClass(["astryx-table__chevron-icon", { "is-expanded": !__props.collapsed }]) }, [createVNode(_sfc_main$15, {
2143
+ }, [createElementVNode("span", { class: normalizeClass(["astryx-table__chevron-icon", { "is-expanded": !__props.collapsed }]) }, [createVNode(_sfc_main$16, {
1876
2144
  icon: "chevronRight",
1877
2145
  size: "sm"
1878
2146
  })], 2)], 8, _hoisted_2$1), renderSlot(_ctx.$slots, "default", {}, () => [createElementVNode("span", _hoisted_3$1, [
@@ -1973,7 +2241,7 @@ const _sfc_main$10 = /*@__PURE__*/ defineComponent({
1973
2241
  onClick: ($event) => choose(item),
1974
2242
  onFocusin: ($event) => active.value = index,
1975
2243
  onMouseenter: ($event) => active.value = index
1976
- }, [item.icon ? (openBlock(), createBlock(_sfc_main$15, {
2244
+ }, [item.icon ? (openBlock(), createBlock(_sfc_main$16, {
1977
2245
  key: 0,
1978
2246
  icon: item.icon,
1979
2247
  size: "xsm"
@@ -2016,25 +2284,109 @@ const _sfc_main$9 = /*@__PURE__*/ defineComponent({
2016
2284
  role: "group",
2017
2285
  "aria-label": __props.label,
2018
2286
  tabindex: tabindex.value
2019
- }, unref(scroll).viewportAttrs.value, { style: rootStyle.value }), [createElementVNode("div", {
2287
+ }, unref(scroll).viewportAttrs.value, { style: rootStyle.value }), [createCommentVNode("\n 表格的直接父元素永远不滚动:外层滚动区是唯一的视口。有的页面宿主给每个表格的父元素都写了\n 不在层叠层里的 overflow-x: auto,只有内联样式压得住它;两个方向都写 visible,免得一边 visible\n 一边滚动时被算成 auto。\n "), createElementVNode("div", {
2020
2288
  ref: unref(scroll).content,
2021
- "data-scroll-content": ""
2289
+ "data-scroll-content": "",
2290
+ style: { "overflow": "visible" }
2022
2291
  }, [renderSlot(_ctx.$slots, "default")], 512)], 16, _hoisted_1$6);
2023
2292
  };
2024
2293
  }
2025
2294
  });
2026
2295
  //#endregion
2296
+ //#region src/Table/useColumnResizeAria.ts
2297
+ /**
2298
+ * 窗口的宽度,由根元素上共用的尺寸观察器在布局之后报告,渲染时不读布局。
2299
+ * 没有订阅者时为 `null`;服务端渲染也是 `null`,所以首屏不带替代上限。
2300
+ */
2301
+ const windowWidth = ref(null);
2302
+ let subscribers = 0;
2303
+ let stopObserving = null;
2304
+ function subscribeWindowWidth() {
2305
+ subscribers += 1;
2306
+ stopObserving ??= observeResize(document.documentElement, () => {
2307
+ windowWidth.value = window.innerWidth;
2308
+ });
2309
+ return () => {
2310
+ subscribers -= 1;
2311
+ if (subscribers === 0) {
2312
+ stopObserving?.();
2313
+ stopObserving = null;
2314
+ windowWidth.value = null;
2315
+ }
2316
+ };
2317
+ }
2318
+ /**
2319
+ * 列宽把手的 `aria-value*`。
2320
+ *
2321
+ * 当前值是这一列实际渲染出的宽度(观察表头格得到),没量到之前退到插件给的宽度,再退到最窄宽度。
2322
+ * 没有最大宽度的列,ARIA 会默认上限 100,比多数列宽还小,所以用窗口宽度当替代上限,
2323
+ * 并且不低于当前值和最窄宽度;这个上限不是真实限制,所以再用 `aria-valuetext` 念出像素数。
2324
+ * 布局可能把列撑到上下限以外,这时宣布的范围放宽到能装下当前值。
2325
+ */
2326
+ function useColumnResizeAria(widthText) {
2327
+ const measured = reactive(/* @__PURE__ */ new Map());
2328
+ const observed = /* @__PURE__ */ new Map();
2329
+ function observeHandle(key, element) {
2330
+ const cell = element instanceof HTMLElement ? element.closest("th") : null;
2331
+ const current = observed.get(key);
2332
+ if (current?.cell === cell) return;
2333
+ current?.stop();
2334
+ observed.delete(key);
2335
+ if (cell == null) {
2336
+ measured.delete(key);
2337
+ return;
2338
+ }
2339
+ const stop = observeResize(cell, (entry) => {
2340
+ const width = entry.borderBoxSize?.[0]?.inlineSize ?? cell.getBoundingClientRect().width;
2341
+ if (width > 0) measured.set(key, Math.round(width));
2342
+ });
2343
+ observed.set(key, {
2344
+ cell,
2345
+ stop
2346
+ });
2347
+ }
2348
+ let unsubscribe = null;
2349
+ onMounted(() => {
2350
+ unsubscribe = subscribeWindowWidth();
2351
+ });
2352
+ onBeforeUnmount(() => {
2353
+ unsubscribe?.();
2354
+ for (const { stop } of observed.values()) stop();
2355
+ observed.clear();
2356
+ });
2357
+ function ariaValue(key, contribution) {
2358
+ const minWidth = contribution?.minWidth ?? 0;
2359
+ const maxWidth = contribution?.maxWidth ?? Number.POSITIVE_INFINITY;
2360
+ const now = measured.get(key) ?? contribution?.currentWidth ?? minWidth;
2361
+ const isUnbounded = !Number.isFinite(maxWidth);
2362
+ const extent = windowWidth.value;
2363
+ return {
2364
+ now,
2365
+ min: Math.min(minWidth, now),
2366
+ max: isUnbounded ? extent == null ? void 0 : Math.max(extent, now, minWidth) : Math.max(maxWidth, now),
2367
+ text: isUnbounded ? widthText(Math.round(now)) : void 0
2368
+ };
2369
+ }
2370
+ return {
2371
+ observeHandle,
2372
+ ariaValue,
2373
+ measured,
2374
+ windowWidth
2375
+ };
2376
+ }
2377
+ //#endregion
2027
2378
  //#region src/Table/useHeaderCutText.ts
2028
2379
  /**
2029
2380
  * 表头标题被列宽截短时,键盘焦点到达单元格里的东西(可排序表头的排序按钮)
2030
- * 就在提示里显示完整标题。鼠标悬停不显示。只在表格里的表头单元格上生效。
2381
+ * 就在提示里显示完整标题。鼠标悬停不显示。只有 `textOverflow="truncate"` 的表头会被截短,
2382
+ * 也只在那里生效;默认的 `wrap` 下标题会折行,不会被截。
2031
2383
  * 监听挂在表头行或单元格上都行:焦点从哪个 `<th>` 里来,就量哪个。
2032
2384
  */
2033
2385
  function useHeaderCutText() {
2034
2386
  const cell = shallowRef(null);
2035
2387
  const cut = useCutTextOnKeyboardFocus({
2036
2388
  anchor: () => cell.value,
2037
- isEnabled: () => cell.value?.closest(".astryx-table") != null
2389
+ isEnabled: () => cell.value?.closest(".astryx-table[data-overflow=\"truncate\"]") != null
2038
2390
  });
2039
2391
  return {
2040
2392
  cell,
@@ -2125,13 +2477,9 @@ function useTableColumnResizeSession(options) {
2125
2477
  if (Object.keys(updates).length === 0) return;
2126
2478
  for (const plugin of options.plugins()) plugin.onColumnResizeEnd?.(updates);
2127
2479
  }
2480
+ /** 按列头的可见文字命名,函数式列头也读它渲染出的文字;读不到文字才用列 key。 */
2128
2481
  function resizeLabel(column) {
2129
- const header = typeof column.header === "string" && column.header.length > 0 ? column.header : column.key;
2130
- return options.resizeColumnLabel(header);
2131
- }
2132
- function resizeMax(contribution) {
2133
- const max = contribution?.maxWidth;
2134
- return max == null || !Number.isFinite(max) ? void 0 : max;
2482
+ return options.resizeColumnLabel(columnHeaderText(column));
2135
2483
  }
2136
2484
  function startResize(event, column) {
2137
2485
  const target = event.currentTarget;
@@ -2202,8 +2550,143 @@ function useTableColumnResizeSession(options) {
2202
2550
  return {
2203
2551
  startResize,
2204
2552
  onResizeKeydown,
2205
- resizeLabel,
2206
- resizeMax
2553
+ resizeLabel
2554
+ };
2555
+ }
2556
+ //#endregion
2557
+ //#region src/Table/useTableDataModel.ts
2558
+ /**
2559
+ * 数据模式表格的列与单元格模型:插件改过的列、列宽、拖动改宽、排序和筛选的贡献,
2560
+ * 以及每个格子叠加插件补丁后的类名、样式和属性。模板只管把它们画出来。
2561
+ */
2562
+ function useTableDataModel(options) {
2563
+ const resolvedColumns = computed(() => options.plugins().reduce((columns, plugin) => plugin.transformColumns?.(columns) ?? columns, [...options.columns()]));
2564
+ const selection = computed(() => options.plugins().find((plugin) => plugin.selection)?.selection);
2565
+ /**
2566
+ * 选择列的宽度可以被插件的 `widthFor` 改(原版靠 `transformColumns` 改选择列宽)。
2567
+ * 它和别的列一起进 `resolveColumnWidths`,所以表头、数据格和表格最小宽度读到同一个值。
2568
+ */
2569
+ const selectionColumn = computed(() => {
2570
+ const base = selectColumn();
2571
+ const override = options.plugins().map((plugin) => plugin.widthFor?.(base)).find((value) => value != null);
2572
+ return override == null ? base : {
2573
+ ...base,
2574
+ width: pixel(override)
2575
+ };
2576
+ });
2577
+ const layoutColumns = computed(() => selection.value ? [selectionColumn.value, ...resolvedColumns.value] : resolvedColumns.value);
2578
+ const widths = computed(() => resolveColumnWidths(layoutColumns.value));
2579
+ const canResize = computed(() => options.plugins().some((plugin) => plugin.onColumnResizeEnd));
2580
+ /**
2581
+ * 一列参与拖动改宽的方式。第一个给出结果的插件说了算。
2582
+ * 只实现了 `onColumnResizeEnd` 的老插件仍然拿到一个最朴素的把手:只管自己这一列,最窄 60px。
2583
+ */
2584
+ function resizeContribution(column) {
2585
+ for (const plugin of options.plugins()) {
2586
+ const contribution = plugin.resizeFor?.(column, resolvedColumns.value);
2587
+ if (contribution != null) return contribution;
2588
+ }
2589
+ if (!canResize.value || column.resizable === false) return null;
2590
+ return {
2591
+ minWidth: 60,
2592
+ maxWidth: Number.POSITIVE_INFINITY,
2593
+ neighborKey: null,
2594
+ hasHandle: true
2595
+ };
2596
+ }
2597
+ const resizeContributions = computed(() => new Map(resolvedColumns.value.map((column) => [column.key, resizeContribution(column)])));
2598
+ function styleFor(column) {
2599
+ const base = { ...widths.value.columns.get(column.key)?.style ?? {} };
2600
+ const override = options.plugins().map((plugin) => plugin.widthFor?.(column)).find((value) => value != null) ?? resizeContributions.value.get(column.key)?.currentWidth;
2601
+ if (override != null) {
2602
+ base.width = `${override}px`;
2603
+ base.minWidth = `${override}px`;
2604
+ }
2605
+ return base;
2606
+ }
2607
+ function sortFor(column) {
2608
+ for (const plugin of options.plugins()) {
2609
+ const sort = plugin.sortFor?.(column);
2610
+ if (sort) return sort;
2611
+ }
2612
+ return null;
2613
+ }
2614
+ function filterFor(column) {
2615
+ for (const plugin of options.plugins()) {
2616
+ const filter = plugin.filterFor?.(column);
2617
+ if (filter) return filter;
2618
+ }
2619
+ return null;
2620
+ }
2621
+ const filterContributions = computed(() => new Map(resolvedColumns.value.map((column) => [column.key, filterFor(column)])));
2622
+ /**
2623
+ * 取某一列落在指定位置的筛选控件。
2624
+ * `popover` 是一个漏斗按钮,跟标题、排序图标同一行;`inline` 系列是输入框,垫在标题下面。
2625
+ */
2626
+ function filterAt(column, place) {
2627
+ const filter = filterContributions.value.get(column.key) ?? null;
2628
+ if (filter == null) return null;
2629
+ return (filter.variant === "popover" ? "line" : "below") === place ? filter : null;
2630
+ }
2631
+ function mergeCell(column, row, kind) {
2632
+ const style = {};
2633
+ const classes = [];
2634
+ const attrs = {};
2635
+ for (const plugin of options.plugins()) {
2636
+ const patch = plugin.cellPatch?.({
2637
+ column,
2638
+ columns: layoutColumns.value,
2639
+ row,
2640
+ kind
2641
+ });
2642
+ if (patch == null) continue;
2643
+ if (patch.class) classes.push(patch.class);
2644
+ if (patch.style) Object.assign(style, patch.style);
2645
+ if (patch.attrs) Object.assign(attrs, patch.attrs);
2646
+ }
2647
+ return {
2648
+ class: classes.join(" ") || void 0,
2649
+ style,
2650
+ attrs
2651
+ };
2652
+ }
2653
+ function headerStyle(column) {
2654
+ return {
2655
+ ...styleFor(column),
2656
+ ...mergeCell(column, null, "header").style
2657
+ };
2658
+ }
2659
+ function bodyStyle(column, row) {
2660
+ const style = { ...mergeCell(column, row, "body").style };
2661
+ if (column.verticalAlign) style.verticalAlign = column.verticalAlign;
2662
+ return style;
2663
+ }
2664
+ /** 选择列的格子:宽度来自布局里的选择列,再叠加插件的补丁。 */
2665
+ function selectCellPatch(kind, row) {
2666
+ const patch = mergeCell(selectionColumn.value, row, kind);
2667
+ const width = widths.value.columns.get(selectionColumn.value.key)?.style.width;
2668
+ return {
2669
+ ...patch,
2670
+ style: {
2671
+ width,
2672
+ minWidth: width,
2673
+ maxWidth: width,
2674
+ ...patch.style
2675
+ }
2676
+ };
2677
+ }
2678
+ return {
2679
+ resolvedColumns,
2680
+ layoutColumns,
2681
+ selection,
2682
+ widths,
2683
+ resizeContributions,
2684
+ sortFor,
2685
+ filterAt,
2686
+ mergeCell,
2687
+ headerStyle,
2688
+ bodyStyle,
2689
+ selectCellPatch
2207
2690
  };
2208
2691
  }
2209
2692
  //#endregion
@@ -2218,38 +2701,55 @@ const _hoisted_1$5 = [
2218
2701
  "data-row-highlight",
2219
2702
  "aria-rowcount"
2220
2703
  ];
2221
- const _hoisted_2 = [
2704
+ const _hoisted_2 = {
2705
+ class: "astryx-table-row",
2706
+ "data-header-row": ""
2707
+ };
2708
+ const _hoisted_3 = [
2222
2709
  "data-column",
2223
2710
  "data-align",
2224
- "aria-sort"
2711
+ "aria-sort",
2712
+ "aria-labelledby"
2225
2713
  ];
2226
- const _hoisted_3 = { class: "astryx-table__header" };
2227
- const _hoisted_4 = { class: "astryx-table__header-line" };
2228
- const _hoisted_5 = [
2714
+ const _hoisted_4 = ["id"];
2715
+ const _hoisted_5 = { class: "astryx-table__header-line" };
2716
+ const _hoisted_6 = [
2229
2717
  "data-align",
2230
2718
  "aria-describedby",
2231
2719
  "onClick"
2232
2720
  ];
2233
- const _hoisted_6 = ["data-active"];
2234
2721
  const _hoisted_7 = {
2722
+ key: 1,
2723
+ class: "astryx-table__header-label"
2724
+ };
2725
+ const _hoisted_8 = ["data-active"];
2726
+ const _hoisted_9 = {
2235
2727
  key: 2,
2236
2728
  class: "astryx-table__sort-rank",
2237
2729
  "aria-hidden": "true"
2238
2730
  };
2239
- const _hoisted_8 = ["id"];
2240
- const _hoisted_9 = [
2731
+ const _hoisted_10 = ["id"];
2732
+ const _hoisted_11 = {
2733
+ key: 2,
2734
+ class: "astryx-table__header-label"
2735
+ };
2736
+ const _hoisted_12 = [
2241
2737
  "aria-label",
2242
2738
  "aria-valuenow",
2243
2739
  "aria-valuemin",
2244
2740
  "aria-valuemax",
2741
+ "aria-valuetext",
2245
2742
  "onPointerdown",
2246
2743
  "onKeydown"
2247
2744
  ];
2248
- const _hoisted_10 = { key: 0 };
2249
- const _hoisted_11 = ["colspan"];
2250
- const _hoisted_12 = [
2745
+ const _hoisted_13 = { key: 0 };
2746
+ const _hoisted_14 = ["colspan"];
2747
+ const _hoisted_15 = [
2251
2748
  "aria-selected",
2252
2749
  "aria-rowindex",
2750
+ "data-parity",
2751
+ "data-striped",
2752
+ "data-selected",
2253
2753
  "onBlur",
2254
2754
  "onClick",
2255
2755
  "onContextmenu",
@@ -2257,10 +2757,10 @@ const _hoisted_12 = [
2257
2757
  "onMouseenter",
2258
2758
  "onMouseleave"
2259
2759
  ];
2260
- const _hoisted_13 = ["colspan"];
2261
- const _hoisted_14 = ["data-column", "data-align"];
2262
- const _hoisted_15 = ["data-variant"];
2263
2760
  const _hoisted_16 = ["colspan"];
2761
+ const _hoisted_17 = ["data-column", "data-align"];
2762
+ const _hoisted_18 = ["data-variant"];
2763
+ const _hoisted_19 = ["colspan"];
2264
2764
  const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2265
2765
  inheritAttrs: false,
2266
2766
  __name: "TableData",
@@ -2284,51 +2784,22 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2284
2784
  const headerCutText = useHeaderCutText();
2285
2785
  const attrs = useAttrs();
2286
2786
  const messages = useComponentMessages({ table: tableMessages });
2787
+ const headerIdPrefix = useId();
2287
2788
  /** 排序按钮描述(多列排序时的优先级)的 id 前缀,后面接列的序号。 */
2288
2789
  const sortIdBase = useId();
2289
2790
  const scrollRoot = ref(null);
2290
2791
  const menu = ref(null);
2291
2792
  const scrollStyle = computed(() => splitStyleMinWidth(attrs.style).style);
2292
- const resolvedColumns = computed(() => props.plugins.reduce((columns, plugin) => plugin.transformColumns?.(columns) ?? columns, [...props.columns]));
2293
- const selection = computed(() => props.plugins.find((plugin) => plugin.selection)?.selection);
2294
- /**
2295
- * 选择列的宽度可以被插件的 `widthFor` 改(原版靠 `transformColumns` 改选择列宽)。
2296
- * 它和别的列一起进 `resolveColumnWidths`,所以表头、数据格和表格最小宽度读到同一个值。
2297
- */
2298
- const selectionColumn = computed(() => {
2299
- const base = selectColumn();
2300
- const override = props.plugins.map((plugin) => plugin.widthFor?.(base)).find((value) => value != null);
2301
- return override == null ? base : {
2302
- ...base,
2303
- width: pixel(override)
2304
- };
2793
+ const { resolvedColumns, layoutColumns, selection, widths, resizeContributions, sortFor, filterAt, mergeCell, headerStyle, bodyStyle, selectCellPatch } = useTableDataModel({
2794
+ columns: () => props.columns,
2795
+ plugins: () => props.plugins
2305
2796
  });
2306
- const layoutColumns = computed(() => selection.value ? [selectionColumn.value, ...resolvedColumns.value] : resolvedColumns.value);
2307
- const widths = computed(() => resolveColumnWidths(layoutColumns.value));
2308
- const canResize = computed(() => props.plugins.some((plugin) => plugin.onColumnResizeEnd));
2309
- /**
2310
- * 一列参与拖动改宽的方式。第一个给出结果的插件说了算。
2311
- * 只实现了 `onColumnResizeEnd` 的老插件仍然拿到一个最朴素的把手:只管自己这一列,最窄 60px。
2312
- */
2313
- function resizeContribution(column) {
2314
- for (const plugin of props.plugins) {
2315
- const contribution = plugin.resizeFor?.(column, resolvedColumns.value);
2316
- if (contribution != null) return contribution;
2317
- }
2318
- if (!canResize.value || column.resizable === false) return null;
2319
- return {
2320
- minWidth: 60,
2321
- maxWidth: Number.POSITIVE_INFINITY,
2322
- neighborKey: null,
2323
- hasHandle: true
2324
- };
2325
- }
2326
- const resizeContributions = computed(() => new Map(resolvedColumns.value.map((column) => [column.key, resizeContribution(column)])));
2327
- const { startResize, onResizeKeydown, resizeLabel, resizeMax } = useTableColumnResizeSession({
2797
+ const { startResize, onResizeKeydown, resizeLabel } = useTableColumnResizeSession({
2328
2798
  plugins: () => props.plugins,
2329
2799
  contributions: () => resizeContributions.value,
2330
2800
  resizeColumnLabel: (header) => messages.value.table.resizeColumn(header)
2331
2801
  });
2802
+ const resizeAria = useColumnResizeAria((width) => messages.value.table.columnWidthValue(width));
2332
2803
  const tableStyle = computed(() => ({ minWidth: resolveTableMinWidth(splitStyleMinWidth(attrs.style).minWidth, widths.value.tableMinWidth) }));
2333
2804
  const columnCount = computed(() => layoutColumns.value.length);
2334
2805
  const trackRows = computed(() => props.rowCount != null || props.rowIndexStart != null);
@@ -2348,85 +2819,22 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2348
2819
  onBeforeUnmount(() => {
2349
2820
  bindScroll(null);
2350
2821
  });
2351
- /** 列头的纯文本形态:函数式列头没有纯文本,可访问名称回退到 key。 */
2352
- function headerText(column) {
2353
- return typeof column.header === "string" && column.header !== "" ? column.header : column.key;
2354
- }
2355
2822
  /** 列头内容:字符串直接显示,函数按函数式组件渲染。 */
2356
2823
  function HeaderContent(props) {
2357
- return typeof props.column.header === "function" ? props.column.header() : h("span", null, headerText(props.column));
2358
- }
2359
- function styleFor(column) {
2360
- const base = { ...widths.value.columns.get(column.key)?.style ?? {} };
2361
- const override = props.plugins.map((plugin) => plugin.widthFor?.(column)).find((value) => value != null) ?? resizeContributions.value.get(column.key)?.currentWidth;
2362
- if (override != null) {
2363
- base.width = `${override}px`;
2364
- base.minWidth = `${override}px`;
2365
- }
2366
- return base;
2367
- }
2368
- function sortFor(column) {
2369
- for (const plugin of props.plugins) {
2370
- const sort = plugin.sortFor?.(column);
2371
- if (sort) return sort;
2372
- }
2373
- return null;
2374
- }
2375
- function filterFor(column) {
2376
- for (const plugin of props.plugins) {
2377
- const filter = plugin.filterFor?.(column);
2378
- if (filter) return filter;
2379
- }
2380
- return null;
2824
+ return typeof props.column.header === "function" ? props.column.header() : h("span", null, columnHeaderText(props.column));
2381
2825
  }
2382
- const filterContributions = computed(() => new Map(resolvedColumns.value.map((column) => [column.key, filterFor(column)])));
2383
2826
  /**
2384
- * 取某一列落在指定位置的筛选控件。
2385
- * `popover` 是一个漏斗按钮,跟标题、排序图标同一行;`inline` 系列是输入框,垫在标题下面。
2827
+ * 有拖动把手的列头不从内容取名字:把手是可聚焦的分隔条,会把它的宽度值拼进列头名里。
2828
+ * 这时列头用 `aria-labelledby` 指向标题那一块,名字只剩标题。
2386
2829
  */
2387
- function filterAt(column, place) {
2388
- const filter = filterContributions.value.get(column.key) ?? null;
2389
- if (filter == null) return null;
2390
- return (filter.variant === "popover" ? "line" : "below") === place ? filter : null;
2830
+ function headerContentId(index) {
2831
+ return `${headerIdPrefix}-header-${index}`;
2391
2832
  }
2392
2833
  function rowKey(row, index) {
2393
2834
  if (typeof props.idKey === "function") return props.idKey(row);
2394
2835
  const id = row[props.idKey];
2395
2836
  return id == null ? String(index) : String(id);
2396
2837
  }
2397
- function mergeCell(column, row, kind) {
2398
- const style = {};
2399
- const classes = [];
2400
- const attrs = {};
2401
- for (const plugin of props.plugins) {
2402
- const patch = plugin.cellPatch?.({
2403
- column,
2404
- columns: layoutColumns.value,
2405
- row,
2406
- kind
2407
- });
2408
- if (patch == null) continue;
2409
- if (patch.class) classes.push(patch.class);
2410
- if (patch.style) Object.assign(style, patch.style);
2411
- if (patch.attrs) Object.assign(attrs, patch.attrs);
2412
- }
2413
- return {
2414
- class: classes.join(" ") || void 0,
2415
- style,
2416
- attrs
2417
- };
2418
- }
2419
- function headerStyle(column) {
2420
- return {
2421
- ...styleFor(column),
2422
- ...mergeCell(column, null, "header").style
2423
- };
2424
- }
2425
- function bodyStyle(column, row) {
2426
- const style = { ...mergeCell(column, row, "body").style };
2427
- if (column.verticalAlign) style.verticalAlign = column.verticalAlign;
2428
- return style;
2429
- }
2430
2838
  /** Vue 的 ref 回调拿到的是更宽的 `Element`,收窄成 `<tr>` 再交给插件。 */
2431
2839
  function rowRefBinding(patch) {
2432
2840
  const callback = patch.ref;
@@ -2464,23 +2872,11 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2464
2872
  items
2465
2873
  };
2466
2874
  }
2467
- /** 选择列的格子:宽度来自布局里的选择列,再叠加插件的补丁。 */
2468
- function selectCellPatch(kind, row) {
2469
- const patch = mergeCell(selectionColumn.value, row, kind);
2470
- const width = widths.value.columns.get(selectionColumn.value.key)?.style.width;
2471
- return {
2472
- ...patch,
2473
- style: {
2474
- width,
2475
- minWidth: width,
2476
- maxWidth: width,
2477
- ...patch.style
2478
- }
2479
- };
2480
- }
2481
2875
  function isSelected(row) {
2482
2876
  return selection.value?.isSelected(row) === true;
2483
2877
  }
2878
+ /** 有插件正在加载下一批时,空表格不显示默认的空状态。 */
2879
+ const isLoadingRows = computed(() => props.plugins.some((plugin) => plugin.loadingState?.().isLoading === true));
2484
2880
  function isEnabled(row) {
2485
2881
  return selection.value?.isEnabled?.(row) ?? true;
2486
2882
  }
@@ -2508,7 +2904,7 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2508
2904
  "data-hover": __props.hasHover || void 0,
2509
2905
  "data-overflow": __props.textOverflow,
2510
2906
  "data-valign": __props.verticalAlign,
2511
- "data-row-highlight": selection.value?.hasRowHighlight === false ? "off" : void 0,
2907
+ "data-row-highlight": unref(selection)?.hasRowHighlight === false ? "off" : void 0,
2512
2908
  "aria-rowcount": ariaRowCount.value,
2513
2909
  style: normalizeStyle(tableStyle.value)
2514
2910
  }, [createElementVNode("thead", {
@@ -2516,108 +2912,110 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2516
2912
  onFocusout: _cache[2] || (_cache[2] = (...args) => unref(headerCutText).onFocusout && unref(headerCutText).onFocusout(...args)),
2517
2913
  onPointerdown: _cache[3] || (_cache[3] = (...args) => unref(headerCutText).onPointerdown && unref(headerCutText).onPointerdown(...args)),
2518
2914
  onKeydown: _cache[4] || (_cache[4] = (...args) => unref(headerCutText).onKeydown && unref(headerCutText).onKeydown(...args))
2519
- }, [createElementVNode("tr", null, [selection.value ? (openBlock(), createElementBlock("th", mergeProps({
2915
+ }, [createElementVNode("tr", _hoisted_2, [unref(selection) ? (openBlock(), createElementBlock("th", mergeProps({
2520
2916
  key: 0,
2521
- class: ["astryx-table__select", selectCellPatch("header", null).class],
2917
+ class: ["astryx-table__select", unref(selectCellPatch)("header", null).class],
2522
2918
  scope: "col"
2523
- }, selectCellPatch("header", null).attrs, { style: selectCellPatch("header", null).style }), [createVNode(_sfc_main$20, {
2524
- "model-value": selection.value.isIndeterminate() ? "indeterminate" : selection.value.isAllSelected(),
2919
+ }, unref(selectCellPatch)("header", null).attrs, { style: unref(selectCellPatch)("header", null).style }), [createVNode(_sfc_main$21, {
2920
+ "model-value": unref(selection).isIndeterminate() ? "indeterminate" : unref(selection).isAllSelected(),
2525
2921
  label: unref(messages).table.selectAllRows,
2526
2922
  "is-label-hidden": "",
2527
2923
  size: "sm",
2528
- "onUpdate:modelValue": _cache[0] || (_cache[0] = (value) => selection.value?.selectAll(value === true))
2529
- }, null, 8, ["model-value", "label"])], 16)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(resolvedColumns.value, (column, columnIndex) => {
2924
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = (value) => unref(selection)?.selectAll(value === true))
2925
+ }, null, 8, ["model-value", "label"])], 16)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(resolvedColumns), (column, columnIndex) => {
2530
2926
  return openBlock(), createElementBlock("th", mergeProps({
2531
2927
  key: column.key,
2532
2928
  scope: "col",
2533
2929
  "data-column": column.key,
2534
2930
  "data-align": column.align,
2535
- class: mergeCell(column, null, "header").class
2536
- }, { ref_for: true }, mergeCell(column, null, "header").attrs, {
2537
- style: headerStyle(column),
2538
- "aria-sort": sortFor(column)?.direction ?? void 0
2931
+ class: unref(mergeCell)(column, null, "header").class
2932
+ }, { ref_for: true }, unref(mergeCell)(column, null, "header").attrs, {
2933
+ style: unref(headerStyle)(column),
2934
+ "aria-sort": unref(sortFor)(column)?.direction ?? void 0,
2935
+ "aria-labelledby": unref(resizeContributions).get(column.key)?.hasHandle ? headerContentId(columnIndex) : void 0
2539
2936
  }), [
2540
- createElementVNode("div", _hoisted_3, [createElementVNode("div", _hoisted_4, [
2937
+ createElementVNode("div", {
2938
+ id: headerContentId(columnIndex),
2939
+ class: "astryx-table__header"
2940
+ }, [createElementVNode("div", _hoisted_5, [
2541
2941
  createVNode(unref(HeaderAddon), {
2542
2942
  column,
2543
2943
  plugins: __props.plugins
2544
2944
  }, null, 8, ["column", "plugins"]),
2545
- sortFor(column) ? (openBlock(), createElementBlock("button", {
2546
- key: 0,
2945
+ unref(sortFor)(column) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("button", {
2547
2946
  type: "button",
2548
2947
  class: "astryx-table__sort",
2549
2948
  "data-align": column.align,
2550
- "aria-describedby": sortFor(column)?.description ? `${unref(sortIdBase)}-${columnIndex}` : void 0,
2551
- onClick: ($event) => sortFor(column)?.onClick($event)
2949
+ "aria-describedby": unref(sortFor)(column)?.description ? `${unref(sortIdBase)}-${columnIndex}` : void 0,
2950
+ onClick: ($event) => unref(sortFor)(column)?.onClick($event)
2552
2951
  }, [
2553
- column.headerHidden ? (openBlock(), createBlock(_sfc_main$18, { key: 0 }, {
2554
- default: withCtx(() => [createTextVNode(toDisplayString(headerText(column)), 1)]),
2952
+ column.headerHidden ? (openBlock(), createBlock(_sfc_main$19, { key: 0 }, {
2953
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(columnHeaderText)(column)), 1)]),
2555
2954
  _: 2
2556
- }, 1024)) : (openBlock(), createBlock(HeaderContent, {
2557
- key: 1,
2558
- column
2559
- }, null, 8, ["column"])),
2955
+ }, 1024)) : (openBlock(), createElementBlock("span", _hoisted_7, [createVNode(HeaderContent, { column }, null, 8, ["column"])])),
2560
2956
  createElementVNode("span", {
2561
2957
  class: "astryx-table__sort-icon",
2562
- "data-active": sortFor(column)?.direction != null || void 0
2563
- }, [createVNode(_sfc_main$21, {
2958
+ "data-active": unref(sortFor)(column)?.direction != null || void 0
2959
+ }, [createVNode(_sfc_main$22, {
2564
2960
  "icon-slot": "table-sort-indicator",
2565
- state: { direction: sortFor(column)?.direction ?? "none" },
2961
+ state: { direction: unref(sortFor)(column)?.direction ?? "none" },
2566
2962
  fallback: {
2567
- icon: sortFor(column)?.direction === "descending" ? "arrowDown" : "arrowUp",
2963
+ icon: unref(sortFor)(column)?.direction === "descending" ? "arrowDown" : "arrowUp",
2568
2964
  size: "xsm"
2569
2965
  }
2570
- }, null, 8, ["state", "fallback"])], 8, _hoisted_6),
2571
- sortFor(column)?.rank ? (openBlock(), createElementBlock("span", _hoisted_7, toDisplayString(sortFor(column)?.rank), 1)) : createCommentVNode("v-if", true)
2572
- ], 8, _hoisted_5)) : createCommentVNode("v-if", true),
2573
- sortFor(column)?.description ? (openBlock(), createElementBlock("span", {
2574
- key: 1,
2966
+ }, null, 8, ["state", "fallback"])], 8, _hoisted_8),
2967
+ unref(sortFor)(column)?.rank ? (openBlock(), createElementBlock("span", _hoisted_9, toDisplayString(unref(sortFor)(column)?.rank), 1)) : createCommentVNode("v-if", true)
2968
+ ], 8, _hoisted_6), unref(sortFor)(column)?.description ? (openBlock(), createElementBlock("span", {
2969
+ key: 0,
2575
2970
  id: `${unref(sortIdBase)}-${columnIndex}`,
2576
2971
  hidden: ""
2577
- }, toDisplayString(sortFor(column)?.description), 9, _hoisted_8)) : column.headerHidden ? (openBlock(), createBlock(_sfc_main$18, { key: 2 }, {
2578
- default: withCtx(() => [createTextVNode(toDisplayString(headerText(column)), 1)]),
2972
+ }, toDisplayString(unref(sortFor)(column)?.description), 9, _hoisted_10)) : createCommentVNode("v-if", true)], 64)) : column.headerHidden ? (openBlock(), createBlock(_sfc_main$19, { key: 1 }, {
2973
+ default: withCtx(() => [createTextVNode(toDisplayString(unref(columnHeaderText)(column)), 1)]),
2579
2974
  _: 2
2580
- }, 1024)) : (openBlock(), createBlock(HeaderContent, {
2975
+ }, 1024)) : (openBlock(), createElementBlock("span", _hoisted_11, [createVNode(HeaderContent, { column }, null, 8, ["column"])])),
2976
+ unref(filterAt)(column, "line") ? (openBlock(), createBlock(_sfc_main$12, {
2581
2977
  key: 3,
2582
- column
2583
- }, null, 8, ["column"])),
2584
- filterAt(column, "line") ? (openBlock(), createBlock(_sfc_main$12, {
2585
- key: 4,
2586
- filter: filterAt(column, "line")
2978
+ filter: unref(filterAt)(column, "line")
2587
2979
  }, null, 8, ["filter"])) : createCommentVNode("v-if", true)
2588
- ]), filterAt(column, "below") ? (openBlock(), createBlock(_sfc_main$12, {
2980
+ ]), unref(filterAt)(column, "below") ? (openBlock(), createBlock(_sfc_main$12, {
2589
2981
  key: 0,
2590
- filter: filterAt(column, "below")
2591
- }, null, 8, ["filter"])) : createCommentVNode("v-if", true)]),
2982
+ filter: unref(filterAt)(column, "below")
2983
+ }, null, 8, ["filter"])) : createCommentVNode("v-if", true)], 8, _hoisted_4),
2592
2984
  createCommentVNode(" eslint-disable-next-line vue-a11y/no-static-element-interactions -- role=\"separator\" 是 WAI-ARIA 的分隔条:自己可聚焦,方向键也归它处理。 "),
2593
- resizeContributions.value.get(column.key)?.hasHandle ? (openBlock(), createElementBlock("span", {
2985
+ unref(resizeContributions).get(column.key)?.hasHandle ? (openBlock(), createElementBlock("span", {
2594
2986
  key: 0,
2987
+ ref_for: true,
2988
+ ref: (element) => unref(resizeAria).observeHandle(column.key, element),
2595
2989
  class: "astryx-table__resize",
2596
2990
  role: "separator",
2597
2991
  "aria-orientation": "vertical",
2598
2992
  "aria-label": unref(resizeLabel)(column),
2599
- "aria-valuenow": resizeContributions.value.get(column.key)?.currentWidth ?? resizeContributions.value.get(column.key)?.minWidth,
2600
- "aria-valuemin": resizeContributions.value.get(column.key)?.minWidth,
2601
- "aria-valuemax": unref(resizeMax)(resizeContributions.value.get(column.key)),
2993
+ "aria-valuenow": unref(resizeAria).ariaValue(column.key, unref(resizeContributions).get(column.key)).now,
2994
+ "aria-valuemin": unref(resizeAria).ariaValue(column.key, unref(resizeContributions).get(column.key)).min,
2995
+ "aria-valuemax": unref(resizeAria).ariaValue(column.key, unref(resizeContributions).get(column.key)).max,
2996
+ "aria-valuetext": unref(resizeAria).ariaValue(column.key, unref(resizeContributions).get(column.key)).text,
2602
2997
  tabindex: "0",
2603
2998
  onPointerdown: ($event) => unref(startResize)($event, column),
2604
2999
  onKeydown: ($event) => unref(onResizeKeydown)($event, column)
2605
- }, null, 40, _hoisted_9)) : createCommentVNode("v-if", true)
2606
- ], 16, _hoisted_2);
2607
- }), 128))]), unref(headerCutText).cutText.value != null ? (openBlock(), createBlock(_sfc_main$17, {
3000
+ }, null, 40, _hoisted_12)) : createCommentVNode("v-if", true)
3001
+ ], 16, _hoisted_3);
3002
+ }), 128))]), unref(headerCutText).cutText.value != null ? (openBlock(), createBlock(_sfc_main$18, {
2608
3003
  key: 0,
2609
3004
  anchor: unref(headerCutText).cell.value,
2610
3005
  text: unref(headerCutText).cutText.value
2611
- }, null, 8, ["anchor", "text"])) : createCommentVNode("v-if", true)], 32), createElementVNode("tbody", null, [__props.rows.length === 0 ? (openBlock(), createElementBlock("tr", _hoisted_10, [createElementVNode("td", {
3006
+ }, null, 8, ["anchor", "text"])) : createCommentVNode("v-if", true)], 32), createElementVNode("tbody", null, [__props.rows.length === 0 && !isLoadingRows.value ? (openBlock(), createElementBlock("tr", _hoisted_13, [createElementVNode("td", {
2612
3007
  class: "astryx-table__empty",
2613
3008
  colspan: columnCount.value
2614
- }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(unref(messages).table.noData), 1)])], 8, _hoisted_11)])) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(entries.value, (entry) => {
3009
+ }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(unref(messages).table.noData), 1)])], 8, _hoisted_14)])) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(entries.value, (entry) => {
2615
3010
  return openBlock(), createElementBlock(Fragment, { key: entry.key }, [createElementVNode("tr", mergeProps({
2616
3011
  ref_for: true,
2617
3012
  ref: entry.ref,
2618
3013
  "aria-selected": !entry.patch.group && isSelected(entry.row) ? "true" : void 0,
2619
3014
  "aria-rowindex": entry.rowIndex,
2620
- class: entry.patch.class
3015
+ class: ["astryx-table-row", entry.patch.class],
3016
+ "data-parity": entry.index % 2 === 0 ? "odd" : "even",
3017
+ "data-striped": __props.isStriped ? "striped" : void 0,
3018
+ "data-selected": !entry.patch.group && isSelected(entry.row) ? "selected" : void 0
2621
3019
  }, { ref_for: true }, entry.patch.attrs, {
2622
3020
  onBlur: ($event) => entry.patch.listeners?.onBlur?.($event),
2623
3021
  onClick: ($event) => entry.patch.onClick?.($event),
@@ -2647,29 +3045,29 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2647
3045
  "collapsed",
2648
3046
  "custom",
2649
3047
  "onToggle"
2650
- ])], 8, _hoisted_13)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [selection.value && !entry.patch.suppressSelection ? (openBlock(), createElementBlock("td", mergeProps({
3048
+ ])], 8, _hoisted_16)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [unref(selection) && !entry.patch.suppressSelection ? (openBlock(), createElementBlock("td", mergeProps({
2651
3049
  key: 0,
2652
- class: ["astryx-table__select", selectCellPatch("body", entry.row).class]
2653
- }, { ref_for: true }, selectCellPatch("body", entry.row).attrs, { style: selectCellPatch("body", entry.row).style }), [selection.value.isSelectable?.(entry.row) !== false ? (openBlock(), createBlock(_sfc_main$20, {
3050
+ class: ["astryx-table__select", unref(selectCellPatch)("body", entry.row).class]
3051
+ }, { ref_for: true }, unref(selectCellPatch)("body", entry.row).attrs, { style: unref(selectCellPatch)("body", entry.row).style }), [unref(selection).isSelectable?.(entry.row) !== false ? (openBlock(), createBlock(_sfc_main$21, {
2654
3052
  key: 0,
2655
- "model-value": selection.value.isSelected(entry.row),
2656
- label: selection.value.rowLabel?.(entry.row) ? unref(messages).table.selectRowNamed(selection.value.rowLabel(entry.row)) : unref(messages).table.selectRow,
3053
+ "model-value": unref(selection).isSelected(entry.row),
3054
+ label: unref(selection).rowLabel?.(entry.row) ? unref(messages).table.selectRowNamed(unref(selection).rowLabel(entry.row)) : unref(messages).table.selectRow,
2657
3055
  "is-label-hidden": "",
2658
3056
  size: "sm",
2659
3057
  "is-disabled": !isEnabled(entry.row),
2660
- "onUpdate:modelValue": (value) => selection.value?.selectRow(entry.row, value === true)
3058
+ "onUpdate:modelValue": (value) => unref(selection)?.selectRow(entry.row, value === true)
2661
3059
  }, null, 8, [
2662
3060
  "model-value",
2663
3061
  "label",
2664
3062
  "is-disabled",
2665
3063
  "onUpdate:modelValue"
2666
- ])) : createCommentVNode("v-if", true)], 16)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(resolvedColumns.value, (column) => {
3064
+ ])) : createCommentVNode("v-if", true)], 16)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(resolvedColumns), (column) => {
2667
3065
  return openBlock(), createElementBlock("td", mergeProps({
2668
3066
  key: column.key,
2669
3067
  "data-column": column.key,
2670
3068
  "data-align": column.align,
2671
- class: mergeCell(column, entry.row, "body").class
2672
- }, { ref_for: true }, mergeCell(column, entry.row, "body").attrs, { style: bodyStyle(column, entry.row) }), [createVNode(unref(CellContent), {
3069
+ class: unref(mergeCell)(column, entry.row, "body").class
3070
+ }, { ref_for: true }, unref(mergeCell)(column, entry.row, "body").attrs, { style: unref(bodyStyle)(column, entry.row) }), [createVNode(unref(CellContent), {
2673
3071
  column,
2674
3072
  row: entry.row,
2675
3073
  index: entry.index
@@ -2677,8 +3075,8 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2677
3075
  "column",
2678
3076
  "row",
2679
3077
  "index"
2680
- ])], 16, _hoisted_14);
2681
- }), 128))], 64))], 16, _hoisted_12), entry.patch.panel ? (openBlock(), createElementBlock("tr", {
3078
+ ])], 16, _hoisted_17);
3079
+ }), 128))], 64))], 16, _hoisted_15), entry.patch.panel ? (openBlock(), createElementBlock("tr", {
2682
3080
  key: 0,
2683
3081
  "data-expansion-panel": "",
2684
3082
  class: "astryx-table__panel-row",
@@ -2686,7 +3084,7 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2686
3084
  }, [createElementVNode("td", {
2687
3085
  class: "astryx-table__panel",
2688
3086
  colspan: columnCount.value
2689
- }, [createVNode(unref(RenderFn), { render: entry.patch.panel.render }, null, 8, ["render"])], 8, _hoisted_16)], 8, _hoisted_15)) : createCommentVNode("v-if", true)], 64);
3087
+ }, [createVNode(unref(RenderFn), { render: entry.patch.panel.render }, null, 8, ["render"])], 8, _hoisted_19)], 8, _hoisted_18)) : createCommentVNode("v-if", true)], 64);
2690
3088
  }), 128))])], 12, _hoisted_1$5),
2691
3089
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.plugins.filter((item) => item.below), (plugin, index) => {
2692
3090
  return openBlock(), createBlock(unref(PluginFooter), {
@@ -2717,6 +3115,24 @@ const _sfc_main$8 = /*@__PURE__*/ defineComponent({
2717
3115
  }
2718
3116
  });
2719
3117
  //#endregion
3118
+ //#region src/Table/tableRowPlacement.ts
3119
+ /** 手写行列的表格告诉它的行:表格有没有开斑马纹。 */
3120
+ const TABLE_STRIPED_KEY = Symbol("AstryxTableStriped");
3121
+ const TABLE_SECTION_KEY = Symbol("AstryxTableSection");
3122
+ /** `TableHeader`、`TableBody`、`TableFooter` 用它告诉里面的行自己在哪个区块。 */
3123
+ function provideTableSection(section) {
3124
+ provide(TABLE_SECTION_KEY, section);
3125
+ }
3126
+ /**
3127
+ * 手写行列的行是否带 `table-row` 主题目标的 `striped` 状态:表格开了斑马纹,且这一行不是表头行。
3128
+ * 行的先后由调用方决定,Core 数不准,所以这里不给 `parity`。
3129
+ */
3130
+ function useTableRowStriped(isHeaderRow) {
3131
+ const isStriped = inject(TABLE_STRIPED_KEY, () => false);
3132
+ const section = inject(TABLE_SECTION_KEY, null);
3133
+ return () => isStriped() && section != null && section !== "header" && !isHeaderRow();
3134
+ }
3135
+ //#endregion
2720
3136
  //#region src/Table/Table.vue
2721
3137
  const _hoisted_1$4 = [
2722
3138
  "data-density",
@@ -2765,6 +3181,8 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
2765
3181
  const plugins = computed(() => Object.values(props.plugins ?? {}).filter((plugin) => plugin != null));
2766
3182
  const dataMode = computed(() => props.data != null);
2767
3183
  const columns = computed(() => props.columns ?? []);
3184
+ provide(TABLE_STRIPED_KEY, () => props.isStriped);
3185
+ provide(TABLE_SECTION_KEY, null);
2768
3186
  return (_ctx, _cache) => {
2769
3187
  return dataMode.value ? (openBlock(), createBlock(_sfc_main$8, {
2770
3188
  key: 0,
@@ -2828,6 +3246,7 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
2828
3246
  name: "AstryxTableBody",
2829
3247
  __name: "TableBody",
2830
3248
  setup(__props) {
3249
+ provideTableSection("body");
2831
3250
  return (_ctx, _cache) => {
2832
3251
  return openBlock(), createElementBlock("tbody", null, [renderSlot(_ctx.$slots, "default")]);
2833
3252
  };
@@ -2867,6 +3286,7 @@ const _sfc_main$4 = /*@__PURE__*/ defineComponent({
2867
3286
  name: "AstryxTableFooter",
2868
3287
  __name: "TableFooter",
2869
3288
  setup(__props) {
3289
+ provideTableSection("footer");
2870
3290
  return (_ctx, _cache) => {
2871
3291
  return openBlock(), createElementBlock("tfoot", null, [renderSlot(_ctx.$slots, "default")]);
2872
3292
  };
@@ -2878,6 +3298,7 @@ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
2878
3298
  name: "AstryxTableHeader",
2879
3299
  __name: "TableHeader",
2880
3300
  setup(__props) {
3301
+ provideTableSection("header");
2881
3302
  return (_ctx, _cache) => {
2882
3303
  return openBlock(), createElementBlock("thead", null, [renderSlot(_ctx.$slots, "default")]);
2883
3304
  };
@@ -2911,7 +3332,7 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
2911
3332
  onFocusout: _cache[1] || (_cache[1] = (...args) => unref(headerCutText).onFocusout && unref(headerCutText).onFocusout(...args)),
2912
3333
  onPointerdown: _cache[2] || (_cache[2] = (...args) => unref(headerCutText).onPointerdown && unref(headerCutText).onPointerdown(...args)),
2913
3334
  onKeydown: _cache[3] || (_cache[3] = (...args) => unref(headerCutText).onKeydown && unref(headerCutText).onKeydown(...args))
2914
- }, [renderSlot(_ctx.$slots, "default"), unref(headerCutText).cutText.value != null ? (openBlock(), createBlock(_sfc_main$17, {
3335
+ }, [renderSlot(_ctx.$slots, "default"), unref(headerCutText).cutText.value != null ? (openBlock(), createBlock(_sfc_main$18, {
2915
3336
  key: 0,
2916
3337
  anchor: unref(headerCutText).cell.value,
2917
3338
  text: unref(headerCutText).cutText.value
@@ -2921,14 +3342,20 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
2921
3342
  });
2922
3343
  //#endregion
2923
3344
  //#region src/Table/TableRow.vue
2924
- const _hoisted_1$1 = ["data-header-row"];
3345
+ const _hoisted_1$1 = ["data-header-row", "data-striped"];
2925
3346
  const _sfc_main$1 = /*@__PURE__*/ defineComponent({
2926
3347
  name: "AstryxTableRow",
2927
3348
  __name: "TableRow",
2928
3349
  props: { isHeaderRow: { type: Boolean } },
2929
3350
  setup(__props) {
3351
+ const props = __props;
3352
+ const isStriped = useTableRowStriped(() => props.isHeaderRow === true);
2930
3353
  return (_ctx, _cache) => {
2931
- return openBlock(), createElementBlock("tr", { "data-header-row": __props.isHeaderRow || void 0 }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$1);
3354
+ return openBlock(), createElementBlock("tr", {
3355
+ class: "astryx-table-row",
3356
+ "data-header-row": __props.isHeaderRow || void 0,
3357
+ "data-striped": unref(isStriped)() ? "striped" : void 0
3358
+ }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$1);
2932
3359
  };
2933
3360
  }
2934
3361
  });
@@ -2963,14 +3390,14 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2963
3390
  emit("clear");
2964
3391
  }
2965
3392
  return (_ctx, _cache) => {
2966
- return isVisible.value ? (openBlock(), createBlock(_sfc_main$29, {
3393
+ return isVisible.value ? (openBlock(), createBlock(_sfc_main$30, {
2967
3394
  key: 0,
2968
3395
  class: "astryx-table-selection-toolbar",
2969
3396
  label: resolvedLabel.value,
2970
3397
  size: __props.size,
2971
3398
  variant: __props.variant
2972
3399
  }, createSlots({
2973
- end: withCtx(() => [createElementVNode("span", _hoisted_1, [renderSlot(_ctx.$slots, "label", { count: effectiveCount.value }, () => [createTextVNode(toDisplayString(resolvedCountLabel.value), 1)])]), createVNode(_sfc_main$16, {
3400
+ end: withCtx(() => [createElementVNode("span", _hoisted_1, [renderSlot(_ctx.$slots, "label", { count: effectiveCount.value }, () => [createTextVNode(toDisplayString(resolvedCountLabel.value), 1)])]), createVNode(_sfc_main$17, {
2974
3401
  class: "astryx-table-selection-toolbar__clear",
2975
3402
  label: resolvedClearLabel.value,
2976
3403
  size: __props.size,
@@ -2991,4 +3418,4 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2991
3418
  }
2992
3419
  });
2993
3420
  //#endregion
2994
- export { useTableColumnSettings as A, generateColumns as B, isInteractiveRowClick as C, applyTableFilters as D, useTableGroupedRows as E, isProportionalColumnWidth as F, resolveColumnWidths as G, pixel as H, resizeColumnWidths as I, sortRows as K, useTableColumnResize as L, columnResizeDirectionSign as M, columnResizeMinWidth as N, useTableFilterState as O, columnResizeStep as P, capitalize as R, useTablePagination as S, isTableGroupHeader as T, proportional as U, paginateData as V, resolveColumnFloorWidths as W, useTableSelection as _, _sfc_main$4 as a, useTableRowIndex as b, _sfc_main$7 as c, useTableTreeState as d, resolveStickySide as f, useTableSortableState as g, useTableSortable as h, _sfc_main$3 as i, useTableColumnSettingsState as j, useTableFiltering as k, flattenTree as l, useTableStickyColumns as m, _sfc_main$1 as n, _sfc_main$5 as o, stickyOffsets as p, _sfc_main$2 as r, _sfc_main$6 as s, _sfc_main as t, useTableTreeData as u, useTableSelectionState as v, buildGroupedRows as w, useTableRowExpansion as x, useTableRowStatus as y, cellText as z };
3421
+ export { useTableFiltering as A, cellText as B, isInteractiveRowClick as C, useTableGroupedRows as D, isTableGroupHeader as E, columnResizeStep as F, resolveColumnFloorWidths as G, paginateData as H, isProportionalColumnWidth as I, resolveColumnWidths as K, resizeColumnWidths as L, useTableColumnSettingsState as M, columnResizeDirectionSign as N, applyTableFilters as O, columnResizeMinWidth as P, useTableColumnResize as R, useTablePagination as S, buildGroupedRows as T, pixel as U, generateColumns as V, proportional as W, useTableSelection as _, _sfc_main$4 as a, useTableRowIndex as b, _sfc_main$7 as c, useTableTreeState as d, resolveStickySide as f, useTableSortableState as g, useTableSortable as h, _sfc_main$3 as i, useTableColumnSettings as j, useTableFilterState as k, flattenTree as l, useTableStickyColumns as m, _sfc_main$1 as n, _sfc_main$5 as o, stickyOffsets as p, sortRows as q, _sfc_main$2 as r, _sfc_main$6 as s, _sfc_main as t, useTableTreeData as u, useTableSelectionState as v, useTableInfiniteScroll as w, useTableRowExpansion as x, useTableRowStatus as y, capitalize as z };