@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.
- package/dist/admin/admin.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/admin/auth-gate.js +1 -3
- package/dist/admin/resource-view.d.ts +8 -0
- package/dist/admin/resource-view.js +19 -0
- package/dist/auth/permissions-hooks.js +1 -3
- package/dist/choices/choices-context.d.ts +1 -2
- package/dist/choices/use-choices.d.ts +3 -3
- package/dist/choices/use-choices.js +13 -10
- package/dist/choices/use-reference-input.js +4 -4
- package/dist/components/admin/auth/auth-error.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/components/admin/auth/auth-layout.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/auth/can-access.vue.d.ts +2 -2
- package/dist/components/admin/auth/login-form.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/admin/auth/login-with-email.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/components/admin/buttons/bulk-update-button.vue.d.ts +19 -6
- package/dist/components/admin/buttons/bulk-update-button.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/buttons/clone-button.vue.d.ts +19 -16
- package/dist/components/admin/buttons/clone-button.vue_vue_type_script_setup_true_lang.js +4 -5
- package/dist/components/admin/buttons/delete-button.vue.d.ts +19 -10
- package/dist/components/admin/buttons/delete-button.vue_vue_type_script_setup_true_lang.js +6 -7
- package/dist/components/admin/buttons/dual-approval-button.vue_vue_type_script_setup_true_lang.js +14 -2
- package/dist/components/admin/buttons/edit-button.vue.d.ts +19 -16
- package/dist/components/admin/buttons/edit-button.vue_vue_type_script_setup_true_lang.js +4 -5
- package/dist/components/admin/buttons/export-button.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/admin/buttons/fields-selector.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/components/admin/buttons/filter-button.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/buttons/record-button-props.d.ts +12 -0
- package/dist/components/admin/buttons/show-button.vue.d.ts +19 -16
- package/dist/components/admin/buttons/show-button.vue_vue_type_script_setup_true_lang.js +4 -5
- package/dist/components/admin/buttons/status-transition-button.vue_vue_type_script_setup_true_lang.js +3 -7
- package/dist/components/admin/buttons/update-button.vue.d.ts +28 -24
- package/dist/components/admin/buttons/update-button.vue_vue_type_script_setup_true_lang.js +3 -4
- package/dist/components/admin/common/application-updated-notification.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/common/i18n-key-editor.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/components/admin/csv-import/csv-import.vue_vue_type_script_setup_true_lang.js +2 -5
- package/dist/components/admin/feedback/error.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/feedback/linear-progress.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/components/admin/feedback/loading.vue_vue_type_script_setup_true_lang.js +7 -6
- package/dist/components/admin/feedback/placeholder.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/components/admin/fields/api-key-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/api-key-field.vue_vue_type_script_setup_true_lang.js +6 -7
- package/dist/components/admin/fields/array-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/badge-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/boolean-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/chip-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/color-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/cron-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/currency-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/date-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/diff-viewer.vue.d.ts +3 -3
- package/dist/components/admin/fields/duration-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/email-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/field-props.d.ts +2 -2
- package/dist/components/admin/fields/file-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/function-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/image-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/json-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/number-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/phone-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/phone-field.vue_vue_type_script_setup_true_lang.js +3 -1
- package/dist/components/admin/fields/rating-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/rating-field.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/components/admin/fields/record-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/reference-array-field.vue.d.ts +20 -10
- package/dist/components/admin/fields/reference-field.vue.d.ts +22 -35
- package/dist/components/admin/fields/reference-many-count.vue.d.ts +20 -5
- package/dist/components/admin/fields/reference-many-field.vue.d.ts +20 -12
- package/dist/components/admin/fields/reference-one-field.vue.d.ts +22 -12
- package/dist/components/admin/fields/select-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/subscription-plan-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/text-array-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/text-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/url-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/usage-meter-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/usage-meter-field.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/components/admin/fields/webhook-endpoint-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/webhook-endpoint-field.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/fields/wrapper-field.vue.d.ts +21 -11
- package/dist/components/admin/inputs/api-key-input.vue.d.ts +20 -5
- package/dist/components/admin/inputs/api-key-input.vue_vue_type_script_setup_true_lang.js +3 -4
- package/dist/components/admin/inputs/array-input-row.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/inputs/checkbox-group-input.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/inputs/date-input-format.d.ts +4 -1
- package/dist/components/admin/inputs/date-input-format.js +10 -1
- package/dist/components/admin/inputs/date-input.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/admin/inputs/date-time-input.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/admin/inputs/duration-input.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/inputs/image-input-thumbnail.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/components/admin/inputs/image-input.vue.d.ts +1 -0
- package/dist/components/admin/inputs/image-input.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/components/admin/inputs/in-place-editor-form.vue.d.ts +3 -3
- package/dist/components/admin/inputs/in-place-editor-form.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/inputs/in-place-editor.vue.d.ts +3 -3
- package/dist/components/admin/inputs/number-input.vue.d.ts +6 -0
- package/dist/components/admin/inputs/number-input.vue_vue_type_script_setup_true_lang.js +9 -0
- package/dist/components/admin/inputs/password-input.vue_vue_type_script_setup_true_lang.js +34 -30
- package/dist/components/admin/inputs/phone-input.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/inputs/radio-button-group-input.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/inputs/rating-input.vue_vue_type_script_setup_true_lang.js +24 -12
- package/dist/components/admin/inputs/reference-input.vue.d.ts +1 -1
- package/dist/components/admin/inputs/reference-input.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/admin/inputs/resettable-text-input.vue.d.ts +6 -4
- package/dist/components/admin/inputs/resettable-text-input.vue_vue_type_script_setup_true_lang.js +44 -39
- package/dist/components/admin/inputs/subscription-plan-picker.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/admin/inputs/text-input.vue.d.ts +13 -2
- package/dist/components/admin/inputs/text-input.vue_vue_type_script_setup_true_lang.js +9 -4
- package/dist/components/admin/inputs/time-input.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/admin/inputs/use-choice-input.d.ts +2 -2
- package/dist/components/admin/layout/app-sidebar.vue.d.ts +12 -1
- package/dist/components/admin/layout/app-sidebar.vue_vue_type_script_setup_true_lang.js +15 -11
- package/dist/components/admin/layout/command-menu-content.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/layout/command-menu.vue.d.ts +1 -1
- package/dist/components/admin/layout/command-menu.vue_vue_type_script_setup_true_lang.js +9 -63
- package/dist/components/admin/layout/data-provider-devtools-entry.vue.d.ts +1 -1
- package/dist/components/admin/layout/data-provider-devtools-entry.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/admin/layout/data-provider-devtools.vue_vue_type_script_setup_true_lang.js +62 -28
- package/dist/components/admin/layout/icons.d.ts +2 -0
- package/dist/components/admin/layout/icons.js +3 -1
- package/dist/components/admin/layout/layout.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/layout/menu-item-link.vue.d.ts +5 -0
- package/dist/components/admin/layout/menu-item-link.vue_vue_type_script_setup_true_lang.js +27 -8
- package/dist/components/admin/layout/onboarding-tour-overlay.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/components/admin/layout/resource-menu-item-group.vue.d.ts +8 -1
- package/dist/components/admin/layout/resource-menu-item-group.vue_vue_type_script_setup_true_lang.js +8 -7
- package/dist/components/admin/layout/theme-provider.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/admin/layout/title-portal-id.d.ts +1 -1
- package/dist/components/admin/layout/title-portal-id.js +1 -9
- package/dist/components/admin/layout/top-toolbar.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/components/admin/list/approval-queue-row.vue.d.ts +2 -2
- package/dist/components/admin/list/approval-queue-row.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/admin/list/approval-queue.vue.d.ts +3 -3
- package/dist/components/admin/list/calendar-agenda-view.vue.d.ts +23 -15
- package/dist/components/admin/list/calendar-event.vue.d.ts +21 -8
- package/dist/components/admin/list/calendar-list.vue.d.ts +29 -56
- package/dist/components/admin/list/calendar-list.vue_vue_type_script_setup_true_lang.js +12 -8
- package/dist/components/admin/list/calendar-month-view.vue.d.ts +26 -20
- package/dist/components/admin/list/calendar-month-view.vue_vue_type_script_setup_true_lang.js +2 -6
- package/dist/components/admin/list/calendar-week-view.vue.d.ts +24 -17
- package/dist/components/admin/list/data-table-col.vue_vue_type_script_setup_true_lang.js +8 -5
- package/dist/components/admin/list/data-table-context.d.ts +9 -6
- package/dist/components/admin/list/data-table-context.js +9 -1
- package/dist/components/admin/list/data-table-row.vue.d.ts +19 -15
- package/dist/components/admin/list/data-table-row.vue_vue_type_script_setup_true_lang.js +5 -9
- package/dist/components/admin/list/data-table.vue.d.ts +35 -23
- package/dist/components/admin/list/data-table.vue_vue_type_script_setup_true_lang.js +4 -7
- package/dist/components/admin/list/list-pagination.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/admin/list/pivot-grid.vue.d.ts +3 -3
- package/dist/components/admin/list/record-timeline.vue.d.ts +3 -3
- package/dist/components/admin/list/record-timeline.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/list/simple-list-item.vue.d.ts +21 -19
- package/dist/components/admin/list/simple-list-item.vue_vue_type_script_setup_true_lang.js +3 -7
- package/dist/components/admin/list/simple-list.vue.d.ts +28 -20
- package/dist/components/admin/list/single-field-list-record.vue.d.ts +19 -9
- package/dist/components/admin/list/single-field-list.vue.d.ts +21 -11
- package/dist/components/admin/list/tree-list-context.d.ts +11 -6
- package/dist/components/admin/list/tree-list-node.vue.d.ts +19 -4
- package/dist/components/admin/list/tree-list.vue.d.ts +28 -37
- package/dist/components/admin/realtime/comments-thread.vue_vue_type_script_setup_true_lang.js +56 -44
- package/dist/components/admin/realtime/menu-live.vue.d.ts +3 -1
- package/dist/components/admin/realtime/menu-live.vue_vue_type_script_setup_true_lang.js +42 -12
- package/dist/components/admin/supabase/forgot-password-form.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/components/admin/supabase/set-password-form.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/components/admin/supabase/use-password-recovery.js +11 -1
- package/dist/components/admin/view/create.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/view/edit.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/view/show.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/admin/widgets/job-monitor-row.vue.d.ts +24 -11
- package/dist/components/admin/widgets/job-monitor.vue.d.ts +3 -3
- package/dist/components/admin/widgets/job-monitor.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/block-editor/block-doc-field.vue.d.ts +3 -3
- package/dist/components/block-editor/block-drag-handle.vue_vue_type_script_setup_true_lang.js +3 -4
- package/dist/components/block-editor/image-block-config.vue_vue_type_script_setup_true_lang.js +2 -3
- package/dist/components/charts/bar-chart.vue.d.ts +6 -2
- package/dist/components/charts/bar-chart.vue_vue_type_script_setup_true_lang.js +6 -4
- package/dist/components/charts/series-chart.d.ts +1 -1
- package/dist/components/charts/series-chart.js +9 -3
- package/dist/components/index.js +2 -2
- package/dist/components/inspector/configurable.vue.d.ts +0 -21
- package/dist/components/inspector/configurable.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/inspector/inspector.vue_vue_type_script_setup_true_lang.js +6 -8
- package/dist/components/kanban/kanban-board.vue.d.ts +3 -3
- package/dist/components/kanban/kanban-board.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/components/maps/bbox-field.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/maps/geo-json-field.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/maps/geo-json-layers.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/maps/geo-json-view.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/maps/lat-lng-field.vue_vue_type_script_setup_true_lang.js +4 -3
- package/dist/components/maps/lat-lng-input.vue_vue_type_script_setup_true_lang.js +5 -7
- package/dist/components/maps/map-canvas.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/components/maps/use-map.js +1 -3
- package/dist/components/maps-draw/shape-input.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/components/maps-draw/simplify-input.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/maps-osm/geocoding-input.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/maps-osm/map-with-search.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/components/mdx-editor/mdx-editor-theme.css +47 -0
- package/dist/components/mdx-editor/mdx-field.vue.d.ts +21 -11
- package/dist/components/mdx-editor/mdx-input.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/components/monaco/internal/use-json-schema.js +1 -2
- package/dist/components/monaco/internal/use-monaco-markers.d.ts +0 -6
- package/dist/components/monaco/internal/use-monaco-markers.js +4 -2
- package/dist/components/monaco/monaco-json-field-lazy.vue.d.ts +2 -2
- package/dist/components/monaco/monaco-json-field-lazy.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/monaco/monaco-json-field.vue.d.ts +3 -3
- package/dist/components/monaco/monaco-json-input-lazy.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/components/rich-text-input/rich-text-field.vue.d.ts +3 -3
- package/dist/components/ui/avatar.js +1 -1
- package/dist/components/ui/badge.js +4 -4
- package/dist/components/ui/button-variants.js +1 -1
- package/dist/components/ui/chart/chart-container.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/ui/checkbox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/ui/command/command-dialog.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/ui/sidebar/sidebar-menu-button.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/ui/sidebar/sidebar-parts.js +2 -2
- package/dist/components/ui/sidebar/sidebar.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/controllers/use-controller-for-id.d.ts +2 -2
- package/dist/controllers/use-prev-next-controller.d.ts +2 -2
- package/dist/controllers/use-reference-many-field-controller.d.ts +4 -4
- package/dist/controllers/use-reference-one-field-controller.d.ts +4 -4
- package/dist/create-resource-components.d.ts +225 -117
- package/dist/data/undoable.js +2 -2
- package/dist/form/use-form.d.ts +5 -3
- package/dist/form/use-form.js +1 -1
- package/dist/form/use-input.d.ts +0 -2
- package/dist/form/use-input.js +1 -2
- package/dist/index.js +2 -2
- package/dist/resource-context.d.ts +5 -1
- package/dist/resource-context.js +4 -0
- package/dist/router/use-get-path-for-record.d.ts +3 -3
- 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:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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 ??
|
|
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
|
|
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
|
-
})
|
|
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<
|
|
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<
|
|
28
|
+
events: CalendarEvent<TRecord>[];
|
|
29
29
|
/** The link an event is, when it navigates. */
|
|
30
|
-
hrefFor: (record:
|
|
30
|
+
hrefFor: (record: TRecord) => string | undefined;
|
|
31
31
|
/** Whether activating the event does anything: it is inert otherwise. */
|
|
32
|
-
isSelectable: (record:
|
|
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:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
+
}) & {};
|
package/dist/components/admin/list/calendar-month-view.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -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<
|
|
11
|
+
events: CalendarEvent<TRecord>[];
|
|
12
12
|
/** The link an event is, when it navigates. */
|
|
13
|
-
hrefFor: (record:
|
|
13
|
+
hrefFor: (record: TRecord) => string | undefined;
|
|
14
14
|
/** Whether activating the event does anything: it is inert otherwise. */
|
|
15
|
-
isSelectable: (record:
|
|
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:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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-
|
|
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(),
|
|
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:
|
|
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:
|
|
86
|
+
canExpand: (record: TRecord) => boolean;
|
|
87
87
|
}
|
|
88
|
-
|
|
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
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
31
|
-
|
|
32
|
-
|
|
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 {
|
|
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,
|
|
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,
|
|
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
|
-
|
|
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 =
|
|
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
|
|
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
|
-
/**
|
|
4
|
-
|
|
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:
|
|
25
|
+
isRowExpandable?: (record: TRecord) => boolean;
|
|
20
26
|
/** A class for a body row, computed from its record and index. */
|
|
21
|
-
rowClass?: (record:
|
|
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:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
record
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
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,
|
|
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,
|
|
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
|
-
|
|
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, {
|