@atscript/vue-table 0.1.132 → 0.1.134

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 (163) hide show
  1. package/dist/as-action-form-dialog.cjs +42 -30
  2. package/dist/as-action-form-dialog.mjs +42 -30
  3. package/dist/{as-action-menu-content-C5qx9MPE.cjs → as-action-menu-content-C_D_Fepo.cjs} +1 -1
  4. package/dist/{as-action-menu-content-4UfcabUe.mjs → as-action-menu-content-rim8hAO9.mjs} +1 -1
  5. package/dist/{as-cell-array-2qmJ1lT2.mjs → as-cell-array-BWHkJX3I.mjs} +2 -2
  6. package/dist/{as-cell-array-iPeUnk2G.cjs → as-cell-array-D-8Pqlgo.cjs} +2 -2
  7. package/dist/as-cell-array.cjs +1 -1
  8. package/dist/as-cell-array.mjs +1 -1
  9. package/dist/{as-cell-date-DyixWKuS.cjs → as-cell-date-DviMJEqs.cjs} +2 -2
  10. package/dist/{as-cell-date-BwFgi6O0.mjs → as-cell-date-mGlnDeLP.mjs} +2 -2
  11. package/dist/as-cell-date.cjs +1 -1
  12. package/dist/as-cell-date.mjs +1 -1
  13. package/dist/{as-cell-json--95Xq6yq.mjs → as-cell-json-2I081xnO.mjs} +2 -2
  14. package/dist/{as-cell-json-Bvv2P7YV.cjs → as-cell-json-CaVB6e7V.cjs} +2 -2
  15. package/dist/as-cell-json.cjs +1 -1
  16. package/dist/as-cell-json.mjs +1 -1
  17. package/dist/{as-cell-number-DuPMOesI.cjs → as-cell-number-BnYbxOiG.cjs} +2 -2
  18. package/dist/{as-cell-number-DKRaS9pM.mjs → as-cell-number-CP2AZI9g.mjs} +2 -2
  19. package/dist/as-cell-number.cjs +1 -1
  20. package/dist/as-cell-number.mjs +1 -1
  21. package/dist/{as-cell-union-DJNsEKTi.cjs → as-cell-union-BjMP91PS.cjs} +3 -3
  22. package/dist/{as-cell-union-C9FukGqF.mjs → as-cell-union-NHpDCXty.mjs} +3 -3
  23. package/dist/as-cell-union.cjs +1 -1
  24. package/dist/as-cell-union.mjs +1 -1
  25. package/dist/as-column-menu.cjs +1 -1
  26. package/dist/as-column-menu.d.cts +1 -1
  27. package/dist/as-column-menu.d.mts +1 -1
  28. package/dist/as-column-menu.mjs +1 -1
  29. package/dist/{as-column-menu.vue-u_DNy3f-.d.cts → as-column-menu.vue-De7SRhj6.d.cts} +1 -1
  30. package/dist/{as-column-menu.vue-DL5N9mKR.d.mts → as-column-menu.vue-Dg0H1dOd.d.mts} +1 -1
  31. package/dist/{as-config-dialog-BehfqIGd.mjs → as-config-dialog-BUBHiVlf.mjs} +56 -35
  32. package/dist/{as-config-dialog-BOYWPYYH.cjs → as-config-dialog-DvBptYMS.cjs} +55 -34
  33. package/dist/as-config-dialog.cjs +1 -1
  34. package/dist/as-config-dialog.mjs +1 -1
  35. package/dist/{as-confirm-dialog-UwhDHysk.cjs → as-confirm-dialog-ByMfIG0A.cjs} +12 -9
  36. package/dist/{as-confirm-dialog-bpN4A-KN.mjs → as-confirm-dialog-G4ZoL_Xo.mjs} +12 -9
  37. package/dist/as-confirm-dialog.cjs +1 -1
  38. package/dist/as-confirm-dialog.mjs +1 -1
  39. package/dist/{as-filter-dialog-D1qzq-8b.mjs → as-filter-dialog-BJWH8cvc.mjs} +34 -26
  40. package/dist/{as-filter-dialog-Dh2Ylthb.cjs → as-filter-dialog-C2oyT0yt.cjs} +33 -25
  41. package/dist/as-filter-dialog.cjs +1 -1
  42. package/dist/as-filter-dialog.mjs +1 -1
  43. package/dist/{as-filter-field-DirBmnbb.mjs → as-filter-field-B2skq4K0.mjs} +4 -4
  44. package/dist/{as-filter-field-DRsDJdpx.cjs → as-filter-field-DxGfasQj.cjs} +4 -4
  45. package/dist/as-filter-field.cjs +1 -1
  46. package/dist/as-filter-field.mjs +1 -1
  47. package/dist/as-filter-input.cjs +1 -1
  48. package/dist/as-filter-input.mjs +1 -1
  49. package/dist/as-filters-Bhte22La.cjs +130 -0
  50. package/dist/as-filters-DogNVlqr.mjs +125 -0
  51. package/dist/as-filters.cjs +1 -1
  52. package/dist/as-filters.d.cts +1 -1
  53. package/dist/as-filters.d.mts +1 -1
  54. package/dist/as-filters.mjs +1 -1
  55. package/dist/as-filters.vue-BG_ysCkC.d.mts +65 -0
  56. package/dist/as-filters.vue-DcxDnWAU.d.cts +65 -0
  57. package/dist/{as-preset-dialog-CDqCAR7N.mjs → as-preset-dialog-BwHV6Y77.mjs} +71 -21
  58. package/dist/{as-preset-dialog-DpM06jqR.cjs → as-preset-dialog-D2a6nxEX.cjs} +75 -25
  59. package/dist/as-preset-dialog.cjs +1 -1
  60. package/dist/as-preset-dialog.mjs +1 -1
  61. package/dist/{as-preset-picker-CISaxEZ0.mjs → as-preset-picker-B0JnyAPA.mjs} +39 -15
  62. package/dist/{as-preset-picker-jUS_YDX8.cjs → as-preset-picker-DbkmapBx.cjs} +45 -21
  63. package/dist/as-preset-picker.cjs +1 -1
  64. package/dist/as-preset-picker.mjs +1 -1
  65. package/dist/{as-row-actions-xqJeAdQl.mjs → as-row-actions-BkIsJVBm.mjs} +24 -11
  66. package/dist/{as-row-actions-Bm6Bzyno.cjs → as-row-actions-CRg8LHGk.cjs} +24 -11
  67. package/dist/as-row-actions.cjs +1 -1
  68. package/dist/as-row-actions.d.cts +1 -1
  69. package/dist/as-row-actions.d.mts +1 -1
  70. package/dist/as-row-actions.mjs +1 -1
  71. package/dist/{as-row-actions.vue-Bvcc2tUN.d.cts → as-row-actions.vue-VpJsBAJ4.d.mts} +8 -0
  72. package/dist/{as-row-actions.vue-DUSDuoR2.d.mts → as-row-actions.vue-dn_DKcMm.d.cts} +8 -0
  73. package/dist/{as-table-CDSG2yED.mjs → as-table-BEvsX87E.mjs} +26 -8
  74. package/dist/{as-table-actions-DMxeaczm.mjs → as-table-actions-B5upF1bQ.mjs} +69 -18
  75. package/dist/{as-table-actions-gV4lqqxc.cjs → as-table-actions-B6sKd4sl.cjs} +68 -17
  76. package/dist/as-table-actions.cjs +1 -1
  77. package/dist/as-table-actions.d.cts +1 -1
  78. package/dist/as-table-actions.d.mts +1 -1
  79. package/dist/as-table-actions.mjs +1 -1
  80. package/dist/{as-table-actions.vue-B-cgiCXP.d.cts → as-table-actions.vue-CoxhpIlJ.d.mts} +2 -2
  81. package/dist/{as-table-actions.vue-ClMa0OD1.d.mts → as-table-actions.vue-Kic8m28V.d.cts} +2 -2
  82. package/dist/{as-table-base-BaTE3VSN.mjs → as-table-base-BxKBdIdS.mjs} +142 -47
  83. package/dist/{as-table-base-RG2TEIgV.cjs → as-table-base-DLuhKz69.cjs} +142 -47
  84. package/dist/{as-table-cell-value-D1JkTQt0.cjs → as-table-cell-value-BAi5yadc.cjs} +2 -2
  85. package/dist/{as-table-cell-value-CPcFxSOj.mjs → as-table-cell-value-BVcfhhCb.mjs} +2 -2
  86. package/dist/as-table-cell-value.cjs +1 -1
  87. package/dist/as-table-cell-value.mjs +1 -1
  88. package/dist/{as-table-header-cell-CIqlO6Lw.cjs → as-table-header-cell-Bv6q5iKA.cjs} +2 -2
  89. package/dist/{as-table-header-cell-Bdhl5Lox.mjs → as-table-header-cell-Xd3cvnII.mjs} +2 -2
  90. package/dist/as-table-header-cell.cjs +1 -1
  91. package/dist/as-table-header-cell.d.cts +1 -1
  92. package/dist/as-table-header-cell.d.mts +1 -1
  93. package/dist/as-table-header-cell.mjs +1 -1
  94. package/dist/{as-table-header-cell.vue-BCszzxtU.d.mts → as-table-header-cell.vue-AS6u4e6v.d.cts} +2 -2
  95. package/dist/{as-table-header-cell.vue-BzTzfGRo.d.cts → as-table-header-cell.vue-zKOmlzhT.d.mts} +2 -2
  96. package/dist/{as-table-root-BLReUbRH.mjs → as-table-root-C1A6JkwL.mjs} +112 -10
  97. package/dist/{as-table-root-DLJ_3Jf4.cjs → as-table-root-DlYjnZax.cjs} +112 -10
  98. package/dist/as-table-root.cjs +1 -1
  99. package/dist/as-table-root.d.cts +1 -1
  100. package/dist/as-table-root.d.mts +1 -1
  101. package/dist/as-table-root.mjs +1 -1
  102. package/dist/{as-table-root.vue-QMT93qPk.d.mts → as-table-root.vue-CWk9YgpG.d.mts} +257 -41
  103. package/dist/{as-table-root.vue-D0T3n-Vm.d.cts → as-table-root.vue-D94eypcL.d.cts} +258 -42
  104. package/dist/{as-table-status-Du4WLF4k.cjs → as-table-status-B2HPerJT.cjs} +54 -38
  105. package/dist/{as-table-status-DGTZlpyq.mjs → as-table-status-QzlBdSiR.mjs} +54 -38
  106. package/dist/{as-table-BWUPzjRn.cjs → as-table-vJbZyZVx.cjs} +26 -8
  107. package/dist/as-table.cjs +1 -1
  108. package/dist/as-table.d.cts +1 -1
  109. package/dist/as-table.d.mts +1 -1
  110. package/dist/as-table.mjs +1 -1
  111. package/dist/{as-table.vue-Ds7MEp37.d.cts → as-table.vue-BB1vaNL6.d.cts} +28 -4
  112. package/dist/{as-table.vue-Ce5606ZO.d.mts → as-table.vue-BUDFTCpo.d.mts} +28 -4
  113. package/dist/{as-window-table-DWujiUQy.mjs → as-window-table-BH0tDDnr.mjs} +107 -24
  114. package/dist/{as-window-table-jD_y9yet.cjs → as-window-table-Bl_q72WL.cjs} +107 -24
  115. package/dist/as-window-table.cjs +1 -1
  116. package/dist/as-window-table.d.cts +1 -1
  117. package/dist/as-window-table.d.mts +1 -1
  118. package/dist/as-window-table.mjs +1 -1
  119. package/dist/{as-window-table.vue-DfZF1Mux.d.mts → as-window-table.vue-Be2IA0Eb.d.cts} +27 -4
  120. package/dist/{as-window-table.vue-Bhf9BK8E.d.cts → as-window-table.vue-CLqFM2ff.d.mts} +27 -4
  121. package/dist/error-message-CfKpn_5w.cjs +18 -0
  122. package/dist/error-message-gNEXnnbb.mjs +13 -0
  123. package/dist/index.cjs +237 -41
  124. package/dist/index.d.cts +10 -10
  125. package/dist/index.d.mts +10 -10
  126. package/dist/index.mjs +230 -43
  127. package/dist/{types-ByU4O0Yf.d.mts → types--ex8BJIO.d.cts} +263 -5
  128. package/dist/{types-CTMxE_zA.d.cts → types-CBGaTR2Z.d.mts} +263 -5
  129. package/dist/{use-table-CyFcVtUN.mjs → use-table-BFhbfWgY.mjs} +48 -23
  130. package/dist/{use-table-component-K6xj1obF.mjs → use-table-component-CRmLHdqi.mjs} +1 -1
  131. package/dist/{use-table-component-DO_kvKSf.cjs → use-table-component-DS5NJPzs.cjs} +1 -1
  132. package/dist/{use-table-nav-bridge-uOQUDooh.cjs → use-table-nav-bridge-DS14D_rG.cjs} +1 -1
  133. package/dist/{use-table-nav-bridge-DeGeaQX-.mjs → use-table-nav-bridge-DzJN5v9a.mjs} +1 -1
  134. package/dist/{use-table-nvBq1dZ4.cjs → use-table-nvuZdgUd.cjs} +51 -20
  135. package/dist/{use-table-state-BxX3SpeW.mjs → use-table-state-mBXx11aH.mjs} +501 -105
  136. package/dist/{use-table-state-Oi2ds4_a.cjs → use-table-state-mhm-YWnu.cjs} +541 -109
  137. package/package.json +9 -9
  138. package/dist/as-filters-DCZTHjf5.cjs +0 -51
  139. package/dist/as-filters-beIud9sF.mjs +0 -46
  140. package/dist/as-filters.vue-DmECMd1v.d.mts +0 -10
  141. package/dist/as-filters.vue-fv-tRL2H.d.cts +0 -10
  142. package/dist/preset-aspect-display-IICxAlVo.mjs +0 -43
  143. package/dist/preset-aspect-display-TWwf6j1B.cjs +0 -72
  144. /package/dist/{as-cell-json-popover-Dkdv5Y9E.mjs → as-cell-json-popover-CH5bAcLE.mjs} +0 -0
  145. /package/dist/{as-cell-json-popover-BM2QLgfk.cjs → as-cell-json-popover-vty5vMjW.cjs} +0 -0
  146. /package/dist/{as-column-menu-kTIQfLTi.mjs → as-column-menu-BMTS3DO2.mjs} +0 -0
  147. /package/dist/{as-column-menu-fZVbJ9lU.cjs → as-column-menu-D_8NxujZ.cjs} +0 -0
  148. /package/dist/{as-filter-input-BM23TNeh.mjs → as-filter-input-C8KmOus8.mjs} +0 -0
  149. /package/dist/{as-filter-input-DJu2k9gO.cjs → as-filter-input-DUqpkTkg.cjs} +0 -0
  150. /package/dist/{format-cell-D1Ziv96Q.mjs → format-cell-Bx7wNc4X.mjs} +0 -0
  151. /package/dist/{format-cell-vCNTh4WZ.cjs → format-cell-DaxV6WIJ.cjs} +0 -0
  152. /package/dist/{get-cell-value-4rHKP-TG.cjs → get-cell-value-CJT4fk4y.cjs} +0 -0
  153. /package/dist/{get-cell-value-C8LLc_Rr.mjs → get-cell-value-Cb3X8nUn.mjs} +0 -0
  154. /package/dist/{use-cell-locale-MQXoONh5.mjs → use-cell-locale-CxQOQsns.mjs} +0 -0
  155. /package/dist/{use-cell-locale-BGBRQB7s.cjs → use-cell-locale-caG2Fzpc.cjs} +0 -0
  156. /package/dist/{use-has-emit-listener-hhOH8CBI.cjs → use-has-emit-listener-BaGFZDyM.cjs} +0 -0
  157. /package/dist/{use-has-emit-listener-BTMDIv2e.mjs → use-has-emit-listener-DrBbsLHQ.mjs} +0 -0
  158. /package/dist/{use-seed-on-open-Dg9I89fU.cjs → use-seed-on-open-9TSm1Vbv.cjs} +0 -0
  159. /package/dist/{use-seed-on-open-DO3A1kIb.mjs → use-seed-on-open-DSh4XFyp.mjs} +0 -0
  160. /package/dist/{use-table-column-handlers-ehreEzcx.cjs → use-table-column-handlers-BMrP0WY2.cjs} +0 -0
  161. /package/dist/{use-table-column-handlers-CpiiIniD.mjs → use-table-column-handlers-Bx3JERqs.mjs} +0 -0
  162. /package/dist/{use-table-selection-Cmiu1h4S.cjs → use-table-selection-DtCV3rhu.cjs} +0 -0
  163. /package/dist/{use-table-selection-C84z4OZy.mjs → use-table-selection-ULbKT2xW.mjs} +0 -0
package/dist/index.mjs CHANGED
@@ -1,36 +1,191 @@
1
- import { a as useTableContext, m as extractIdentifier, n as createTableState, o as useTableContextOptional, t as createStaticTableState, x as ROW_ACTIONS_TYPE } from "./use-table-state-BxX3SpeW.mjs";
2
- import { n as useTableSelection } from "./use-table-selection-C84z4OZy.mjs";
3
- import { a as AS_PRESETS_APP, i as useLocalDraft, n as useTable, o as injectPresetsApp, r as usePresets, t as clearTableCache } from "./use-table-CyFcVtUN.mjs";
4
- import { t as useTableNavBridge } from "./use-table-nav-bridge-DeGeaQX-.mjs";
5
- import { t as useTableComponent } from "./use-table-component-K6xj1obF.mjs";
6
- import { t as getCellValue } from "./get-cell-value-C8LLc_Rr.mjs";
7
- import { t as as_cell_array_default } from "./as-cell-array-2qmJ1lT2.mjs";
8
- import { t as as_cell_date_default } from "./as-cell-date-BwFgi6O0.mjs";
9
- import { n as useCellLocale, t as provideCellLocale } from "./use-cell-locale-MQXoONh5.mjs";
10
- import { t as as_cell_json_default } from "./as-cell-json--95Xq6yq.mjs";
11
- import { t as as_cell_number_default } from "./as-cell-number-DKRaS9pM.mjs";
12
- import { t as formatCellValue } from "./format-cell-D1Ziv96Q.mjs";
13
- import { t as as_cell_union_default } from "./as-cell-union-C9FukGqF.mjs";
14
- import { t as as_column_menu_default } from "./as-column-menu-kTIQfLTi.mjs";
15
- import { t as as_config_dialog_default } from "./as-config-dialog-BehfqIGd.mjs";
16
- import { t as as_confirm_dialog_default } from "./as-confirm-dialog-bpN4A-KN.mjs";
17
- import { t as as_filter_input_default } from "./as-filter-input-BM23TNeh.mjs";
18
- import { t as as_filter_dialog_default } from "./as-filter-dialog-D1qzq-8b.mjs";
19
- import { t as as_table_header_cell_default } from "./as-table-header-cell-Bdhl5Lox.mjs";
20
- import { t as as_window_table_default } from "./as-window-table-DWujiUQy.mjs";
21
- import { t as as_filter_field_default } from "./as-filter-field-DirBmnbb.mjs";
22
- import { t as as_filters_default } from "./as-filters-beIud9sF.mjs";
23
- import { t as as_preset_dialog_default } from "./as-preset-dialog-CDqCAR7N.mjs";
24
- import { t as as_row_actions_default } from "./as-row-actions-xqJeAdQl.mjs";
25
- import { t as as_table_cell_value_default } from "./as-table-cell-value-CPcFxSOj.mjs";
26
- import { t as as_table_root_default } from "./as-table-root-BLReUbRH.mjs";
27
- import { t as as_table_default } from "./as-table-CDSG2yED.mjs";
28
- import { t as as_table_actions_default } from "./as-table-actions-DMxeaczm.mjs";
29
- import { t as as_preset_picker_default } from "./as-preset-picker-CISaxEZ0.mjs";
1
+ import { D as ROW_ACTIONS_TYPE, a as useTableContext, b as extractIdentifier, n as createTableState, o as useTableContextOptional, r as provideTableContext, t as createStaticTableState } from "./use-table-state-mBXx11aH.mjs";
2
+ import { t as getCellValue } from "./get-cell-value-Cb3X8nUn.mjs";
3
+ import { n as useTableSelection } from "./use-table-selection-ULbKT2xW.mjs";
4
+ import { a as useLocalDraft, i as usePresets, o as AS_PRESETS_APP, r as useTable, s as injectPresetsApp, t as clearTableCache } from "./use-table-BFhbfWgY.mjs";
5
+ import { t as useTableNavBridge } from "./use-table-nav-bridge-DzJN5v9a.mjs";
6
+ import { t as useTableComponent } from "./use-table-component-CRmLHdqi.mjs";
7
+ import { t as as_table_root_default } from "./as-table-root-C1A6JkwL.mjs";
8
+ import { t as as_cell_array_default } from "./as-cell-array-BWHkJX3I.mjs";
9
+ import { t as as_cell_date_default } from "./as-cell-date-mGlnDeLP.mjs";
10
+ import { n as useCellLocale, t as provideCellLocale } from "./use-cell-locale-CxQOQsns.mjs";
11
+ import { t as as_cell_json_default } from "./as-cell-json-2I081xnO.mjs";
12
+ import { t as as_cell_number_default } from "./as-cell-number-CP2AZI9g.mjs";
13
+ import { t as formatCellValue } from "./format-cell-Bx7wNc4X.mjs";
14
+ import { t as as_cell_union_default } from "./as-cell-union-NHpDCXty.mjs";
15
+ import { t as as_column_menu_default } from "./as-column-menu-BMTS3DO2.mjs";
16
+ import { t as as_config_dialog_default } from "./as-config-dialog-BUBHiVlf.mjs";
17
+ import { t as as_confirm_dialog_default } from "./as-confirm-dialog-G4ZoL_Xo.mjs";
18
+ import { t as as_filter_input_default } from "./as-filter-input-C8KmOus8.mjs";
19
+ import { t as as_filter_dialog_default } from "./as-filter-dialog-BJWH8cvc.mjs";
20
+ import { t as as_table_header_cell_default } from "./as-table-header-cell-Xd3cvnII.mjs";
21
+ import { t as as_window_table_default } from "./as-window-table-BH0tDDnr.mjs";
22
+ import { t as as_filter_field_default } from "./as-filter-field-B2skq4K0.mjs";
23
+ import { t as as_filters_default } from "./as-filters-DogNVlqr.mjs";
24
+ import { t as as_preset_dialog_default } from "./as-preset-dialog-BwHV6Y77.mjs";
25
+ import { t as as_row_actions_default } from "./as-row-actions-BkIsJVBm.mjs";
26
+ import { t as as_table_cell_value_default } from "./as-table-cell-value-BVcfhhCb.mjs";
27
+ import { t as as_table_default } from "./as-table-BEvsX87E.mjs";
28
+ import { t as as_table_actions_default } from "./as-table-actions-B5upF1bQ.mjs";
29
+ import { t as as_preset_picker_default } from "./as-preset-picker-B0JnyAPA.mjs";
30
30
  import { getDefaultClientFactory, resetDefaultClientFactory, setDefaultClientFactory } from "@atscript/ui";
31
31
  import { computed, effectScope, ref, shallowRef } from "vue";
32
- import { AppPrefsClient, PRESET_ASPECTS, STANDARD_PRESET_ID, SYSTEM_PRESET_PREFIX, columnFilterType, conditionsForType, defaultCondition, isAuthError, isFilled, isSystemPresetId, resolveSystemPresets } from "@atscript/ui-table";
32
+ import { AppPrefsClient, ExportAbortError, PRESET_ASPECTS, STANDARD_PRESET_ID, SYSTEM_PRESET_PREFIX, collectExportRows, columnFilterType, conditionsForType, defaultCondition, isFilled, isSystemPresetId, isUnavailableError, resolveExportValue, resolveSystemPresets, toCsv, urlQueryConsumesKey, withStableOrder } from "@atscript/ui-table";
33
33
  import { StorageSerializers, useEventBus, useStorage } from "@vueuse/core";
34
+ //#region src/composables/use-table-export.ts
35
+ /**
36
+ * Export the table's data as it is queried right now.
37
+ *
38
+ * The export snapshots the table's own query at call time — the same filters,
39
+ * sorters, search term, force-filters and `$select` projection the on-screen
40
+ * fetch uses (`state.buildQuery()`), through the same fetch path
41
+ * (`state.fetchPage()`, so a custom `queryFn` is honoured) — then pages
42
+ * through every result instead of one page. The primary key(s) are appended
43
+ * to the sort as a tiebreaker so pages never overlap or skip.
44
+ *
45
+ * Values come out of the same column metadata the cells read: union/enum keys
46
+ * become their labels, dates become ISO strings, arrays join. Override per
47
+ * column with `formatters`, or globally with `formatCell`.
48
+ *
49
+ * ```ts
50
+ * const { exportRows } = useTableExport()
51
+ * downloadExport(await exportRows({ filename: "orders.csv", csv: { bom: true } }))
52
+ * ```
53
+ *
54
+ * Since 0.1.134.
55
+ */
56
+ function useTableExport(ctx) {
57
+ const state = (ctx ?? useTableContext()).state;
58
+ const progress = ref(null);
59
+ const exporting = computed(() => progress.value !== null);
60
+ function resolveColumns(selection, opts) {
61
+ if (selection && selection !== "visible") {
62
+ const byPath = new Map(state.allColumns.value.map((c) => [c.path, c]));
63
+ return selection.map((path) => byPath.get(path) ?? rawColumn(path));
64
+ }
65
+ const local = state.localColumnPaths.value;
66
+ const visible = state.columns.value;
67
+ if (local.size === 0) return visible;
68
+ return visible.filter((c) => !local.has(c.path) || opts.formatters?.[c.path]);
69
+ }
70
+ /**
71
+ * One value resolver per column, built once per run: the formatter lookup
72
+ * and the union-option index happen here instead of per cell.
73
+ */
74
+ function resolversFor(columns, opts) {
75
+ return columns.map((column) => {
76
+ const perColumn = opts.formatters?.[column.path];
77
+ const formatCell = opts.formatCell;
78
+ const labels = column.options?.length ? new Map(column.options.map((o) => [o.key, o.label])) : null;
79
+ return (row) => {
80
+ const raw = getCellValue(row, column.path);
81
+ if (perColumn) {
82
+ const out = perColumn(raw, column, row);
83
+ if (out !== void 0) return out;
84
+ }
85
+ if (formatCell) {
86
+ const out = formatCell(raw, column, row);
87
+ if (out !== void 0) return out;
88
+ }
89
+ if (labels !== null && (typeof raw === "string" || typeof raw === "number")) {
90
+ const hit = labels.get(String(raw));
91
+ if (hit !== void 0) return hit;
92
+ }
93
+ return resolveExportValue(raw);
94
+ };
95
+ });
96
+ }
97
+ async function exportRows(opts = {}) {
98
+ if (progress.value !== null) throw new Error("[vue-table] exportRows() is already running on this handle.");
99
+ const columns = resolveColumns(opts.columns, opts);
100
+ const columnPaths = columns.map((c) => c.path);
101
+ const query = withStableOrder(state.buildQuery({
102
+ columnPaths,
103
+ includeActions: false
104
+ }), state.tableDef.value?.primaryKeys ?? []);
105
+ const resolvers = resolversFor(columns, opts);
106
+ progress.value = { done: 0 };
107
+ try {
108
+ const { rows: matrix, total } = await collectExportRows({
109
+ query,
110
+ pageSize: opts.pageSize,
111
+ maxRows: opts.maxRows,
112
+ signal: opts.signal,
113
+ fetchPage: state.fetchPage,
114
+ mapRow: (row) => resolvers.map((resolve) => resolve(row)),
115
+ onProgress: (done, reported) => {
116
+ progress.value = {
117
+ done,
118
+ total: reported
119
+ };
120
+ opts.onProgress?.(done, reported);
121
+ }
122
+ });
123
+ const header = columns.map((c) => c.label || c.path);
124
+ const base = {
125
+ columns: header,
126
+ columnPaths,
127
+ rowCount: matrix.length,
128
+ total
129
+ };
130
+ if (opts.format === "rows") return {
131
+ ...base,
132
+ format: "rows",
133
+ rows: matrix
134
+ };
135
+ return {
136
+ ...base,
137
+ format: "csv",
138
+ filename: withCsvSuffix(opts.filename ?? "export.csv"),
139
+ csv: toCsv(header, matrix, opts.csv)
140
+ };
141
+ } finally {
142
+ progress.value = null;
143
+ }
144
+ }
145
+ return {
146
+ exportRows,
147
+ exporting,
148
+ progress
149
+ };
150
+ }
151
+ /**
152
+ * Hand a finished CSV export to the browser as a file download. Returns
153
+ * `false` without doing anything when there is no DOM (SSR / a worker), so a
154
+ * server render can call it unguarded.
155
+ *
156
+ * Since 0.1.134.
157
+ */
158
+ function downloadExport(result) {
159
+ if (result.format !== "csv") throw new Error("[vue-table] downloadExport() needs a `format: 'csv'` export result.");
160
+ if (typeof document === "undefined" || typeof URL?.createObjectURL !== "function") return false;
161
+ const blob = new Blob([result.csv], { type: "text/csv;charset=utf-8" });
162
+ const href = URL.createObjectURL(blob);
163
+ const anchor = document.createElement("a");
164
+ anchor.href = href;
165
+ anchor.download = result.filename;
166
+ anchor.style.display = "none";
167
+ document.body.appendChild(anchor);
168
+ anchor.click();
169
+ anchor.remove();
170
+ URL.revokeObjectURL(href);
171
+ return true;
172
+ }
173
+ function withCsvSuffix(name) {
174
+ return name.toLowerCase().endsWith(".csv") ? name : `${name}.csv`;
175
+ }
176
+ /** Minimal column for an export path that is not one of the table's columns. */
177
+ function rawColumn(path) {
178
+ return {
179
+ path,
180
+ label: path,
181
+ type: "text",
182
+ sortable: false,
183
+ filterable: false,
184
+ nullable: true,
185
+ order: 0
186
+ };
187
+ }
188
+ //#endregion
34
189
  //#region src/composables/use-table-filter.ts
35
190
  /**
36
191
  * Per-field filter state composable.
@@ -187,11 +342,19 @@ function findCleanEq(segment) {
187
342
  * dependency on `vue-router` is added to `@atscript/vue-table`. Consumers
188
343
  * pass in their already-resolved `useRoute()` and `useRouter()` instances.
189
344
  *
190
- * Scope: **owns the whole query string**. The getter returns the entire
191
- * `route.query` serialized; the setter replaces `route.query` wholesale.
192
- * Apps that need the table to coexist with non-table query params should
193
- * write their own `computed` instead — that pattern is small and keeps the
194
- * library's contract crisp.
345
+ * Scope: the bridge owns **only what the table reads back** (since 0.1.133).
346
+ * A key is the table's iff `urlQueryStringToState` would consume it — see
347
+ * `urlQueryConsumesKey` — or the bridge has written it before. Read and
348
+ * write therefore agree in both directions: a key the parser ignores (a host
349
+ * flag, an unrecognised `$control`) is never removed, and a key the parser
350
+ * reads is the bridge's to remove. Every write merges into the current
351
+ * `route.query`, in place.
352
+ *
353
+ * Without a `prefix` the bridge cannot tell a plain `field=value` filter from
354
+ * a page-owned flag of the same shape, so a plain key that was already in the
355
+ * URL when the bridge mounted counts as foreign until the bridge writes it
356
+ * itself. Pass `prefix` when a route carries a host key that could collide
357
+ * with a column path, or when it carries two tables.
195
358
  *
196
359
  * @example
197
360
  * ```vue
@@ -199,6 +362,9 @@ function findCleanEq(segment) {
199
362
  * import { useRoute, useRouter } from 'vue-router';
200
363
  * import { useTableUrlQuery } from '@atscript/vue-table';
201
364
  * const urlQuery = useTableUrlQuery(useRoute(), useRouter());
365
+ * // Two tables on one route:
366
+ * // const left = useTableUrlQuery(useRoute(), useRouter(), { prefix: 'a' });
367
+ * // const right = useTableUrlQuery(useRoute(), useRouter(), { prefix: 'b' });
202
368
  * <\/script>
203
369
  * <template>
204
370
  * <AsTableRoot v-model:url-query="urlQuery" url="/db/products" .../>
@@ -207,25 +373,46 @@ function findCleanEq(segment) {
207
373
  */
208
374
  function useTableUrlQuery(route, router, opts = {}) {
209
375
  const navigate = (opts.mode ?? "replace") === "push" ? router.push.bind(router) : router.replace.bind(router);
376
+ const prefix = opts.prefix ? `${opts.prefix}.` : "";
377
+ const written = /* @__PURE__ */ new Set();
378
+ function isOwn(key) {
379
+ if (prefix) return key.startsWith(prefix);
380
+ return written.has(key) || urlQueryConsumesKey(key);
381
+ }
210
382
  return computed({
211
383
  get: () => {
212
384
  const q = route.query;
213
385
  const parts = [];
214
386
  for (const key in q) {
387
+ if (prefix && !key.startsWith(prefix)) continue;
388
+ const own = prefix ? key.slice(prefix.length) : key;
215
389
  const v = q[key];
216
- if (Array.isArray(v)) for (const item of v) parts.push(item == null ? key : `${key}=${item}`);
217
- else if (v == null) parts.push(key);
218
- else parts.push(`${key}=${v}`);
390
+ if (Array.isArray(v)) for (const item of v) parts.push(item == null ? own : `${own}=${item}`);
391
+ else if (v == null) parts.push(own);
392
+ else parts.push(`${own}=${v}`);
219
393
  }
220
394
  return parts.join("&");
221
395
  },
222
396
  set: (urlString) => {
223
- const query = {};
397
+ const serialized = /* @__PURE__ */ new Map();
224
398
  for (const segment of splitSegments(urlString)) {
225
399
  const eqIdx = findCleanEq(segment);
226
- if (eqIdx > 0) query[segment.slice(0, eqIdx)] = segment.slice(eqIdx + 1);
227
- else query[segment] = null;
400
+ const key = eqIdx > 0 ? `${prefix}${segment.slice(0, eqIdx)}` : `${prefix}${segment}`;
401
+ serialized.set(key, eqIdx > 0 ? segment.slice(eqIdx + 1) : null);
402
+ written.add(key);
403
+ }
404
+ const query = {};
405
+ for (const key in route.query) {
406
+ if (!isOwn(key)) {
407
+ query[key] = route.query[key];
408
+ continue;
409
+ }
410
+ if (serialized.has(key)) {
411
+ query[key] = serialized.get(key);
412
+ serialized.delete(key);
413
+ }
228
414
  }
415
+ for (const [key, value] of serialized) query[key] = value;
229
416
  navigate({ query });
230
417
  }
231
418
  });
@@ -316,7 +503,7 @@ function createInstance(app, opts) {
316
503
  cache.value = { ...result.prefs };
317
504
  existing.value = result.row;
318
505
  } catch (err) {
319
- if (isAuthError(err)) {
506
+ if (isUnavailableError(err)) {
320
507
  denied.value = true;
321
508
  clearCache();
322
509
  existing.value = null;
@@ -497,4 +684,4 @@ function getColumnWidth(column) {
497
684
  return column.width || DEFAULT_WIDTHS[column.type] || "15em";
498
685
  }
499
686
  //#endregion
500
- export { AS_PRESETS_APP, as_cell_array_default as AsCellArray, as_cell_date_default as AsCellDate, as_cell_json_default as AsCellJson, as_cell_number_default as AsCellNumber, as_cell_union_default as AsCellUnion, as_column_menu_default as AsColumnMenu, as_config_dialog_default as AsConfigDialog, as_confirm_dialog_default as AsConfirmDialog, as_filter_dialog_default as AsFilterDialog, as_filter_field_default as AsFilterField, as_filter_input_default as AsFilterInput, as_filters_default as AsFilters, as_preset_dialog_default as AsPresetDialog, as_preset_picker_default as AsPresetPicker, as_row_actions_default as AsRowActions, as_table_default as AsTable, as_table_actions_default as AsTableActions, as_table_cell_value_default as AsTableCellValue, as_table_header_cell_default as AsTableHeaderCell, as_table_root_default as AsTableRoot, as_window_table_default as AsWindowTable, PRESET_ASPECTS, STANDARD_PRESET_ID, SYSTEM_PRESET_PREFIX, clearTableCache, createDefaultCellTypes, createDefaultControls, createStaticTableState, createTableState, extractIdentifier, formatCellValue, getCellValue, getColumnWidth, getDefaultClientFactory, injectPresetsApp, isSystemPresetId, provideCellLocale, resetDefaultClientFactory, resolveSystemPresets, setDefaultClientFactory, useAppPrefs, useCellLocale, useLocalDraft, usePresets, useTable, useTableActions, useTableComponent, useTableContext, useTableContextOptional, useTableFilter, useTableNavBridge, useTableSearch, useTableSelection, useTableUrlQuery };
687
+ export { AS_PRESETS_APP, as_cell_array_default as AsCellArray, as_cell_date_default as AsCellDate, as_cell_json_default as AsCellJson, as_cell_number_default as AsCellNumber, as_cell_union_default as AsCellUnion, as_column_menu_default as AsColumnMenu, as_config_dialog_default as AsConfigDialog, as_confirm_dialog_default as AsConfirmDialog, as_filter_dialog_default as AsFilterDialog, as_filter_field_default as AsFilterField, as_filter_input_default as AsFilterInput, as_filters_default as AsFilters, as_preset_dialog_default as AsPresetDialog, as_preset_picker_default as AsPresetPicker, as_row_actions_default as AsRowActions, as_table_default as AsTable, as_table_actions_default as AsTableActions, as_table_cell_value_default as AsTableCellValue, as_table_header_cell_default as AsTableHeaderCell, as_table_root_default as AsTableRoot, as_window_table_default as AsWindowTable, ExportAbortError, PRESET_ASPECTS, STANDARD_PRESET_ID, SYSTEM_PRESET_PREFIX, clearTableCache, createDefaultCellTypes, createDefaultControls, createStaticTableState, createTableState, downloadExport, extractIdentifier, formatCellValue, getCellValue, getColumnWidth, getDefaultClientFactory, injectPresetsApp, isSystemPresetId, provideCellLocale, provideTableContext, resetDefaultClientFactory, resolveSystemPresets, setDefaultClientFactory, useAppPrefs, useCellLocale, useLocalDraft, usePresets, useTable, useTableActions, useTableComponent, useTableContext, useTableContextOptional, useTableExport, useTableFilter, useTableNavBridge, useTableSearch, useTableSelection, useTableUrlQuery };