@chelone/vue 0.1.1 → 0.2.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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, provide, useSlots, onScopeDispose, onBeforeUpdate, watchEffect, openBlock, createElementBlock, Fragment, renderSlot, createVNode, createSlots, withCtx, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
-
import { joinBasename } from "@chelone/core";
|
|
2
|
+
import { createI18n, englishMessages, joinBasename } from "@chelone/core";
|
|
3
3
|
import { BasenameKey } from "../router/adapter.js";
|
|
4
4
|
import { QueryClient, VUE_QUERY_CLIENT } from "@tanstack/vue-query";
|
|
5
5
|
import { useRouter, START_LOCATION } from "vue-router";
|
|
@@ -44,7 +44,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
44
44
|
dataProvider: props.dataProvider,
|
|
45
45
|
queryClient,
|
|
46
46
|
authProvider: props.authProvider,
|
|
47
|
-
i18n
|
|
47
|
+
// Built once, and only when the app brings no i18n of its own.
|
|
48
|
+
i18n: props.i18n ?? createI18n({ locale: "en", messages: { en: englishMessages } }),
|
|
48
49
|
store: props.store,
|
|
49
50
|
notifications: props.notifications,
|
|
50
51
|
// Thread the zod registry so `useForm({ resource })` auto-resolves the
|
|
@@ -3,6 +3,8 @@ import { removeRecordsFromCache } from "@chelone/core";
|
|
|
3
3
|
import { useCheloneContext } from "../../../context.js";
|
|
4
4
|
import { useUndoable } from "../../../data/undoable.js";
|
|
5
5
|
import { useTranslate } from "../../../i18n/use-translate.js";
|
|
6
|
+
import { humanize, pluralize } from "../../../label/inflection.js";
|
|
7
|
+
import { useGetRecordRepresentation } from "../../../label/use-get-record-representation.js";
|
|
6
8
|
import { RecordContextKey } from "../../../record/record-context.js";
|
|
7
9
|
import { useResourceContext } from "../../../resource-context.js";
|
|
8
10
|
import { useMenuAccess } from "../layout/use-menu-access.js";
|
|
@@ -56,6 +58,23 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
56
58
|
}))
|
|
57
59
|
);
|
|
58
60
|
const show = computed(() => !isAccessPending.value && canAccess.value);
|
|
61
|
+
const getRecordRepresentation = useGetRecordRepresentation(resource);
|
|
62
|
+
const confirmOptions = computed(() => {
|
|
63
|
+
const representation = getRecordRepresentation(record.value);
|
|
64
|
+
return {
|
|
65
|
+
name: translate(`resources.${resource}.forcedCaseName`, {
|
|
66
|
+
smart_count: 1,
|
|
67
|
+
_: humanize(
|
|
68
|
+
translate(`resources.${resource}.name`, {
|
|
69
|
+
smart_count: 1,
|
|
70
|
+
_: pluralize(resource, 1)
|
|
71
|
+
})
|
|
72
|
+
)
|
|
73
|
+
}),
|
|
74
|
+
recordRepresentation: typeof representation === "string" ? representation : "",
|
|
75
|
+
id: record.value?.id
|
|
76
|
+
};
|
|
77
|
+
});
|
|
59
78
|
const label = computed(
|
|
60
79
|
() => translate("ra.action.delete", { _: props.label ?? "Delete" })
|
|
61
80
|
);
|
|
@@ -123,9 +142,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
123
142
|
title: __props.confirmTitle,
|
|
124
143
|
content: __props.confirmContent,
|
|
125
144
|
"confirm-color": __props.confirmColor,
|
|
145
|
+
"translate-options": confirmOptions.value,
|
|
126
146
|
onConfirm,
|
|
127
147
|
onClose: onCancel
|
|
128
|
-
}, null, 8, ["is-open", "loading", "title", "content", "confirm-color"])) : createCommentVNode("", true)
|
|
148
|
+
}, null, 8, ["is-open", "loading", "title", "content", "confirm-color", "translate-options"])) : createCommentVNode("", true)
|
|
129
149
|
], 64);
|
|
130
150
|
};
|
|
131
151
|
}
|
|
@@ -57,7 +57,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
57
57
|
createVNode(_sfc_main$1, {
|
|
58
58
|
variant: "ghost",
|
|
59
59
|
size: "icon",
|
|
60
|
-
"aria-label": unref(translate)("ra.
|
|
60
|
+
"aria-label": unref(translate)("ra.calendar.previous", { _: "Previous" }),
|
|
61
61
|
onClick: _cache[0] || (_cache[0] = ($event) => emit("navigate", "previous"))
|
|
62
62
|
}, {
|
|
63
63
|
default: withCtx(() => [
|
|
@@ -78,7 +78,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
78
78
|
createVNode(_sfc_main$1, {
|
|
79
79
|
variant: "ghost",
|
|
80
80
|
size: "icon",
|
|
81
|
-
"aria-label": unref(translate)("ra.
|
|
81
|
+
"aria-label": unref(translate)("ra.calendar.next", { _: "Next" }),
|
|
82
82
|
onClick: _cache[2] || (_cache[2] = ($event) => emit("navigate", "next"))
|
|
83
83
|
}, {
|
|
84
84
|
default: withCtx(() => [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chelone/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"cronstrue": "^3.24.0",
|
|
59
59
|
"libphonenumber-js": "^1.13.8",
|
|
60
|
-
"@chelone/core": "0.
|
|
60
|
+
"@chelone/core": "0.2.0"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"@guolao/vue-monaco-editor": "^1.6.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"terra-draw-maplibre-gl-adapter": "^1.5.0",
|
|
77
77
|
"vue": "^3.4.0",
|
|
78
78
|
"vue-router": "^4.0.0",
|
|
79
|
-
"@chelone/supabase": "0.
|
|
79
|
+
"@chelone/supabase": "0.2.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"@chelone/supabase": {
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"vue-router": "^4.0.0",
|
|
151
151
|
"vue-tsc": "^2.0.0",
|
|
152
152
|
"zod": "^3.24.0",
|
|
153
|
-
"@chelone/supabase": "0.
|
|
153
|
+
"@chelone/supabase": "0.2.0"
|
|
154
154
|
},
|
|
155
155
|
"scripts": {
|
|
156
156
|
"build": "vite build && vue-tsc -p tsconfig.build.json && node ../../scripts/strip-dts-css-imports.mjs dist && node ../../scripts/dts-extensions.mjs dist",
|