|
7 | 7 | </div>
|
8 | 8 | <div v-else class="pt-1">
|
9 | 9 | <div v-if="create && apis.Create">
|
10 |
| - <EnsureAccessDialog v-if="invalidCreateAccess" :title="`Create ${dataModelName}`" :invalid-access="invalidCreateAccess" alert-class="text-yellow-700" @done="createDone" /> |
| 10 | + <EnsureAccessDialog v-if="invalidCreateAccess" :title="`Create ${modelTitle}`" :invalid-access="invalidCreateAccess" alert-class="text-yellow-700" @done="createDone" /> |
11 | 11 | <slot v-else-if="slots.createform" name="createform" :type="apis.Create.request.name" :configure="configureField" :done="createDone" :save="createSave"></slot>
|
12 | 12 | <AutoCreateForm ref="createForm" v-else :type="apis.Create.request.name" :configure="configureField" @done="createDone" @save="createSave">
|
13 | 13 | <template #header>
|
|
19 | 19 | </AutoCreateForm>
|
20 | 20 | </div>
|
21 | 21 | <div v-else-if="edit && apis.AnyUpdate">
|
22 |
| - <EnsureAccessDialog v-if="invalidUpdateAccess" :title="`Update ${dataModelName}`" :invalid-access="invalidUpdateAccess" alert-class="text-yellow-700" @done="editDone" /> |
| 22 | + <EnsureAccessDialog v-if="invalidUpdateAccess" :title="`Update ${modelTitle}`" :invalid-access="invalidUpdateAccess" alert-class="text-yellow-700" @done="editDone" /> |
23 | 23 | <slot v-else-if="slots.editform" name="editform" :model="edit" :type="apis.AnyUpdate.request.name" :deleteType="canDelete ? apis.Delete!.request.name : null"
|
24 | 24 | :configure="configureField" :done="editDone" :save="editSave"></slot>
|
25 | 25 | <AutoEditForm ref="editForm" v-else v-model="edit" :type="apis.AnyUpdate.request.name" :deleteType="canDelete ? apis.Delete!.request.name : null"
|
|
37 | 37 | <QueryPrefs v-if="showQueryPrefs" :columns="viewModelColumns" :prefs="apiPrefs" @done="showQueryPrefs=false" @save="saveApiPrefs" />
|
38 | 38 | <div class="pl-1 pt-1 flex flex-wrap">
|
39 | 39 | <div class="flex mt-1">
|
40 |
| - <button v-if="show('preferences')" type="button" class=" text-gray-700 dark:text-gray-300 hover:text-indigo-600 dark:hover:text-indigo-400" :title="`${dataModelName} Preferences`" @click="showQueryPrefs=!showQueryPrefs"> |
| 40 | + <button v-if="show('preferences')" type="button" class=" text-gray-700 dark:text-gray-300 hover:text-indigo-600 dark:hover:text-indigo-400" :title="`${modelTitle} Preferences`" @click="showQueryPrefs=!showQueryPrefs"> |
41 | 41 | <svg class="w-8 h-8" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke-width="1.5" fill="none"><path d="M9 3H3.6a.6.6 0 0 0-.6.6v16.8a.6.6 0 0 0 .6.6H9M9 3v18M9 3h6M9 21h6m0-18h5.4a.6.6 0 0 1 .6.6v16.8a.6.6 0 0 1-.6.6H15m0-18v18" stroke="currentColor" /></g></svg>
|
42 | 42 | </button>
|
43 | 43 |
|
|
119 | 119 | </div>
|
120 | 120 |
|
121 | 121 | <div v-if="show('newItem') && apis.Create && canCreate" class="pl-2 mt-1">
|
122 |
| - <button type="button" @click="onShowNewItem" :title="dataModelName" :class="toolbarButtonClass"> |
| 122 | + <button type="button" @click="onShowNewItem" :title="modelTitle" :class="toolbarButtonClass"> |
123 | 123 | <svg class="w-5 h-5 mr-1 text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-gray-50" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" fill="currentColor"></path></svg>
|
124 |
| - <span class="whitespace-nowrap">New {{ dataModelName }}</span> |
| 124 | + <span class="whitespace-nowrap">{{ newButtonLabel }}</span> |
125 | 125 | </button>
|
126 | 126 | </div>
|
127 | 127 |
|
@@ -220,6 +220,8 @@ const props = withDefaults(defineProps<{
|
220 | 220 | visibleFrom?: {[name:string]:Breakpoint|"never"}
|
221 | 221 | rowClass?:(model:any,i:number) => string
|
222 | 222 | rowStyle?:(model:any,i:number) => StyleValue | undefined
|
| 223 | + modelTitle?: string |
| 224 | + newButtonLabel?: string |
223 | 225 |
|
224 | 226 | apiPrefs?: ApiPrefs
|
225 | 227 | canFilter?:(column:string) => boolean
|
@@ -603,6 +605,8 @@ function onShowNewItem() {
|
603 | 605 |
|
604 | 606 | const typeName = computed(() => getTypeName(props.type))
|
605 | 607 | const dataModelName = computed(() => typeName.value || apis.value.AnyQuery?.dataModel.name)
|
| 608 | +const modelTitle = computed(() => props.modelTitle || dataModelName.value) |
| 609 | +const newButtonLabel = computed(() => props.newButtonLabel || `New ${modelTitle.value}`) |
606 | 610 | const prefsCacheKey = () => `${props.id}/ApiPrefs/${typeName.value || apis.value.AnyQuery?.dataModel.name}`
|
607 | 611 | const columnCacheKey = (name:string) => `Column/${props.id}:${typeName.value || apis.value.AnyQuery?.dataModel.name}.${name}`
|
608 | 612 |
|
|
0 commit comments