From f73392039a321e655d9862801b971907f131bf79 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Wed, 1 May 2024 13:55:20 -0700 Subject: [PATCH] feat(vue3): support for ServiceViewModel in c-admin-method(s?) --- .../components/c-admin-method.md | 4 +- .../components/c-admin-methods.md | 2 +- .../components/admin/c-admin-method.spec.tsx | 39 +++++++++++++++++++ .../src/components/admin/c-admin-method.vue | 21 +++++----- .../components/admin/c-admin-methods.spec.tsx | 23 +++++++++++ .../src/components/admin/c-admin-methods.vue | 15 ++++--- .../src/components/c-metadata-component.ts | 8 +++- 7 files changed, 93 insertions(+), 19 deletions(-) create mode 100644 src/coalesce-vue-vuetify3/src/components/admin/c-admin-method.spec.tsx create mode 100644 src/coalesce-vue-vuetify3/src/components/admin/c-admin-methods.spec.tsx diff --git a/docs/stacks/vue/coalesce-vue-vuetify/components/c-admin-method.md b/docs/stacks/vue/coalesce-vue-vuetify/components/c-admin-method.md index f36c4666f..01f90bea6 100644 --- a/docs/stacks/vue/coalesce-vue-vuetify/components/c-admin-method.md +++ b/docs/stacks/vue/coalesce-vue-vuetify/components/c-admin-method.md @@ -24,9 +24,9 @@ A metadata specifier for the method. One of: - A direct reference to a method's metadata object. - A string in dot-notation that starts with a type name and ending with a method name. - + -An [ViewModel](/stacks/vue/layers/viewmodels.md) or [ListViewModel](/stacks/vue/layers/viewmodels.md) owning the method and [API Caller](/stacks/vue/layers/api-clients.md#api-callers) that was specified by the `for` prop. +An [ViewModel](/stacks/vue/layers/viewmodels.md) or [ListViewModel](/stacks/vue/layers/viewmodels.md) or [ServiceViewModel](/modeling/model-types/services.md#generated-code) owning the method and [API Caller](/stacks/vue/layers/api-clients.md#api-callers) that was specified by the `for` prop. diff --git a/docs/stacks/vue/coalesce-vue-vuetify/components/c-admin-methods.md b/docs/stacks/vue/coalesce-vue-vuetify/components/c-admin-methods.md index 8428df47f..45f11e063 100644 --- a/docs/stacks/vue/coalesce-vue-vuetify/components/c-admin-methods.md +++ b/docs/stacks/vue/coalesce-vue-vuetify/components/c-admin-methods.md @@ -24,7 +24,7 @@ Renders in a [Vuetify](https://vuetifyjs.com/) [v-expansion-panels](https://vuet -An [ViewModel](/stacks/vue/layers/viewmodels.md) or [ListViewModel](/stacks/vue/layers/viewmodels.md) whose methods should each render as a [c-admin-method](/stacks/vue/coalesce-vue-vuetify/components/c-admin-method.md). +An [ViewModel](/stacks/vue/layers/viewmodels.md) or [ListViewModel](/stacks/vue/layers/viewmodels.md) or [ServiceViewModel](/modeling/model-types/services.md#generated-code) whose methods should each render as a [c-admin-method](/stacks/vue/coalesce-vue-vuetify/components/c-admin-method.md). diff --git a/src/coalesce-vue-vuetify3/src/components/admin/c-admin-method.spec.tsx b/src/coalesce-vue-vuetify3/src/components/admin/c-admin-method.spec.tsx new file mode 100644 index 000000000..5f31ced63 --- /dev/null +++ b/src/coalesce-vue-vuetify3/src/components/admin/c-admin-method.spec.tsx @@ -0,0 +1,39 @@ +import { CAdminMethod } from ".."; +import { + PersonViewModel, + PersonListViewModel, + WeatherServiceViewModel, +} from "@test-targets/viewmodels.g"; + +describe("CAdminMethod", () => { + test("types", () => { + const vm = new PersonViewModel(); + const listVm = new PersonListViewModel(); + const serviceVm = new WeatherServiceViewModel(); + + const rename = vm.$metadata.methods.rename; + const getUser = listVm.$metadata.methods.getUser; + const getWeather = serviceVm.$metadata.methods.getWeather; + + () => ; + () => ; + //@ts-expect-error method doesn't exist + () => ; + //@ts-expect-error method from wrong type + () => ; + + () => ; + () => ; + //@ts-expect-error method doesn't exist + () => ; + //@ts-expect-error method from wrong type + () => ; + + () => ; + () => ; + //@ts-expect-error method doesn't exist + () => ; + //@ts-expect-error method from wrong type + () => ; + }); +}); diff --git a/src/coalesce-vue-vuetify3/src/components/admin/c-admin-method.vue b/src/coalesce-vue-vuetify3/src/components/admin/c-admin-method.vue index 742867b81..bfe622be6 100644 --- a/src/coalesce-vue-vuetify3/src/components/admin/c-admin-method.vue +++ b/src/coalesce-vue-vuetify3/src/components/admin/c-admin-method.vue @@ -153,9 +153,13 @@ -