@chelone/vue 0.7.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/dist/admin/admin.vue_vue_type_script_setup_true_lang.js +5 -4
  2. package/dist/admin/auth-gate.js +1 -3
  3. package/dist/admin/resource-view.d.ts +8 -0
  4. package/dist/admin/resource-view.js +19 -0
  5. package/dist/auth/permissions-hooks.js +1 -3
  6. package/dist/choices/choices-context.d.ts +1 -2
  7. package/dist/choices/use-choices.d.ts +3 -3
  8. package/dist/choices/use-choices.js +13 -10
  9. package/dist/choices/use-reference-input.js +4 -4
  10. package/dist/components/admin/auth/auth-error.vue_vue_type_script_setup_true_lang.js +4 -3
  11. package/dist/components/admin/auth/auth-layout.vue_vue_type_script_setup_true_lang.js +1 -1
  12. package/dist/components/admin/auth/can-access.vue.d.ts +2 -2
  13. package/dist/components/admin/auth/login-form.vue_vue_type_script_setup_true_lang.js +3 -2
  14. package/dist/components/admin/auth/login-with-email.vue_vue_type_script_setup_true_lang.js +1 -0
  15. package/dist/components/admin/buttons/bulk-update-button.vue.d.ts +19 -6
  16. package/dist/components/admin/buttons/bulk-update-button.vue_vue_type_script_setup_true_lang.js +1 -1
  17. package/dist/components/admin/buttons/clone-button.vue.d.ts +19 -16
  18. package/dist/components/admin/buttons/clone-button.vue_vue_type_script_setup_true_lang.js +4 -5
  19. package/dist/components/admin/buttons/delete-button.vue.d.ts +19 -10
  20. package/dist/components/admin/buttons/delete-button.vue_vue_type_script_setup_true_lang.js +6 -7
  21. package/dist/components/admin/buttons/dual-approval-button.vue_vue_type_script_setup_true_lang.js +14 -2
  22. package/dist/components/admin/buttons/edit-button.vue.d.ts +19 -16
  23. package/dist/components/admin/buttons/edit-button.vue_vue_type_script_setup_true_lang.js +4 -5
  24. package/dist/components/admin/buttons/export-button.vue_vue_type_script_setup_true_lang.js +2 -2
  25. package/dist/components/admin/buttons/fields-selector.vue_vue_type_script_setup_true_lang.js +1 -2
  26. package/dist/components/admin/buttons/filter-button.vue_vue_type_script_setup_true_lang.js +1 -1
  27. package/dist/components/admin/buttons/record-button-props.d.ts +12 -0
  28. package/dist/components/admin/buttons/show-button.vue.d.ts +19 -16
  29. package/dist/components/admin/buttons/show-button.vue_vue_type_script_setup_true_lang.js +4 -5
  30. package/dist/components/admin/buttons/status-transition-button.vue_vue_type_script_setup_true_lang.js +3 -7
  31. package/dist/components/admin/buttons/update-button.vue.d.ts +28 -24
  32. package/dist/components/admin/buttons/update-button.vue_vue_type_script_setup_true_lang.js +3 -4
  33. package/dist/components/admin/common/application-updated-notification.vue_vue_type_script_setup_true_lang.js +1 -1
  34. package/dist/components/admin/common/i18n-key-editor.vue_vue_type_script_setup_true_lang.js +1 -2
  35. package/dist/components/admin/csv-import/csv-import.vue_vue_type_script_setup_true_lang.js +2 -5
  36. package/dist/components/admin/feedback/error.vue_vue_type_script_setup_true_lang.js +1 -1
  37. package/dist/components/admin/feedback/linear-progress.vue_vue_type_script_setup_true_lang.js +1 -0
  38. package/dist/components/admin/feedback/loading.vue_vue_type_script_setup_true_lang.js +7 -6
  39. package/dist/components/admin/feedback/placeholder.vue_vue_type_script_setup_true_lang.js +4 -1
  40. package/dist/components/admin/fields/api-key-field.vue.d.ts +3 -3
  41. package/dist/components/admin/fields/api-key-field.vue_vue_type_script_setup_true_lang.js +6 -7
  42. package/dist/components/admin/fields/array-field.vue.d.ts +3 -3
  43. package/dist/components/admin/fields/badge-field.vue.d.ts +3 -3
  44. package/dist/components/admin/fields/boolean-field.vue.d.ts +3 -3
  45. package/dist/components/admin/fields/chip-field.vue.d.ts +3 -3
  46. package/dist/components/admin/fields/color-field.vue.d.ts +3 -3
  47. package/dist/components/admin/fields/cron-field.vue.d.ts +3 -3
  48. package/dist/components/admin/fields/currency-field.vue.d.ts +3 -3
  49. package/dist/components/admin/fields/date-field.vue.d.ts +3 -3
  50. package/dist/components/admin/fields/diff-viewer.vue.d.ts +3 -3
  51. package/dist/components/admin/fields/duration-field.vue.d.ts +3 -3
  52. package/dist/components/admin/fields/email-field.vue.d.ts +3 -3
  53. package/dist/components/admin/fields/field-props.d.ts +2 -2
  54. package/dist/components/admin/fields/file-field.vue.d.ts +3 -3
  55. package/dist/components/admin/fields/function-field.vue.d.ts +3 -3
  56. package/dist/components/admin/fields/image-field.vue.d.ts +3 -3
  57. package/dist/components/admin/fields/json-field.vue.d.ts +3 -3
  58. package/dist/components/admin/fields/number-field.vue.d.ts +3 -3
  59. package/dist/components/admin/fields/phone-field.vue.d.ts +3 -3
  60. package/dist/components/admin/fields/phone-field.vue_vue_type_script_setup_true_lang.js +3 -1
  61. package/dist/components/admin/fields/rating-field.vue.d.ts +3 -3
  62. package/dist/components/admin/fields/rating-field.vue_vue_type_script_setup_true_lang.js +5 -5
  63. package/dist/components/admin/fields/record-field.vue.d.ts +3 -3
  64. package/dist/components/admin/fields/reference-array-field.vue.d.ts +20 -10
  65. package/dist/components/admin/fields/reference-field.vue.d.ts +22 -35
  66. package/dist/components/admin/fields/reference-many-count.vue.d.ts +20 -5
  67. package/dist/components/admin/fields/reference-many-field.vue.d.ts +20 -12
  68. package/dist/components/admin/fields/reference-one-field.vue.d.ts +22 -12
  69. package/dist/components/admin/fields/select-field.vue.d.ts +3 -3
  70. package/dist/components/admin/fields/subscription-plan-field.vue.d.ts +3 -3
  71. package/dist/components/admin/fields/text-array-field.vue.d.ts +3 -3
  72. package/dist/components/admin/fields/text-field.vue.d.ts +3 -3
  73. package/dist/components/admin/fields/url-field.vue.d.ts +3 -3
  74. package/dist/components/admin/fields/usage-meter-field.vue.d.ts +3 -3
  75. package/dist/components/admin/fields/usage-meter-field.vue_vue_type_script_setup_true_lang.js +6 -6
  76. package/dist/components/admin/fields/webhook-endpoint-field.vue.d.ts +3 -3
  77. package/dist/components/admin/fields/webhook-endpoint-field.vue_vue_type_script_setup_true_lang.js +1 -1
  78. package/dist/components/admin/fields/wrapper-field.vue.d.ts +21 -11
  79. package/dist/components/admin/inputs/api-key-input.vue.d.ts +20 -5
  80. package/dist/components/admin/inputs/api-key-input.vue_vue_type_script_setup_true_lang.js +3 -4
  81. package/dist/components/admin/inputs/array-input-row.vue_vue_type_script_setup_true_lang.js +1 -1
  82. package/dist/components/admin/inputs/checkbox-group-input.vue_vue_type_script_setup_true_lang.js +1 -1
  83. package/dist/components/admin/inputs/date-input-format.d.ts +4 -1
  84. package/dist/components/admin/inputs/date-input-format.js +10 -1
  85. package/dist/components/admin/inputs/date-input.vue_vue_type_script_setup_true_lang.js +3 -2
  86. package/dist/components/admin/inputs/date-time-input.vue_vue_type_script_setup_true_lang.js +3 -2
  87. package/dist/components/admin/inputs/duration-input.vue_vue_type_script_setup_true_lang.js +1 -1
  88. package/dist/components/admin/inputs/image-input-thumbnail.vue_vue_type_script_setup_true_lang.js +6 -5
  89. package/dist/components/admin/inputs/image-input.vue.d.ts +1 -0
  90. package/dist/components/admin/inputs/image-input.vue_vue_type_script_setup_true_lang.js +4 -1
  91. package/dist/components/admin/inputs/in-place-editor-form.vue.d.ts +3 -3
  92. package/dist/components/admin/inputs/in-place-editor-form.vue_vue_type_script_setup_true_lang.js +1 -1
  93. package/dist/components/admin/inputs/in-place-editor.vue.d.ts +3 -3
  94. package/dist/components/admin/inputs/number-input.vue.d.ts +6 -0
  95. package/dist/components/admin/inputs/number-input.vue_vue_type_script_setup_true_lang.js +9 -0
  96. package/dist/components/admin/inputs/password-input.vue_vue_type_script_setup_true_lang.js +34 -30
  97. package/dist/components/admin/inputs/phone-input.vue_vue_type_script_setup_true_lang.js +1 -1
  98. package/dist/components/admin/inputs/radio-button-group-input.vue_vue_type_script_setup_true_lang.js +1 -1
  99. package/dist/components/admin/inputs/rating-input.vue_vue_type_script_setup_true_lang.js +24 -12
  100. package/dist/components/admin/inputs/reference-input.vue.d.ts +1 -1
  101. package/dist/components/admin/inputs/reference-input.vue_vue_type_script_setup_true_lang.js +2 -1
  102. package/dist/components/admin/inputs/resettable-text-input.vue.d.ts +6 -4
  103. package/dist/components/admin/inputs/resettable-text-input.vue_vue_type_script_setup_true_lang.js +44 -39
  104. package/dist/components/admin/inputs/subscription-plan-picker.vue_vue_type_script_setup_true_lang.js +2 -2
  105. package/dist/components/admin/inputs/text-input.vue.d.ts +13 -2
  106. package/dist/components/admin/inputs/text-input.vue_vue_type_script_setup_true_lang.js +9 -4
  107. package/dist/components/admin/inputs/time-input.vue_vue_type_script_setup_true_lang.js +3 -2
  108. package/dist/components/admin/inputs/use-choice-input.d.ts +2 -2
  109. package/dist/components/admin/layout/app-sidebar.vue.d.ts +12 -1
  110. package/dist/components/admin/layout/app-sidebar.vue_vue_type_script_setup_true_lang.js +15 -11
  111. package/dist/components/admin/layout/command-menu-content.vue_vue_type_script_setup_true_lang.js +1 -1
  112. package/dist/components/admin/layout/command-menu.vue.d.ts +1 -1
  113. package/dist/components/admin/layout/command-menu.vue_vue_type_script_setup_true_lang.js +9 -63
  114. package/dist/components/admin/layout/data-provider-devtools-entry.vue.d.ts +1 -1
  115. package/dist/components/admin/layout/data-provider-devtools-entry.vue_vue_type_script_setup_true_lang.js +3 -3
  116. package/dist/components/admin/layout/data-provider-devtools.vue_vue_type_script_setup_true_lang.js +62 -28
  117. package/dist/components/admin/layout/icons.d.ts +2 -0
  118. package/dist/components/admin/layout/icons.js +3 -1
  119. package/dist/components/admin/layout/layout.vue_vue_type_script_setup_true_lang.js +1 -1
  120. package/dist/components/admin/layout/menu-item-link.vue.d.ts +5 -0
  121. package/dist/components/admin/layout/menu-item-link.vue_vue_type_script_setup_true_lang.js +27 -8
  122. package/dist/components/admin/layout/onboarding-tour-overlay.vue_vue_type_script_setup_true_lang.js +1 -2
  123. package/dist/components/admin/layout/resource-menu-item-group.vue.d.ts +8 -1
  124. package/dist/components/admin/layout/resource-menu-item-group.vue_vue_type_script_setup_true_lang.js +8 -7
  125. package/dist/components/admin/layout/theme-provider.vue_vue_type_script_setup_true_lang.js +2 -1
  126. package/dist/components/admin/layout/title-portal-id.d.ts +1 -1
  127. package/dist/components/admin/layout/title-portal-id.js +1 -9
  128. package/dist/components/admin/layout/top-toolbar.vue_vue_type_script_setup_true_lang.js +4 -1
  129. package/dist/components/admin/list/approval-queue-row.vue.d.ts +2 -2
  130. package/dist/components/admin/list/approval-queue-row.vue_vue_type_script_setup_true_lang.js +2 -2
  131. package/dist/components/admin/list/approval-queue.vue.d.ts +3 -3
  132. package/dist/components/admin/list/calendar-agenda-view.vue.d.ts +23 -15
  133. package/dist/components/admin/list/calendar-event.vue.d.ts +21 -8
  134. package/dist/components/admin/list/calendar-list.vue.d.ts +29 -56
  135. package/dist/components/admin/list/calendar-list.vue_vue_type_script_setup_true_lang.js +12 -8
  136. package/dist/components/admin/list/calendar-month-view.vue.d.ts +26 -20
  137. package/dist/components/admin/list/calendar-month-view.vue_vue_type_script_setup_true_lang.js +2 -6
  138. package/dist/components/admin/list/calendar-week-view.vue.d.ts +24 -17
  139. package/dist/components/admin/list/data-table-col.vue_vue_type_script_setup_true_lang.js +8 -5
  140. package/dist/components/admin/list/data-table-context.d.ts +9 -6
  141. package/dist/components/admin/list/data-table-context.js +9 -1
  142. package/dist/components/admin/list/data-table-row.vue.d.ts +19 -15
  143. package/dist/components/admin/list/data-table-row.vue_vue_type_script_setup_true_lang.js +5 -9
  144. package/dist/components/admin/list/data-table.vue.d.ts +35 -23
  145. package/dist/components/admin/list/data-table.vue_vue_type_script_setup_true_lang.js +4 -7
  146. package/dist/components/admin/list/list-pagination.vue_vue_type_script_setup_true_lang.js +2 -2
  147. package/dist/components/admin/list/pivot-grid.vue.d.ts +3 -3
  148. package/dist/components/admin/list/record-timeline.vue.d.ts +3 -3
  149. package/dist/components/admin/list/record-timeline.vue_vue_type_script_setup_true_lang.js +1 -1
  150. package/dist/components/admin/list/simple-list-item.vue.d.ts +21 -19
  151. package/dist/components/admin/list/simple-list-item.vue_vue_type_script_setup_true_lang.js +3 -7
  152. package/dist/components/admin/list/simple-list.vue.d.ts +28 -20
  153. package/dist/components/admin/list/single-field-list-record.vue.d.ts +19 -9
  154. package/dist/components/admin/list/single-field-list.vue.d.ts +21 -11
  155. package/dist/components/admin/list/tree-list-context.d.ts +11 -6
  156. package/dist/components/admin/list/tree-list-node.vue.d.ts +19 -4
  157. package/dist/components/admin/list/tree-list.vue.d.ts +28 -37
  158. package/dist/components/admin/realtime/comments-thread.vue_vue_type_script_setup_true_lang.js +56 -44
  159. package/dist/components/admin/realtime/menu-live.vue.d.ts +3 -1
  160. package/dist/components/admin/realtime/menu-live.vue_vue_type_script_setup_true_lang.js +42 -12
  161. package/dist/components/admin/supabase/forgot-password-form.vue_vue_type_script_setup_true_lang.js +4 -3
  162. package/dist/components/admin/supabase/set-password-form.vue_vue_type_script_setup_true_lang.js +4 -3
  163. package/dist/components/admin/supabase/use-password-recovery.js +11 -1
  164. package/dist/components/admin/view/create.vue_vue_type_script_setup_true_lang.js +1 -1
  165. package/dist/components/admin/view/edit.vue_vue_type_script_setup_true_lang.js +1 -1
  166. package/dist/components/admin/view/show.vue_vue_type_script_setup_true_lang.js +1 -1
  167. package/dist/components/admin/widgets/job-monitor-row.vue.d.ts +24 -11
  168. package/dist/components/admin/widgets/job-monitor.vue.d.ts +3 -3
  169. package/dist/components/admin/widgets/job-monitor.vue_vue_type_script_setup_true_lang.js +2 -2
  170. package/dist/components/block-editor/block-doc-field.vue.d.ts +3 -3
  171. package/dist/components/block-editor/block-drag-handle.vue_vue_type_script_setup_true_lang.js +3 -4
  172. package/dist/components/block-editor/image-block-config.vue_vue_type_script_setup_true_lang.js +2 -3
  173. package/dist/components/charts/bar-chart.vue.d.ts +6 -2
  174. package/dist/components/charts/bar-chart.vue_vue_type_script_setup_true_lang.js +6 -4
  175. package/dist/components/charts/series-chart.d.ts +1 -1
  176. package/dist/components/charts/series-chart.js +9 -3
  177. package/dist/components/index.js +2 -2
  178. package/dist/components/inspector/configurable.vue.d.ts +0 -21
  179. package/dist/components/inspector/configurable.vue_vue_type_script_setup_true_lang.js +2 -2
  180. package/dist/components/inspector/inspector.vue_vue_type_script_setup_true_lang.js +6 -8
  181. package/dist/components/kanban/kanban-board.vue.d.ts +3 -3
  182. package/dist/components/kanban/kanban-board.vue_vue_type_script_setup_true_lang.js +7 -2
  183. package/dist/components/maps/bbox-field.vue_vue_type_script_setup_true_lang.js +4 -4
  184. package/dist/components/maps/geo-json-field.vue_vue_type_script_setup_true_lang.js +4 -4
  185. package/dist/components/maps/geo-json-layers.vue_vue_type_script_setup_true_lang.js +3 -3
  186. package/dist/components/maps/geo-json-view.vue_vue_type_script_setup_true_lang.js +3 -2
  187. package/dist/components/maps/lat-lng-field.vue_vue_type_script_setup_true_lang.js +4 -3
  188. package/dist/components/maps/lat-lng-input.vue_vue_type_script_setup_true_lang.js +5 -7
  189. package/dist/components/maps/map-canvas.vue_vue_type_script_setup_true_lang.js +3 -3
  190. package/dist/components/maps/use-map.js +1 -3
  191. package/dist/components/maps-draw/shape-input.vue_vue_type_script_setup_true_lang.js +5 -5
  192. package/dist/components/maps-draw/simplify-input.vue_vue_type_script_setup_true_lang.js +2 -2
  193. package/dist/components/maps-osm/geocoding-input.vue_vue_type_script_setup_true_lang.js +2 -1
  194. package/dist/components/maps-osm/map-with-search.vue_vue_type_script_setup_true_lang.js +2 -2
  195. package/dist/components/mdx-editor/mdx-editor-theme.css +47 -0
  196. package/dist/components/mdx-editor/mdx-field.vue.d.ts +21 -11
  197. package/dist/components/mdx-editor/mdx-input.vue_vue_type_script_setup_true_lang.js +4 -1
  198. package/dist/components/monaco/internal/use-json-schema.js +1 -2
  199. package/dist/components/monaco/internal/use-monaco-markers.d.ts +0 -6
  200. package/dist/components/monaco/internal/use-monaco-markers.js +4 -2
  201. package/dist/components/monaco/monaco-json-field-lazy.vue.d.ts +2 -2
  202. package/dist/components/monaco/monaco-json-field-lazy.vue_vue_type_script_setup_true_lang.js +3 -2
  203. package/dist/components/monaco/monaco-json-field.vue.d.ts +3 -3
  204. package/dist/components/monaco/monaco-json-input-lazy.vue_vue_type_script_setup_true_lang.js +4 -4
  205. package/dist/components/rich-text-input/rich-text-field.vue.d.ts +3 -3
  206. package/dist/components/ui/avatar.js +1 -1
  207. package/dist/components/ui/badge.js +4 -4
  208. package/dist/components/ui/button-variants.js +1 -1
  209. package/dist/components/ui/chart/chart-container.vue_vue_type_script_setup_true_lang.js +1 -1
  210. package/dist/components/ui/checkbox.vue_vue_type_script_setup_true_lang.js +1 -1
  211. package/dist/components/ui/command/command-dialog.vue_vue_type_script_setup_true_lang.js +1 -1
  212. package/dist/components/ui/sidebar/sidebar-menu-button.vue_vue_type_script_setup_true_lang.js +1 -1
  213. package/dist/components/ui/sidebar/sidebar-parts.js +2 -2
  214. package/dist/components/ui/sidebar/sidebar.vue_vue_type_script_setup_true_lang.js +2 -2
  215. package/dist/controllers/use-controller-for-id.d.ts +2 -2
  216. package/dist/controllers/use-prev-next-controller.d.ts +2 -2
  217. package/dist/controllers/use-reference-many-field-controller.d.ts +4 -4
  218. package/dist/controllers/use-reference-one-field-controller.d.ts +4 -4
  219. package/dist/create-resource-components.d.ts +225 -117
  220. package/dist/data/undoable.js +2 -2
  221. package/dist/form/use-form.d.ts +5 -3
  222. package/dist/form/use-form.js +1 -1
  223. package/dist/form/use-input.d.ts +0 -2
  224. package/dist/form/use-input.js +1 -2
  225. package/dist/index.js +2 -2
  226. package/dist/resource-context.d.ts +5 -1
  227. package/dist/resource-context.js +4 -0
  228. package/dist/router/use-get-path-for-record.d.ts +3 -3
  229. package/package.json +5 -5
@@ -1,39 +1,17 @@
1
- /**
2
- * `<CalendarList>` — the records of the ambient `<List>` as events in a month
3
- * grid, or in a week of hour rows, or in an agenda. The Vue analog of `@chelone/react`'s `list/calendar-list.tsx`. It asks
4
- * the list for the visible range (and `perPage` records), so moving to another
5
- * month refetches; it removes that filter and restores `perPage` when it
6
- * unmounts. The filters the user set stay.
7
- *
8
- * Emits `select-event` with the record when an event is activated; with no
9
- * listener attached, the event navigates to the record's edit or show page.
10
- * Emits `select-slot` with `{ startISO, endISO, allDay }` when an empty part of
11
- * a day is clicked. With a `drop` listener attached, month-view events can be
12
- * dragged to another day; `drop` carries the record and its new `{ start, end? }`
13
- * as ISO strings and the list is not updated. A promise the listener returns is
14
- * the caller's to handle. The `#event` slot replaces an event and the `#header` slot
15
- * the title and navigation.
16
- *
17
- * @example
18
- * <List>
19
- * <CalendarList start-source="starts_at" end-source="ends_at" title-source="name" />
20
- * </List>
21
- */
22
- import { type LooseRecord } from "@chelone/core";
23
1
  import { type VNode } from "vue";
24
2
  import { type CalendarEventSlotProps, type CalendarDrop, type CalendarSlot } from "./calendar-month-view.vue.js";
25
- import type { CalendarRange, CalendarView, CalendarWeekStart, SourceProp } from "@chelone/core";
3
+ import type { CalendarRange, CalendarView, CalendarWeekStart, LooseRecord, ResourceRecord, SourceProp } from "@chelone/core";
26
4
  import type { CalendarNavigateDirection } from "./calendar-header.vue.js";
27
5
  /** Props for {@link CalendarList}. */
28
- export interface CalendarListProps {
6
+ export interface CalendarListProps<TRecord extends ResourceRecord = LooseRecord> {
29
7
  /** The field holding the start of an event; a dotted path reads a nested value. */
30
- startSource: SourceProp;
8
+ startSource: SourceProp<TRecord>;
31
9
  /** The field holding the end. An event with none, or one before its start, covers its start day only. */
32
- endSource?: SourceProp;
10
+ endSource?: SourceProp<TRecord>;
33
11
  /** The string field shown as the event title; the record representation otherwise. */
34
- titleSource?: SourceProp;
12
+ titleSource?: SourceProp<TRecord>;
35
13
  /** The field whose value picks a color from `colorMap`. */
36
- colorSource?: SourceProp;
14
+ colorSource?: SourceProp<TRecord>;
37
15
  colorMap?: Record<string, string>;
38
16
  /** The view shown first. Default `month`. */
39
17
  defaultView?: CalendarView;
@@ -74,33 +52,28 @@ export interface CalendarHeaderSlotProps {
74
52
  }
75
53
  declare const _default: typeof __VLS_export;
76
54
  export default _default;
77
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CalendarListProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
78
- drop: (record: LooseRecord, range: CalendarDrop) => any;
79
- selectEvent: (record: LooseRecord) => any;
80
- selectSlot: (slot: CalendarSlot) => any;
81
- }, string, import("vue").PublicProps, Readonly<CalendarListProps> & Readonly<{
82
- onDrop?: ((record: LooseRecord, range: CalendarDrop) => any) | undefined;
83
- onSelectEvent?: ((record: LooseRecord) => any) | undefined;
84
- onSelectSlot?: ((slot: CalendarSlot) => any) | undefined;
85
- }>, {
86
- perPage: number;
87
- linkType: false | "edit" | "show";
88
- titleSource: string;
89
- views: CalendarView[];
90
- endSource: string;
91
- colorSource: string;
92
- colorMap: Record<string, string>;
93
- defaultView: CalendarView;
94
- weekStartsOn: CalendarWeekStart;
95
- rangeFilter: (range: CalendarRange) => Record<string, unknown>;
96
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
97
- /** Replaces an event in its day cell. */
98
- event?(props: CalendarEventSlotProps): VNode[];
99
- /** Replaces the title and the navigation. */
100
- header?(props: CalendarHeaderSlotProps): VNode[];
101
- }>;
102
- type __VLS_WithSlots<T, S> = T & {
103
- new (): {
104
- $slots: S;
55
+ declare const __VLS_export: <TRecord extends ResourceRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
56
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<CalendarListProps<TRecord> & {
57
+ onDrop?: ((record: TRecord, range: CalendarDrop) => any) | undefined;
58
+ onSelectEvent?: ((record: TRecord) => any) | undefined;
59
+ onSelectSlot?: ((slot: CalendarSlot) => any) | undefined;
60
+ }> & (typeof globalThis extends {
61
+ __VLS_PROPS_FALLBACK: infer P;
62
+ } ? P : {});
63
+ expose: (exposed: {}) => void;
64
+ attrs: any;
65
+ slots: {
66
+ /** Replaces an event in its day cell. */
67
+ event?(props: CalendarEventSlotProps<TRecord>): VNode[];
68
+ /** Replaces the title and the navigation. */
69
+ header?(props: CalendarHeaderSlotProps): VNode[];
105
70
  };
71
+ emit: ((evt: "drop", record: TRecord, range: CalendarDrop) => void) & ((evt: "selectEvent", record: TRecord) => void) & ((evt: "selectSlot", slot: CalendarSlot) => void);
72
+ }>) => import("vue").VNode & {
73
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
106
74
  };
75
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
76
+ [K in keyof T]: T[K];
77
+ } : {
78
+ [K in keyof T as K]: T[K];
79
+ }) & {};
@@ -10,7 +10,7 @@ import calendar_header_default from "./calendar-header.js";
10
10
  import calendar_month_view_default from "./calendar-month-view.js";
11
11
  import calendar_week_view_default from "./calendar-week-view.js";
12
12
  import { computed, createBlock, createElementBlock, createSlots, defineComponent, getCurrentInstance, guardReactiveProps, normalizeClass, normalizeProps, onBeforeUnmount, openBlock, ref, renderSlot, unref, watch, withCtx } from "vue";
13
- import { calendarDays, calendarLabels, calendarRange, calendarRangeFilter, shiftCalendarAnchor, staleCalendarRangeKeys, toCalendarEvents } from "@chelone/core";
13
+ import { DEFAULT_PER_PAGE, calendarDays, calendarLabels, calendarRange, calendarRangeFilter, shiftCalendarAnchor, staleCalendarRangeKeys, toCalendarEvents } from "@chelone/core";
14
14
  // src/components/admin/list/calendar-list.vue?vue&type=script&setup=true&lang.ts
15
15
  var _hoisted_1 = ["aria-busy"];
16
16
  var calendar_list_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
@@ -109,18 +109,22 @@ var calendar_list_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
109
109
  const labels = computed(() => calendarLabels(locale.value));
110
110
  const title = computed(() => labels.value.title(view.value, anchor.value, range.value));
111
111
  const weekdays = computed(() => days.value.slice(0, 7).map((day) => labels.value.weekday(day)));
112
+ const pathOf = (source) => {
113
+ return source;
114
+ };
115
+ const pathOfOptional = (source) => source === void 0 ? void 0 : pathOf(source);
112
116
  const events = computed(() => toCalendarEvents(list.data ?? [], {
113
- startSource: props.startSource,
114
- endSource: props.endSource,
115
- titleSource: props.titleSource,
116
- colorSource: props.colorSource,
117
+ startSource: pathOf(props.startSource),
118
+ endSource: pathOfOptional(props.endSource),
119
+ titleSource: pathOfOptional(props.titleSource),
120
+ colorSource: pathOfOptional(props.colorSource),
117
121
  colorMap: props.colorMap,
118
122
  getTitle: getRepresentation
119
123
  }));
120
124
  const rangeValue = computed(() => props.rangeFilter ? props.rangeFilter(range.value) : calendarRangeFilter(props.startSource, range.value, props.endSource));
121
125
  const rangeStartISO = computed(() => range.value.start.toISOString());
122
126
  const rangeEndISO = computed(() => range.value.end.toISOString());
123
- const originalPerPage = list.perPage === props.perPage ? list.defaultPerPage ?? 10 : list.perPage;
127
+ const originalPerPage = list.perPage === props.perPage ? list.defaultPerPage ?? DEFAULT_PER_PAGE : list.perPage;
124
128
  let appliedKeys = [];
125
129
  const without = (filter, keys) => Object.fromEntries(Object.entries(filter).filter(([key]) => !keys.includes(key)));
126
130
  const staleKeys = computed(() => props.rangeFilter ? [] : staleCalendarRangeKeys(props.startSource, props.endSource));
@@ -151,11 +155,11 @@ var calendar_list_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
151
155
  });
152
156
  });
153
157
  const type = computed(() => props.linkType ?? (definition.value.hasEdit ? "edit" : definition.value.hasShow ? "show" : false));
154
- const linkTo = (record) => resource && type.value ? createPath({
158
+ const linkTo = (record) => !resource || type.value === false ? void 0 : createPath({
155
159
  resource,
156
160
  id: record.id,
157
161
  type: type.value
158
- }) : void 0;
162
+ });
159
163
  const hrefFor = (record) => hasListener() ? void 0 : linkTo(record);
160
164
  const isSelectable = (record) => hasListener() || linkTo(record) !== void 0;
161
165
  function onSelectEvent(record) {
@@ -1,7 +1,7 @@
1
1
  import { type VNode } from "vue";
2
- import type { CalendarEvent, LooseRecord } from "@chelone/core";
2
+ import type { CalendarEvent, LooseRecord, ResourceRecord } from "@chelone/core";
3
3
  /** What the `#event` slot of a `<CalendarList>` receives: the event and the day cell it renders in. */
4
- export interface CalendarEventSlotProps extends CalendarEvent<LooseRecord> {
4
+ export interface CalendarEventSlotProps<TRecord extends ResourceRecord = LooseRecord> extends CalendarEvent<TRecord> {
5
5
  day: Date;
6
6
  }
7
7
  /** The time span `select-slot` reports. */
@@ -16,7 +16,7 @@ export interface CalendarDrop {
16
16
  end?: string;
17
17
  }
18
18
  /** Props for {@link CalendarMonthView}. */
19
- export interface CalendarMonthViewProps {
19
+ export interface CalendarMonthViewProps<TRecord extends ResourceRecord = LooseRecord> {
20
20
  /** Every day of the grid, whole weeks, in order. */
21
21
  days: Date[];
22
22
  /** Its month decides which days are outside the month. */
@@ -25,29 +25,35 @@ export interface CalendarMonthViewProps {
25
25
  weekdays: string[];
26
26
  /** The label of the grid. */
27
27
  label: string;
28
- events: CalendarEvent<LooseRecord>[];
28
+ events: CalendarEvent<TRecord>[];
29
29
  /** The link an event is, when it navigates. */
30
- hrefFor: (record: LooseRecord) => string | undefined;
30
+ hrefFor: (record: TRecord) => string | undefined;
31
31
  /** Whether activating the event does anything: it is inert otherwise. */
32
- isSelectable: (record: LooseRecord) => boolean;
32
+ isSelectable: (record: TRecord) => boolean;
33
33
  /** Whether events can be dragged to another day. */
34
34
  draggable?: boolean;
35
35
  }
36
36
  declare const _default: typeof __VLS_export;
37
37
  export default _default;
38
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CalendarMonthViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
39
- drop: (record: LooseRecord, range: CalendarDrop) => any;
40
- selectEvent: (record: LooseRecord) => any;
41
- selectSlot: (slot: CalendarSlot) => any;
42
- }, string, import("vue").PublicProps, Readonly<CalendarMonthViewProps> & Readonly<{
43
- onDrop?: ((record: LooseRecord, range: CalendarDrop) => any) | undefined;
44
- onSelectEvent?: ((record: LooseRecord) => any) | undefined;
45
- onSelectSlot?: ((slot: CalendarSlot) => any) | undefined;
46
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
47
- event?(props: CalendarEventSlotProps): VNode[];
48
- }>;
49
- type __VLS_WithSlots<T, S> = T & {
50
- new (): {
51
- $slots: S;
38
+ declare const __VLS_export: <TRecord extends ResourceRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
39
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<CalendarMonthViewProps<TRecord> & {
40
+ onDrop?: ((record: TRecord, range: CalendarDrop) => any) | undefined;
41
+ onSelectEvent?: ((record: TRecord) => any) | undefined;
42
+ onSelectSlot?: ((slot: CalendarSlot) => any) | undefined;
43
+ }> & (typeof globalThis extends {
44
+ __VLS_PROPS_FALLBACK: infer P;
45
+ } ? P : {});
46
+ expose: (exposed: {}) => void;
47
+ attrs: any;
48
+ slots: {
49
+ event?(props: CalendarEventSlotProps<TRecord>): VNode[];
52
50
  };
51
+ emit: ((evt: "drop", record: TRecord, range: CalendarDrop) => void) & ((evt: "selectEvent", record: TRecord) => void) & ((evt: "selectSlot", slot: CalendarSlot) => void);
52
+ }>) => import("vue").VNode & {
53
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
53
54
  };
55
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
56
+ [K in keyof T]: T[K];
57
+ } : {
58
+ [K in keyof T as K]: T[K];
59
+ }) & {};
@@ -1,6 +1,6 @@
1
1
  import { cn } from "../../../lib/utils.js";
2
2
  import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, normalizeClass, normalizeStyle, onBeforeUnmount, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, unref, withCtx, withModifiers } from "vue";
3
- import { calendarDayKey, calendarEventsOnDay, moveCalendarEvent } from "@chelone/core";
3
+ import { calendarDayKey, calendarDaySlot, calendarEventsOnDay, moveCalendarEvent } from "@chelone/core";
4
4
  // src/components/admin/list/calendar-month-view.vue?vue&type=script&setup=true&lang.ts
5
5
  var _hoisted_1 = ["aria-label"];
6
6
  var _hoisted_2 = {
@@ -67,11 +67,7 @@ var calendar_month_view_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
67
67
  onBeforeUnmount(() => clearTimeout(midnightTimer));
68
68
  const eventsOn = (day) => calendarEventsOnDay(props.events, day);
69
69
  function selectSlot(day) {
70
- emit("selectSlot", {
71
- startISO: new Date(day.getFullYear(), day.getMonth(), day.getDate()).toISOString(),
72
- endISO: new Date(day.getFullYear(), day.getMonth(), day.getDate(), 23, 59, 59, 999).toISOString(),
73
- allDay: true
74
- });
70
+ emit("selectSlot", calendarDaySlot(day));
75
71
  }
76
72
  function onEventClick(event, record) {
77
73
  if (!props.isSelectable(record)) return;
@@ -1,32 +1,39 @@
1
1
  import { type VNode } from "vue";
2
2
  import type { CalendarEventSlotProps, CalendarSlot } from "./calendar-month-view.vue.js";
3
- import type { CalendarEvent, CalendarLabels, LooseRecord } from "@chelone/core";
3
+ import type { CalendarEvent, CalendarLabels, LooseRecord, ResourceRecord } from "@chelone/core";
4
4
  /** Props for {@link CalendarWeekView}. */
5
- export interface CalendarWeekViewProps {
5
+ export interface CalendarWeekViewProps<TRecord extends ResourceRecord = LooseRecord> {
6
6
  /** The seven days of the week, in order. */
7
7
  days: Date[];
8
8
  labels: CalendarLabels;
9
9
  /** The label of the grid. */
10
10
  label: string;
11
- events: CalendarEvent<LooseRecord>[];
11
+ events: CalendarEvent<TRecord>[];
12
12
  /** The link an event is, when it navigates. */
13
- hrefFor: (record: LooseRecord) => string | undefined;
13
+ hrefFor: (record: TRecord) => string | undefined;
14
14
  /** Whether activating the event does anything: it is inert otherwise. */
15
- isSelectable: (record: LooseRecord) => boolean;
15
+ isSelectable: (record: TRecord) => boolean;
16
16
  }
17
17
  declare const _default: typeof __VLS_export;
18
18
  export default _default;
19
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<CalendarWeekViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
- selectEvent: (record: LooseRecord) => any;
21
- selectSlot: (slot: CalendarSlot) => any;
22
- }, string, import("vue").PublicProps, Readonly<CalendarWeekViewProps> & Readonly<{
23
- onSelectEvent?: ((record: LooseRecord) => any) | undefined;
24
- onSelectSlot?: ((slot: CalendarSlot) => any) | undefined;
25
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
26
- event?(props: CalendarEventSlotProps): VNode[];
27
- }>;
28
- type __VLS_WithSlots<T, S> = T & {
29
- new (): {
30
- $slots: S;
19
+ declare const __VLS_export: <TRecord extends ResourceRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
20
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<CalendarWeekViewProps<TRecord> & {
21
+ onSelectEvent?: ((record: TRecord) => any) | undefined;
22
+ onSelectSlot?: ((slot: CalendarSlot) => any) | undefined;
23
+ }> & (typeof globalThis extends {
24
+ __VLS_PROPS_FALLBACK: infer P;
25
+ } ? P : {});
26
+ expose: (exposed: {}) => void;
27
+ attrs: any;
28
+ slots: {
29
+ event?(props: CalendarEventSlotProps<TRecord>): VNode[];
31
30
  };
31
+ emit: ((evt: "selectEvent", record: TRecord) => void) & ((evt: "selectSlot", slot: CalendarSlot) => void);
32
+ }>) => import("vue").VNode & {
33
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
32
34
  };
35
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
36
+ [K in keyof T]: T[K];
37
+ } : {
38
+ [K in keyof T as K]: T[K];
39
+ }) & {};
@@ -7,8 +7,12 @@ import { TableCell, TableHead } from "../../ui/table.js";
7
7
  import { ChevronDownIcon } from "../buttons/icons.js";
8
8
  import field_label_text_default from "../common/field-label-text.js";
9
9
  import { useDataTablePass } from "./data-table-context.js";
10
- import { computed, createBlock, createCommentVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, renderSlot, toDisplayString, unref, withCtx } from "vue";
10
+ import { computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, renderSlot, toDisplayString, unref, withCtx } from "vue";
11
11
  // src/components/admin/list/data-table-col.vue?vue&type=script&setup=true&lang.ts
12
+ var _hoisted_1 = {
13
+ key: 1,
14
+ class: "text-xs"
15
+ };
12
16
  var data_table_col_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
13
17
  __name: "data-table-col",
14
18
  props: {
@@ -67,7 +71,7 @@ var data_table_col_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
67
71
  key: 0,
68
72
  variant: "ghost",
69
73
  size: "sm",
70
- class: "-mx-3 h-8",
74
+ class: "-mx-2 h-8",
71
75
  "data-field": __props.source,
72
76
  onClick: onSort
73
77
  }, {
@@ -79,11 +83,10 @@ var data_table_col_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
79
83
  class: normalizeClass(primarySort.value?.order === "ASC" ? "rotate-180" : "")
80
84
  }, null, 8, ["class"])) : createCommentVNode("", true)]),
81
85
  _: 1
82
- }, 8, ["data-field"])) : (openBlock(), createBlock(field_label_text_default, {
83
- key: 1,
86
+ }, 8, ["data-field"])) : (openBlock(), createElementBlock("span", _hoisted_1, [createVNode(field_label_text_default, {
84
87
  label: __props.label,
85
88
  source: __props.source
86
- }, null, 8, ["label", "source"]))]),
89
+ }, null, 8, ["label", "source"])]))]),
87
90
  _: 1
88
91
  }, 8, ["class", "aria-sort"])) : (openBlock(), createBlock(unref(TableCell), {
89
92
  key: 1,
@@ -12,7 +12,7 @@
12
12
  * against its own outlet's provider — the standard "renderless provider wrapping
13
13
  * slot content" pattern.
14
14
  */
15
- import type { CreatePathType, Identifier, LooseRecord } from "@chelone/core";
15
+ import type { CreatePathType, Identifier, LooseRecord, ResourceRecord } from "@chelone/core";
16
16
  import { type InjectionKey, type PropType, type Ref, type VNode } from "vue";
17
17
  /** Which pass a `<DataTableCol>` is rendering in. */
18
18
  export type DataTablePass = "header" | "data";
@@ -70,19 +70,22 @@ export declare const ColumnsOutlet: import("vue").DefineComponent<import("vue").
70
70
  report: () => void;
71
71
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
72
72
  /** What a row click does: a link type, `"expand"`, `"toggleSelection"` or nothing. */
73
- export type DataTableRowClick = "edit" | "show" | "expand" | "toggleSelection" | false | ((record: LooseRecord, id: Identifier) => CreatePathType | "expand" | "toggleSelection" | false);
73
+ export type DataTableRowClick<TRecord extends ResourceRecord = LooseRecord> = "edit" | "show" | "expand" | "toggleSelection" | false | ((record: TRecord, id: Identifier) => CreatePathType | "expand" | "toggleSelection" | false);
74
74
  /**
75
75
  * Row behaviour `<DataTable>` shares with its `<DataTableRow>`s. The expanded
76
76
  * ids live in `<DataTable>` so the header's expand-all button and every row's
77
77
  * toggle act on the same state.
78
78
  */
79
- export interface DataTableRowsContext {
80
- rowClick: Ref<DataTableRowClick>;
79
+ export interface DataTableRowsContext<TRecord extends ResourceRecord = LooseRecord> {
80
+ rowClick: Ref<DataTableRowClick<TRecord>>;
81
81
  /** True when the `#expand` slot is passed. */
82
82
  expandEnabled: Ref<boolean>;
83
83
  expandedIds: Ref<Identifier[]>;
84
84
  toggleExpand: (id: Identifier) => void;
85
85
  /** Whether the record can expand (true when no `isRowExpandable` is set). */
86
- canExpand: (record: LooseRecord) => boolean;
86
+ canExpand: (record: TRecord) => boolean;
87
87
  }
88
- export declare const DataTableRowsKey: InjectionKey<DataTableRowsContext>;
88
+ /** Publish the table's row behaviour to its rows, typed at the table's record. */
89
+ export declare function provideDataTableRows<TRecord extends ResourceRecord>(context: DataTableRowsContext<TRecord>): void;
90
+ /** The ambient table's row behaviour, or `null` outside a `<DataTable>`. */
91
+ export declare function useDataTableRows<TRecord extends ResourceRecord = LooseRecord>(): DataTableRowsContext<TRecord> | null;
@@ -49,4 +49,12 @@ var ColumnsOutlet = defineComponent({
49
49
  }
50
50
  });
51
51
  var DataTableRowsKey = Symbol("chelone-data-table-rows");
52
- export { ColumnsOutlet, DataTablePassKey, DataTableRowsKey, PassProvider, useDataTablePass };
52
+ /** Publish the table's row behaviour to its rows, typed at the table's record. */
53
+ function provideDataTableRows(context) {
54
+ provide(DataTableRowsKey, context);
55
+ }
56
+ /** The ambient table's row behaviour, or `null` outside a `<DataTable>`. */
57
+ function useDataTableRows() {
58
+ return inject(DataTableRowsKey, null);
59
+ }
60
+ export { ColumnsOutlet, DataTablePassKey, PassProvider, provideDataTableRows, useDataTablePass, useDataTableRows };
@@ -12,23 +12,27 @@
12
12
  * checkbox bound to the ambient list selection (`selectedIds` / `toggleItem`);
13
13
  * toggling it stops propagation so it never triggers the row-click navigation.
14
14
  */
15
- import type { LooseRecord } from "@chelone/core";
16
- type __VLS_Props = {
17
- record: LooseRecord;
18
- hasBulkActions?: boolean;
19
- };
20
- declare const __VLS_template: () => {
21
- __VLS_Slots: {
15
+ import type { LooseRecord, ResourceRecord } from "@chelone/core";
16
+ declare const __VLS_export: <TRecord extends ResourceRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
17
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<{
18
+ record: TRecord;
19
+ hasBulkActions?: boolean;
20
+ }> & (typeof globalThis extends {
21
+ __VLS_PROPS_FALLBACK: infer P;
22
+ } ? P : {});
23
+ expose: (exposed: {}) => void;
24
+ attrs: any;
25
+ slots: {
22
26
  default?: (props: {}) => any;
23
27
  };
28
+ emit: {};
29
+ }>) => import("vue").VNode & {
30
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
24
31
  };
25
- type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
26
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
28
32
  declare const _default: typeof __VLS_export;
29
33
  export default _default;
30
- type __VLS_WithSlots<T, S> = T & {
31
- new (): {
32
- $slots: S;
33
- };
34
- };
34
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
35
+ [K in keyof T]: T[K];
36
+ } : {
37
+ [K in keyof T as K]: T[K];
38
+ }) & {};
@@ -1,15 +1,15 @@
1
1
  import { useListContext } from "../../../list/list-context.js";
2
- import { RecordContextKey } from "../../../record/record-context.js";
2
+ import { provideRecordContext } from "../../../record/record-context.js";
3
3
  import { useResourceContext } from "../../../resource-context.js";
4
4
  import { useRouterAdapterOptional } from "../../../router/adapter.js";
5
5
  import { useCreatePath } from "../../../router/nav-composables.js";
6
6
  import button_default from "../../ui/button.js";
7
7
  import checkbox_default from "../../ui/checkbox.js";
8
8
  import { TableCell, TableRow } from "../../ui/table.js";
9
- import { DataTablePassKey, DataTableRowsKey } from "./data-table-context.js";
9
+ import { DataTablePassKey, useDataTableRows } from "./data-table-context.js";
10
10
  import { ChevronDownIcon } from "../buttons/icons.js";
11
11
  import { ChevronRightIcon } from "./list-icons.js";
12
- import { computed, createBlock, createCommentVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, provide, ref, renderSlot, unref, watch, withCtx, withModifiers } from "vue";
12
+ import { computed, createBlock, createCommentVNode, createVNode, defineComponent, normalizeClass, openBlock, provide, renderSlot, unref, withCtx, withModifiers } from "vue";
13
13
  // src/components/admin/list/data-table-row.vue?vue&type=script&setup=true&lang.ts
14
14
  var data_table_row_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
15
15
  __name: "data-table-row",
@@ -33,11 +33,7 @@ var data_table_row_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
33
33
  * toggling it stops propagation so it never triggers the row-click navigation.
34
34
  */
35
35
  const props = __props;
36
- const recordRef = ref(props.record);
37
- watch(() => props.record, (next) => {
38
- recordRef.value = next;
39
- });
40
- provide(RecordContextKey, recordRef);
36
+ provideRecordContext(computed(() => props.record));
41
37
  provide(DataTablePassKey, "data");
42
38
  const list = useListContext();
43
39
  const recordId = computed(() => props.record.id);
@@ -50,7 +46,7 @@ var data_table_row_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
50
46
  const resource = useResourceContext();
51
47
  const navigate = adapter?.useNavigate();
52
48
  const createPath = adapter ? useCreatePath() : void 0;
53
- const rows = inject(DataTableRowsKey, null);
49
+ const rows = useDataTableRows();
54
50
  const link = computed(() => {
55
51
  const rowClick = rows?.rowClick.value ?? "edit";
56
52
  return typeof rowClick === "function" ? rowClick(props.record, recordId.value) : rowClick;
@@ -1,7 +1,13 @@
1
- import type { Identifier, LooseRecord } from "@chelone/core";
1
+ import { type VNode } from "vue";
2
+ import type { Identifier, LooseRecord, ResourceRecord } from "@chelone/core";
2
3
  import type { DataTableRowClick } from "./data-table-context.js";
3
- /** Props for {@link DataTable}. */
4
- export interface DataTableProps {
4
+ /**
5
+ * Props for {@link DataTable}. A caller of `h()` with loosely typed callbacks
6
+ * writes `h(DataTable<LooseRecord>, ...)`: `h()` resolves a generic component
7
+ * to its constraint, `ResourceRecord`, which refuses a `(record: LooseRecord)`
8
+ * callback.
9
+ */
10
+ export interface DataTableProps<TRecord extends ResourceRecord = LooseRecord> {
5
11
  class?: string;
6
12
  /** Enable row selection + the bulk-actions toolbar (also on if a `#bulkActions` slot is passed). */
7
13
  bulkActions?: boolean;
@@ -12,13 +18,13 @@ export interface DataTableProps {
12
18
  * `"toggleSelection"`, `false` (inert), or a function of `(record, id)`
13
19
  * returning one of those or any other link type (`false` = do nothing).
14
20
  */
15
- rowClick?: DataTableRowClick;
21
+ rowClick?: DataTableRowClick<TRecord>;
16
22
  /** Allow only one expanded row at a time (also hides the expand-all button). */
17
23
  expandSingle?: boolean;
18
24
  /** Which records can expand; a rejected row gets no toggle. All can by default. */
19
- isRowExpandable?: (record: LooseRecord) => boolean;
25
+ isRowExpandable?: (record: TRecord) => boolean;
20
26
  /** A class for a body row, computed from its record and index. */
21
- rowClass?: (record: LooseRecord, rowIndex: number) => string | false | undefined;
27
+ rowClass?: (record: TRecord, rowIndex: number) => string | false | undefined;
22
28
  /**
23
29
  * The store key of the hidden column ids; the order and the published
24
30
  * columns are kept under keys derived from it. Defaults to
@@ -30,22 +36,28 @@ export interface DataTableProps {
30
36
  }
31
37
  declare const _default: typeof __VLS_export;
32
38
  export default _default;
33
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DataTableProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DataTableProps> & Readonly<{}>, {
34
- pagination: boolean;
35
- bulkActions: boolean;
36
- rowClick: DataTableRowClick;
37
- expandSingle: boolean;
38
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
39
- expand?: (props: {
40
- id: Identifier;
41
- record: LooseRecord;
42
- resource: string;
43
- }) => any;
44
- } & {
45
- bulkActions?: (props: {}) => any;
46
- }>;
47
- type __VLS_WithSlots<T, S> = T & {
48
- new (): {
49
- $slots: S;
39
+ declare const __VLS_export: <TRecord extends ResourceRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
40
+ props: import("vue").PublicProps & __VLS_PrettifyLocal<DataTableProps<TRecord>> & (typeof globalThis extends {
41
+ __VLS_PROPS_FALLBACK: infer P;
42
+ } ? P : {});
43
+ expose: (exposed: {}) => void;
44
+ attrs: any;
45
+ slots: {
46
+ default?: () => VNode[];
47
+ /** Under an expanded row, given the row's record. */
48
+ expand?: (props: {
49
+ id: Identifier;
50
+ record: TRecord;
51
+ resource: string;
52
+ }) => VNode[];
53
+ bulkActions?: () => VNode[];
50
54
  };
55
+ emit: {};
56
+ }>) => import("vue").VNode & {
57
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
51
58
  };
59
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
60
+ [K in keyof T]: T[K];
61
+ } : {
62
+ [K in keyof T as K]: T[K];
63
+ }) & {};
@@ -6,11 +6,11 @@ import checkbox_default from "../../ui/checkbox.js";
6
6
  import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../ui/table.js";
7
7
  import bulk_actions_toolbar_default from "./bulk-actions-toolbar.js";
8
8
  import button_default from "../../ui/button.js";
9
- import { ColumnsOutlet, DataTableRowsKey, PassProvider } from "./data-table-context.js";
9
+ import { ColumnsOutlet, PassProvider, provideDataTableRows } from "./data-table-context.js";
10
10
  import data_table_row_default from "./data-table-row.js";
11
11
  import { ChevronsUpDownIcon } from "./list-icons.js";
12
12
  import list_pagination_default from "./list-pagination.js";
13
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, provide, ref, renderList, renderSlot, unref, useSlots, withCtx, withModifiers } from "vue";
13
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, renderList, renderSlot, unref, useSlots, withCtx, withModifiers } from "vue";
14
14
  import { arrangeColumns, defaultDataTableStoreKey, getDataTableColumnId } from "@chelone/core";
15
15
  // src/components/admin/list/data-table.vue?vue&type=script&setup=true&lang.ts
16
16
  var data_table_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
@@ -72,7 +72,7 @@ var data_table_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
72
72
  if (expandedIds.value.includes(id)) expandedIds.value = expandedIds.value.filter((x) => x !== id);
73
73
  else expandedIds.value = props.expandSingle ? [id] : [...expandedIds.value, id];
74
74
  }
75
- provide(DataTableRowsKey, {
75
+ provideDataTableRows({
76
76
  rowClick: computed(() => props.rowClick),
77
77
  expandEnabled,
78
78
  expandedIds,
@@ -225,10 +225,7 @@ var data_table_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
225
225
  })]),
226
226
  _: 3
227
227
  }),
228
- __props.pagination ? (openBlock(), createBlock(list_pagination_default, {
229
- key: 0,
230
- class: "mt-2"
231
- })) : createCommentVNode("", true),
228
+ __props.pagination ? (openBlock(), createBlock(list_pagination_default, { key: 0 })) : createCommentVNode("", true),
232
229
  hasBulkActions.value ? (openBlock(), createBlock(bulk_actions_toolbar_default, { key: 1 }, {
233
230
  default: withCtx(() => [renderSlot(_ctx.$slots, "bulkActions")]),
234
231
  _: 3
@@ -7,7 +7,7 @@ import { ChevronLeftIcon, ChevronRightIcon } from "./list-icons.js";
7
7
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, toDisplayString, unref, watch, withCtx } from "vue";
8
8
  // src/components/admin/list/list-pagination.vue?vue&type=script&setup=true&lang.ts
9
9
  var _hoisted_1 = { class: "hidden md:flex items-center gap-x-2" };
10
- var _hoisted_2 = { class: "text-sm font-medium" };
10
+ var _hoisted_2 = { class: "text-sm font-medium whitespace-nowrap" };
11
11
  var _hoisted_3 = {
12
12
  class: "text-sm text-muted-foreground",
13
13
  "data-slot": "page-range"
@@ -125,7 +125,7 @@ var list_pagination_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
125
125
  return (_ctx, _cache) => {
126
126
  return !hidden.value ? (openBlock(), createElementBlock("div", {
127
127
  key: 0,
128
- class: normalizeClass(unref(cn)("flex items-center justify-end gap-x-2 gap-4", props.class)),
128
+ class: normalizeClass(unref(cn)("mt-2 flex items-center justify-end gap-x-2 gap-4", props.class)),
129
129
  "data-slot": "list-pagination"
130
130
  }, [
131
131
  createElementVNode("div", _hoisted_1, [createElementVNode("p", _hoisted_2, toDisplayString(rowsPerPageLabel.value), 1), createVNode(native_select_default, {