@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
|
@@ -2,6 +2,7 @@ import { BasenameKey } from "../router/adapter.js";
|
|
|
2
2
|
import admin_shell_default from "./admin-shell.js";
|
|
3
3
|
import { provideCheloneContext } from "../context.js";
|
|
4
4
|
import { toRouteRecord } from "./custom-routes.js";
|
|
5
|
+
import { resourceView } from "./resource-view.js";
|
|
5
6
|
import { createSlotRoutes } from "./slot-routes.js";
|
|
6
7
|
import { provideVueRouterAdapter } from "../router/vue-router-adapter.js";
|
|
7
8
|
import { provideHasDashboard } from "./has-dashboard.js";
|
|
@@ -93,22 +94,22 @@ var admin_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
|
|
|
93
94
|
if (definition.create) removers.push(router.addRoute({
|
|
94
95
|
path: joinBasename(`/${name}/create/:pathMatch(.*)*`, basename),
|
|
95
96
|
name: `chelone-${name}-create`,
|
|
96
|
-
component: definition.create
|
|
97
|
+
component: resourceView(name, definition.create)
|
|
97
98
|
}));
|
|
98
99
|
if (definition.show) removers.push(router.addRoute({
|
|
99
100
|
path: joinBasename(`/${name}/:id/show/:pathMatch(.*)*`, basename),
|
|
100
101
|
name: `chelone-${name}-show`,
|
|
101
|
-
component: definition.show
|
|
102
|
+
component: resourceView(name, definition.show)
|
|
102
103
|
}));
|
|
103
104
|
if (definition.edit) removers.push(router.addRoute({
|
|
104
105
|
path: joinBasename(`/${name}/:id/:pathMatch(.*)*`, basename),
|
|
105
106
|
name: `chelone-${name}-edit`,
|
|
106
|
-
component: definition.edit
|
|
107
|
+
component: resourceView(name, definition.edit)
|
|
107
108
|
}));
|
|
108
109
|
if (definition.list) removers.push(router.addRoute({
|
|
109
110
|
path: joinBasename(`/${name}`, basename),
|
|
110
111
|
name: `chelone-${name}-list`,
|
|
111
|
-
component: definition.list
|
|
112
|
+
component: resourceView(name, definition.list)
|
|
112
113
|
}));
|
|
113
114
|
return removers;
|
|
114
115
|
}
|
package/dist/admin/auth-gate.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCheloneContext } from "../context.js";
|
|
2
2
|
import { useLocation, useRedirect } from "../router/nav-composables.js";
|
|
3
3
|
import { computed, watch } from "vue";
|
|
4
|
-
import { authStateQueryOptions } from "@chelone/core";
|
|
4
|
+
import { NEXT_PATHNAME_KEY, authStateQueryOptions } from "@chelone/core";
|
|
5
5
|
import { useQuery } from "@tanstack/vue-query";
|
|
6
6
|
// src/admin/auth-gate.ts
|
|
7
7
|
/**
|
|
@@ -74,8 +74,6 @@ function useAuthenticated(options = {}) {
|
|
|
74
74
|
}, { immediate: true });
|
|
75
75
|
return gate;
|
|
76
76
|
}
|
|
77
|
-
/** The Store key the login flow stashes the post-login target under. */
|
|
78
|
-
var NEXT_PATHNAME_KEY = "nextPathname";
|
|
79
77
|
/**
|
|
80
78
|
* Resolve an OAuth auth-callback redirect. On mount, call the provider's
|
|
81
79
|
* `handleCallback`; on success, redirect to the FIRST available of:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Component } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* A resource's view as its route renders it: the view itself, with `name`
|
|
4
|
+
* provided as the ambient resource, so a view that is given no `resource`
|
|
5
|
+
* prop, such as a guesser, reads it from context. The React `<Resource>` does
|
|
6
|
+
* the same around its views.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resourceView(name: string, view: Component): Component;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { provideResourceContext } from "../resource-context.js";
|
|
2
|
+
import { defineComponent, h, markRaw } from "vue";
|
|
3
|
+
// src/admin/resource-view.ts
|
|
4
|
+
/**
|
|
5
|
+
* A resource's view as its route renders it: the view itself, with `name`
|
|
6
|
+
* provided as the ambient resource, so a view that is given no `resource`
|
|
7
|
+
* prop, such as a guesser, reads it from context. The React `<Resource>` does
|
|
8
|
+
* the same around its views.
|
|
9
|
+
*/
|
|
10
|
+
function resourceView(name, view) {
|
|
11
|
+
return markRaw(defineComponent({
|
|
12
|
+
inheritAttrs: false,
|
|
13
|
+
setup(_props, { attrs, slots }) {
|
|
14
|
+
provideResourceContext(name);
|
|
15
|
+
return () => h(view, attrs, slots);
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
export { resourceView };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCheloneContext } from "../context.js";
|
|
2
2
|
import { useRedirectOptional } from "../router/nav-composables.js";
|
|
3
3
|
import { computed, onScopeDispose } from "vue";
|
|
4
|
-
import { checkError, permissionsQueryOptions } from "@chelone/core";
|
|
4
|
+
import { DEFAULT_LOGIN_PATH, checkError, permissionsQueryOptions } from "@chelone/core";
|
|
5
5
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/vue-query";
|
|
6
6
|
// src/auth/permissions-hooks.ts
|
|
7
7
|
/**
|
|
@@ -48,8 +48,6 @@ function usePermissions(params, options = {}) {
|
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
/** The default path a logged-out session is redirected to. */
|
|
52
|
-
var DEFAULT_LOGIN_PATH = "/login";
|
|
53
51
|
/**
|
|
54
52
|
* Module-level debounce (mirrors ra-core + the React twin): side-effects fire at
|
|
55
53
|
* most once per tick, so a burst of simultaneously-erroring queries does not
|
|
@@ -14,9 +14,8 @@
|
|
|
14
14
|
* so a plain property read tracks the controller store — Vue's answer to React
|
|
15
15
|
* re-deriving the object each render. The inline context is a frozen plain object.
|
|
16
16
|
*/
|
|
17
|
-
import type { FilterPayload, SortPayload } from "@chelone/core";
|
|
17
|
+
import type { ChoiceRecord, FilterPayload, SortPayload } from "@chelone/core";
|
|
18
18
|
import { type InjectionKey } from "vue";
|
|
19
|
-
import type { ChoiceRecord } from "./use-choices.js";
|
|
20
19
|
/**
|
|
21
20
|
* The choices context every choice input consumes. A reference context fills the
|
|
22
21
|
* data fields through getters (reactive); an inline context is static. The
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
* comes from the ambient i18n via {@link useTranslate}, so `useChoices` must be
|
|
14
14
|
* called in `setup`.
|
|
15
15
|
*/
|
|
16
|
-
import { type ChoiceValueOf, type SourcePath } from "@chelone/core";
|
|
17
|
-
/** An erased choice record — choices carry arbitrary shapes (`{id, name, ...}`). */
|
|
18
|
-
export type ChoiceRecord
|
|
16
|
+
import { type ChoiceRecord, type ChoiceValueOf, type SourcePath } from "@chelone/core";
|
|
17
|
+
/** An erased choice record — choices carry arbitrary shapes (`{id, name, ...}`). Core owns the type; both adapters re-export it. */
|
|
18
|
+
export type { ChoiceRecord };
|
|
19
19
|
/** The display path (dot or bracket) or a formatter over the whole choice. */
|
|
20
20
|
export type OptionText<TChoice extends ChoiceRecord = ChoiceRecord> = SourcePath<TChoice> | ((choice: TChoice) => string);
|
|
21
21
|
export interface UseChoicesOptions<TChoice extends ChoiceRecord = ChoiceRecord> {
|
|
@@ -35,22 +35,25 @@ function getChoicePath(record, path) {
|
|
|
35
35
|
*/
|
|
36
36
|
function useChoices(options = {}) {
|
|
37
37
|
const translate = useTranslate();
|
|
38
|
-
const
|
|
38
|
+
const optionText = () => options.optionText ?? "name";
|
|
39
|
+
const optionValue = () => options.optionValue ?? "id";
|
|
40
|
+
const disableValue = () => options.disableValue ?? "disabled";
|
|
41
|
+
const translateChoice = () => options.translateChoice ?? true;
|
|
39
42
|
return {
|
|
40
43
|
getChoiceText(choice) {
|
|
41
|
-
const
|
|
42
|
-
if (typeof
|
|
43
|
-
const raw = getChoicePath(choice,
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
const translated = translate(
|
|
47
|
-
return translated ===
|
|
44
|
+
const text = optionText();
|
|
45
|
+
if (typeof text === "function") return text(choice);
|
|
46
|
+
const raw = getChoicePath(choice, text);
|
|
47
|
+
const label = textOf(raw);
|
|
48
|
+
if (!translateChoice()) return label;
|
|
49
|
+
const translated = translate(label, { _: label });
|
|
50
|
+
return translated === label ? label : translated;
|
|
48
51
|
},
|
|
49
52
|
getChoiceValue(choice) {
|
|
50
|
-
return resolveChoiceValue(choice, getChoicePath(choice,
|
|
53
|
+
return resolveChoiceValue(choice, getChoicePath(choice, optionValue()));
|
|
51
54
|
},
|
|
52
55
|
getDisableValue(choice) {
|
|
53
|
-
return getChoicePath(choice,
|
|
56
|
+
return getChoicePath(choice, disableValue()) === true;
|
|
54
57
|
}
|
|
55
58
|
};
|
|
56
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCheloneContext } from "../context.js";
|
|
2
2
|
import { useMicroStore } from "../store/use-micro-store.js";
|
|
3
|
-
import { createChoicesController } from "@chelone/core";
|
|
3
|
+
import { choiceListsOf, createChoicesController } from "@chelone/core";
|
|
4
4
|
// src/choices/use-reference-input.ts
|
|
5
5
|
/** Structurally the choices-controller context (data services + i18n). */
|
|
6
6
|
function toChoicesContext(ctx) {
|
|
@@ -27,13 +27,13 @@ function useReferenceInput(options) {
|
|
|
27
27
|
const state = useMicroStore(controller);
|
|
28
28
|
return {
|
|
29
29
|
get allChoices() {
|
|
30
|
-
return state.value.allChoices;
|
|
30
|
+
return choiceListsOf(state.value).allChoices;
|
|
31
31
|
},
|
|
32
32
|
get availableChoices() {
|
|
33
|
-
return state.value.availableChoices;
|
|
33
|
+
return choiceListsOf(state.value).availableChoices;
|
|
34
34
|
},
|
|
35
35
|
get selectedChoices() {
|
|
36
|
-
return state.value.selectedChoices;
|
|
36
|
+
return choiceListsOf(state.value).selectedChoices;
|
|
37
37
|
},
|
|
38
38
|
get total() {
|
|
39
39
|
return state.value.total;
|
|
@@ -3,6 +3,7 @@ import { cn } from "../../../lib/utils.js";
|
|
|
3
3
|
import { buttonVariants } from "../../ui/button-variants.js";
|
|
4
4
|
import { CircleAlertIcon, LockIcon } from "./icons.js";
|
|
5
5
|
import { computed, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
6
|
+
import { DEFAULT_LOGIN_PATH } from "@chelone/core";
|
|
6
7
|
import { RouterLink } from "vue-router";
|
|
7
8
|
// src/components/admin/auth/auth-error.vue?vue&type=script&setup=true&lang.ts
|
|
8
9
|
var _hoisted_1 = {
|
|
@@ -38,13 +39,13 @@ var auth_error_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
38
39
|
createElementVNode("h1", _hoisted_1, [createVNode(unref(CircleAlertIcon), { class: "w-[2em] h-[2em]" }), createTextVNode(" " + toDisplayString(unref(translate)(props.title, { _: props.title })), 1)]),
|
|
39
40
|
createElementVNode("p", _hoisted_2, toDisplayString(unref(translate)(props.message, { _: props.message })), 1),
|
|
40
41
|
createVNode(unref(RouterLink), {
|
|
41
|
-
to:
|
|
42
|
+
to: unref(DEFAULT_LOGIN_PATH),
|
|
42
43
|
class: normalizeClass(linkClasses.value),
|
|
43
44
|
"data-slot": "auth-error-signin"
|
|
44
45
|
}, {
|
|
45
|
-
default: withCtx(() => [createVNode(unref(LockIcon)), createTextVNode(" " + toDisplayString(unref(translate)("ra.auth.sign_in", { _: "Sign in" })), 1)]),
|
|
46
|
+
default: withCtx(() => [createVNode(unref(LockIcon), { class: "size-4" }), createTextVNode(" " + toDisplayString(unref(translate)("ra.auth.sign_in", { _: "Sign in" })), 1)]),
|
|
46
47
|
_: 1
|
|
47
|
-
}, 8, ["class"])
|
|
48
|
+
}, 8, ["to", "class"])
|
|
48
49
|
], 2);
|
|
49
50
|
};
|
|
50
51
|
}
|
|
@@ -18,7 +18,7 @@ var _hoisted_5 = {
|
|
|
18
18
|
};
|
|
19
19
|
var _hoisted_6 = {
|
|
20
20
|
key: 1,
|
|
21
|
-
class: "text-sm leading-
|
|
21
|
+
class: "text-sm leading-normal text-muted-foreground"
|
|
22
22
|
};
|
|
23
23
|
var auth_layout_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
24
24
|
__name: "auth-layout",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* </CanAccess>
|
|
19
19
|
*/
|
|
20
20
|
import { type VNode } from "vue";
|
|
21
|
-
import type {
|
|
21
|
+
import type { ResourceRecord } from "@chelone/core";
|
|
22
22
|
/** Props for {@link CanAccess}. */
|
|
23
23
|
export interface CanAccessProps {
|
|
24
24
|
/** The action to check (`'list' | 'create' | 'edit' | 'show' | 'delete'` or custom). */
|
|
@@ -30,7 +30,7 @@ export interface CanAccessProps {
|
|
|
30
30
|
* the floor; the rest is whatever the grant's predicate reads, so a record of
|
|
31
31
|
* the caller's own shape and an inline record both fit.
|
|
32
32
|
*/
|
|
33
|
-
record?: ResourceRecord
|
|
33
|
+
record?: ResourceRecord;
|
|
34
34
|
}
|
|
35
35
|
declare const _default: typeof __VLS_export;
|
|
36
36
|
export default _default;
|
|
@@ -58,8 +58,9 @@ var login_form_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
58
58
|
email: "",
|
|
59
59
|
password: ""
|
|
60
60
|
},
|
|
61
|
-
|
|
62
|
-
resetOnSuccess: false
|
|
61
|
+
recordForm: false,
|
|
62
|
+
resetOnSuccess: false,
|
|
63
|
+
onSubmit: save
|
|
63
64
|
});
|
|
64
65
|
function handleSubmit(event) {
|
|
65
66
|
event.preventDefault();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { LooseRecord, MutationMode } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, MutationMode, ResourceRecord } from "@chelone/core";
|
|
2
2
|
/** Props for {@link BulkUpdateButton}. */
|
|
3
|
-
export interface BulkUpdateButtonProps {
|
|
3
|
+
export interface BulkUpdateButtonProps<TRecord extends ResourceRecord = LooseRecord> {
|
|
4
4
|
/** The fixed patch applied to every selected record. Default `{}`. */
|
|
5
|
-
data?: Partial<
|
|
5
|
+
data?: Partial<NoInfer<TRecord>>;
|
|
6
6
|
/** Override the ambient `<Resource>`. */
|
|
7
7
|
resource?: string;
|
|
8
8
|
/** Override the auto-translated label. */
|
|
@@ -22,6 +22,19 @@ export interface BulkUpdateButtonProps {
|
|
|
22
22
|
}
|
|
23
23
|
declare const _default: typeof __VLS_export;
|
|
24
24
|
export default _default;
|
|
25
|
-
declare const __VLS_export:
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
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<{
|
|
26
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<BulkUpdateButtonProps<TRecord>> & (typeof globalThis extends {
|
|
27
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
28
|
+
} ? P : {});
|
|
29
|
+
expose: (exposed: {}) => void;
|
|
30
|
+
attrs: any;
|
|
31
|
+
slots: {};
|
|
32
|
+
emit: {};
|
|
33
|
+
}>) => import("vue").VNode & {
|
|
34
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
35
|
+
};
|
|
36
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
37
|
+
[K in keyof T]: T[K];
|
|
38
|
+
} : {
|
|
39
|
+
[K in keyof T as K]: T[K];
|
|
40
|
+
}) & {};
|
package/dist/components/admin/buttons/bulk-update-button.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -49,7 +49,7 @@ var bulk_update_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__
|
|
|
49
49
|
const list = useListContext();
|
|
50
50
|
const updateMany = useUpdateMany(resource);
|
|
51
51
|
const isPending = computed(() => updateMany.isPending.value);
|
|
52
|
-
const label = computed(() => translate("ra.action.update", { _:
|
|
52
|
+
const label = computed(() => props.label ? translate(props.label, { _: props.label }) : translate("ra.action.update", { _: "Update" }));
|
|
53
53
|
async function onClick(event) {
|
|
54
54
|
event.stopPropagation();
|
|
55
55
|
const ids = list.selectedIds ?? [];
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, ResourceRecord } from "@chelone/core";
|
|
2
|
+
import type { RecordLinkButtonProps } from "./record-button-props.js";
|
|
2
3
|
/** Props for {@link CloneButton}. */
|
|
3
|
-
export interface CloneButtonProps {
|
|
4
|
-
/** Override the ambient record. */
|
|
5
|
-
record?: LooseRecord;
|
|
6
|
-
/** Override the ambient `<Resource>`. */
|
|
7
|
-
resource?: string;
|
|
8
|
-
/** Override the auto-translated label. */
|
|
9
|
-
label?: string;
|
|
10
|
-
/** Extra CSS class appended to the anchor. */
|
|
11
|
-
class?: string;
|
|
4
|
+
export interface CloneButtonProps<TRecord extends ResourceRecord = LooseRecord> extends RecordLinkButtonProps<TRecord> {
|
|
12
5
|
}
|
|
13
6
|
declare const _default: typeof __VLS_export;
|
|
14
7
|
export default _default;
|
|
15
|
-
declare const __VLS_export:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
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<{
|
|
9
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<CloneButtonProps<TRecord>> & (typeof globalThis extends {
|
|
10
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
11
|
+
} ? P : {});
|
|
12
|
+
expose: (exposed: {}) => void;
|
|
13
|
+
attrs: any;
|
|
14
|
+
slots: {
|
|
15
|
+
icon?: (props: {}) => any;
|
|
21
16
|
};
|
|
17
|
+
emit: {};
|
|
18
|
+
}>) => import("vue").VNode & {
|
|
19
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
22
20
|
};
|
|
21
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
22
|
+
[K in keyof T]: T[K];
|
|
23
|
+
} : {
|
|
24
|
+
[K in keyof T as K]: T[K];
|
|
25
|
+
}) & {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useTranslate } from "../../../i18n/use-translate.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useRecordContextRef } from "../../../record/record-context.js";
|
|
3
3
|
import { useResourceContext } from "../../../resource-context.js";
|
|
4
4
|
import { useCreatePath } from "../../../router/nav-composables.js";
|
|
5
5
|
import { buttonVariants } from "../../ui/button-variants.js";
|
|
6
6
|
import { useMenuAccess } from "../layout/use-menu-access.js";
|
|
7
7
|
import { CopyIcon } from "./icons.js";
|
|
8
|
-
import { computed, createBlock, createCommentVNode, createTextVNode, createVNode, defineComponent,
|
|
8
|
+
import { computed, createBlock, createCommentVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, renderSlot, toDisplayString, unref, withCtx, withModifiers } from "vue";
|
|
9
9
|
import { RouterLink } from "vue-router";
|
|
10
10
|
// src/components/admin/buttons/clone-button.vue?vue&type=script&setup=true&lang.ts
|
|
11
11
|
var clone_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
@@ -28,8 +28,7 @@ var clone_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
28
28
|
*/
|
|
29
29
|
const props = __props;
|
|
30
30
|
const resource = useResourceContext(props);
|
|
31
|
-
const
|
|
32
|
-
const record = computed(() => props.record ?? injectedRecord?.value);
|
|
31
|
+
const record = useRecordContextRef(() => props.record);
|
|
33
32
|
const createPath = useCreatePath();
|
|
34
33
|
const translate = useTranslate();
|
|
35
34
|
const { canAccess, isPending: isAccessPending } = useMenuAccess(computed(() => ({
|
|
@@ -50,7 +49,7 @@ var clone_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
50
49
|
class: props.class
|
|
51
50
|
}));
|
|
52
51
|
return (_ctx, _cache) => {
|
|
53
|
-
return record
|
|
52
|
+
return unref(record) && unref(record).id != null && !unref(isAccessPending) && unref(canAccess) ? (openBlock(), createBlock(unref(RouterLink), {
|
|
54
53
|
key: 0,
|
|
55
54
|
to: to.value,
|
|
56
55
|
class: normalizeClass(classes.value),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { LooseRecord, MutationMode } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, MutationMode, ResourceRecord } from "@chelone/core";
|
|
2
2
|
/** Where to go after a successful delete. */
|
|
3
3
|
export type DeleteRedirect = "list" | "show" | "edit" | false;
|
|
4
4
|
/** Props for {@link DeleteButton}. */
|
|
5
|
-
export interface DeleteButtonProps {
|
|
5
|
+
export interface DeleteButtonProps<TRecord extends ResourceRecord = LooseRecord> {
|
|
6
6
|
/** Override the ambient record. */
|
|
7
|
-
record?: LooseRecord;
|
|
7
|
+
record?: TRecord | LooseRecord;
|
|
8
8
|
/** Override the ambient `<Resource>`. */
|
|
9
9
|
resource?: string;
|
|
10
10
|
/** Override the auto-translated label. */
|
|
@@ -31,10 +31,19 @@ export interface DeleteButtonProps {
|
|
|
31
31
|
}
|
|
32
32
|
declare const _default: typeof __VLS_export;
|
|
33
33
|
export default _default;
|
|
34
|
-
declare const __VLS_export:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
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<{
|
|
35
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<DeleteButtonProps<TRecord>> & (typeof globalThis extends {
|
|
36
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
37
|
+
} ? P : {});
|
|
38
|
+
expose: (exposed: {}) => void;
|
|
39
|
+
attrs: any;
|
|
40
|
+
slots: {};
|
|
41
|
+
emit: {};
|
|
42
|
+
}>) => import("vue").VNode & {
|
|
43
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
44
|
+
};
|
|
45
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
46
|
+
[K in keyof T]: T[K];
|
|
47
|
+
} : {
|
|
48
|
+
[K in keyof T as K]: T[K];
|
|
49
|
+
}) & {};
|
|
@@ -4,15 +4,15 @@ import { useUndoable } from "../../../data/undoable.js";
|
|
|
4
4
|
import { useTranslate } from "../../../i18n/use-translate.js";
|
|
5
5
|
import { humanize, pluralize } from "../../../label/inflection.js";
|
|
6
6
|
import { useGetRecordRepresentation } from "../../../label/use-get-record-representation.js";
|
|
7
|
-
import {
|
|
7
|
+
import { useRecordContextRef } from "../../../record/record-context.js";
|
|
8
8
|
import { useResourceContext } from "../../../resource-context.js";
|
|
9
9
|
import { useRedirect } from "../../../router/nav-composables.js";
|
|
10
10
|
import { useMenuAccess } from "../layout/use-menu-access.js";
|
|
11
11
|
import button_default from "../../ui/button.js";
|
|
12
12
|
import confirm_default from "../feedback/confirm.js";
|
|
13
13
|
import { TrashIcon } from "./icons.js";
|
|
14
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent,
|
|
15
|
-
import { definedParams, removeRecordsFromCache } from "@chelone/core";
|
|
14
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, toDisplayString, unref, withCtx } from "vue";
|
|
15
|
+
import { definedParams, isLooseRecord, removeRecordsFromCache } from "@chelone/core";
|
|
16
16
|
// src/components/admin/buttons/delete-button.vue?vue&type=script&setup=true&lang.ts
|
|
17
17
|
var delete_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
18
18
|
__name: "delete-button",
|
|
@@ -56,8 +56,7 @@ var delete_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
56
56
|
const ambientResource = useResourceContext(props);
|
|
57
57
|
if (!ambientResource) throw new Error("<DeleteButton> must be used inside a <Resource> or given a `resource` prop.");
|
|
58
58
|
const resource = ambientResource;
|
|
59
|
-
const
|
|
60
|
-
const record = computed(() => props.record ?? injectedRecord?.value);
|
|
59
|
+
const record = useRecordContextRef(() => props.record);
|
|
61
60
|
const translate = useTranslate();
|
|
62
61
|
const redirect = useRedirect();
|
|
63
62
|
const ctx = useCheloneContext();
|
|
@@ -96,7 +95,7 @@ var delete_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
96
95
|
const open = ref(false);
|
|
97
96
|
function onClick() {
|
|
98
97
|
const current = record.value;
|
|
99
|
-
if (current
|
|
98
|
+
if (!current || !isLooseRecord(current) || current.id == null) return;
|
|
100
99
|
if (props.mutationMode === "undoable") {
|
|
101
100
|
const id = current.id;
|
|
102
101
|
runUndoable({
|
|
@@ -120,7 +119,7 @@ var delete_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
120
119
|
async function onConfirm() {
|
|
121
120
|
const current = record.value;
|
|
122
121
|
const id = current?.id;
|
|
123
|
-
if (id == null) {
|
|
122
|
+
if (!current || !isLooseRecord(current) || id == null) {
|
|
124
123
|
open.value = false;
|
|
125
124
|
return;
|
|
126
125
|
}
|
package/dist/components/admin/buttons/dual-approval-button.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -14,7 +14,10 @@ var _hoisted_1 = {
|
|
|
14
14
|
class: "inline-flex items-center gap-2",
|
|
15
15
|
"data-slot": "dual-approval"
|
|
16
16
|
};
|
|
17
|
-
var _hoisted_2 = {
|
|
17
|
+
var _hoisted_2 = {
|
|
18
|
+
"data-slot": "dual-approval-count",
|
|
19
|
+
class: "text-muted-foreground"
|
|
20
|
+
};
|
|
18
21
|
var _hoisted_3 = {
|
|
19
22
|
key: 0,
|
|
20
23
|
class: "text-sm text-muted-foreground",
|
|
@@ -110,7 +113,16 @@ var dual_approval_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE
|
|
|
110
113
|
"data-slot": "dual-approval-button",
|
|
111
114
|
onClick
|
|
112
115
|
}, {
|
|
113
|
-
default: withCtx(() => [
|
|
116
|
+
default: withCtx(() => [_cache[0] || (_cache[0] = createElementVNode("svg", {
|
|
117
|
+
"aria-hidden": "true",
|
|
118
|
+
class: "size-4",
|
|
119
|
+
viewBox: "0 0 24 24",
|
|
120
|
+
fill: "none",
|
|
121
|
+
stroke: "currentColor",
|
|
122
|
+
"stroke-width": "2",
|
|
123
|
+
"stroke-linecap": "round",
|
|
124
|
+
"stroke-linejoin": "round"
|
|
125
|
+
}, [createElementVNode("path", { d: "M20 6 9 17l-5-5" })], -1)), state.value?.isComplete ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(completeText.value), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(unref(translate)("chelone.approval.approve", { _: "Approve" })) + " ", 1), createElementVNode("span", _hoisted_2, toDisplayString(countText.value), 1)], 64))]),
|
|
114
126
|
_: 1
|
|
115
127
|
}, 8, ["disabled", "class"]), state.value?.hasApproved && !state.value.isComplete ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(unref(translate)("chelone.approval.already_approved", { _: "You already approved" })), 1)) : createCommentVNode("", true)])) : createCommentVNode("", true);
|
|
116
128
|
};
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { type LooseRecord } from "@chelone/core";
|
|
1
|
+
import { type LooseRecord, type ResourceRecord } from "@chelone/core";
|
|
2
|
+
import type { RecordLinkButtonProps } from "./record-button-props.js";
|
|
2
3
|
/** Props for {@link EditButton}. */
|
|
3
|
-
export interface EditButtonProps {
|
|
4
|
-
/** Override the ambient record. */
|
|
5
|
-
record?: LooseRecord;
|
|
6
|
-
/** Override the ambient `<Resource>`. */
|
|
7
|
-
resource?: string;
|
|
8
|
-
/** Override the auto-translated label. */
|
|
9
|
-
label?: string;
|
|
10
|
-
/** Extra CSS class appended to the anchor. */
|
|
11
|
-
class?: string;
|
|
4
|
+
export interface EditButtonProps<TRecord extends ResourceRecord = LooseRecord> extends RecordLinkButtonProps<TRecord> {
|
|
12
5
|
}
|
|
13
6
|
declare const _default: typeof __VLS_export;
|
|
14
7
|
export default _default;
|
|
15
|
-
declare const __VLS_export:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
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<{
|
|
9
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<EditButtonProps<TRecord>> & (typeof globalThis extends {
|
|
10
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
11
|
+
} ? P : {});
|
|
12
|
+
expose: (exposed: {}) => void;
|
|
13
|
+
attrs: any;
|
|
14
|
+
slots: {
|
|
15
|
+
icon?: (props: {}) => any;
|
|
21
16
|
};
|
|
17
|
+
emit: {};
|
|
18
|
+
}>) => import("vue").VNode & {
|
|
19
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
22
20
|
};
|
|
21
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
22
|
+
[K in keyof T]: T[K];
|
|
23
|
+
} : {
|
|
24
|
+
[K in keyof T as K]: T[K];
|
|
25
|
+
}) & {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useTranslate } from "../../../i18n/use-translate.js";
|
|
2
2
|
import { useGetResourceLabel } from "../../../label/use-get-resource-label.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useRecordContextRef } from "../../../record/record-context.js";
|
|
4
4
|
import { useResourceContext } from "../../../resource-context.js";
|
|
5
5
|
import { useCreatePath } from "../../../router/nav-composables.js";
|
|
6
6
|
import { useMenuAccess } from "../layout/use-menu-access.js";
|
|
7
7
|
import { buttonVariants } from "../../ui/button-variants.js";
|
|
8
8
|
import { PencilIcon } from "./icons.js";
|
|
9
|
-
import { computed, createBlock, createCommentVNode, createTextVNode, createVNode, defineComponent,
|
|
9
|
+
import { computed, createBlock, createCommentVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, renderSlot, toDisplayString, unref, withCtx, withModifiers } from "vue";
|
|
10
10
|
import { definedParams } from "@chelone/core";
|
|
11
11
|
import { RouterLink } from "vue-router";
|
|
12
12
|
// src/components/admin/buttons/edit-button.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -32,8 +32,7 @@ var edit_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
32
32
|
*/
|
|
33
33
|
const props = __props;
|
|
34
34
|
const resource = useResourceContext(props);
|
|
35
|
-
const
|
|
36
|
-
const record = computed(() => props.record ?? injectedRecord?.value);
|
|
35
|
+
const record = useRecordContextRef(() => props.record);
|
|
37
36
|
const createPath = useCreatePath();
|
|
38
37
|
const getResourceLabel = useGetResourceLabel();
|
|
39
38
|
const translate = useTranslate();
|
|
@@ -59,7 +58,7 @@ var edit_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
59
58
|
class: props.class
|
|
60
59
|
}));
|
|
61
60
|
return (_ctx, _cache) => {
|
|
62
|
-
return record
|
|
61
|
+
return unref(record) && unref(record).id != null && !unref(isAccessPending) && unref(canAccess) ? (openBlock(), createBlock(unref(RouterLink), {
|
|
63
62
|
key: 0,
|
|
64
63
|
to: to.value,
|
|
65
64
|
class: normalizeClass(classes.value),
|
|
@@ -5,7 +5,7 @@ import { useResourceContext } from "../../../resource-context.js";
|
|
|
5
5
|
import button_default from "../../ui/button.js";
|
|
6
6
|
import { DownloadIcon } from "./icons.js";
|
|
7
7
|
import { computed, createBlock, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
8
|
-
import { defaultExporter } from "@chelone/core";
|
|
8
|
+
import { DEFAULT_EXPORT_MAX_RESULTS, defaultExporter } from "@chelone/core";
|
|
9
9
|
// src/components/admin/buttons/export-button.vue?vue&type=script&setup=true&lang.ts
|
|
10
10
|
var export_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
11
11
|
__name: "export-button",
|
|
@@ -47,7 +47,7 @@ var export_button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
47
47
|
filter: list.filter ?? {},
|
|
48
48
|
pagination: {
|
|
49
49
|
page: 1,
|
|
50
|
-
perPage: props.maxResults ??
|
|
50
|
+
perPage: props.maxResults ?? DEFAULT_EXPORT_MAX_RESULTS
|
|
51
51
|
},
|
|
52
52
|
meta: props.meta
|
|
53
53
|
});
|