@jskit-ai/http-web 0.1.1
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/fixtures/crud-list-date-filters/App.vue +107 -0
- package/fixtures/crud-list-date-filters/index.html +12 -0
- package/fixtures/crud-list-date-filters/main.js +24 -0
- package/fixtures/crud-list-date-filters/vite.config.mjs +18 -0
- package/package.json +150 -0
- package/src/client/bulkActions.js +47 -0
- package/src/client/components/CrudAddEditScreen.vue +186 -0
- package/src/client/components/CrudDeleteAction.vue +93 -0
- package/src/client/components/CrudListBulkActionSurface.vue +126 -0
- package/src/client/components/CrudListDateFilterControl.vue +188 -0
- package/src/client/components/CrudListFilterSurface.vue +388 -0
- package/src/client/components/CrudListRecordActionMenu.vue +120 -0
- package/src/client/components/CrudListScreen.vue +501 -0
- package/src/client/components/CrudViewScreen.vue +197 -0
- package/src/client/composables/crud/crudBindingSupport.js +75 -0
- package/src/client/composables/crud/crudHttpClientSupport.js +57 -0
- package/src/client/composables/crud/crudJsonApiTransportSupport.js +145 -0
- package/src/client/composables/crud/crudLookupFieldLabelSupport.js +151 -0
- package/src/client/composables/crud/crudLookupFieldRuntime.js +251 -0
- package/src/client/composables/crud/crudSchemaFormHelpers.js +464 -0
- package/src/client/composables/internal/crudListFilterLookupSupport.js +161 -0
- package/src/client/composables/internal/crudListParentTitleSupport.js +171 -0
- package/src/client/composables/internal/useOperationScope.js +144 -0
- package/src/client/composables/records/useAddEdit.js +224 -0
- package/src/client/composables/records/useCrudAddEdit.js +227 -0
- package/src/client/composables/records/useCrudList.js +101 -0
- package/src/client/composables/records/useCrudView.js +47 -0
- package/src/client/composables/records/useList.js +500 -0
- package/src/client/composables/records/useView.js +164 -0
- package/src/client/composables/runtime/addEditUiRuntime.js +130 -0
- package/src/client/composables/runtime/listUiRuntime.js +123 -0
- package/src/client/composables/runtime/modelStateHelpers.js +90 -0
- package/src/client/composables/runtime/operationAdapters.js +34 -0
- package/src/client/composables/runtime/operationUiHelpers.js +125 -0
- package/src/client/composables/runtime/operationValidationHelpers.js +51 -0
- package/src/client/composables/runtime/useAddEditCore.js +112 -0
- package/src/client/composables/runtime/useCommandCore.js +123 -0
- package/src/client/composables/runtime/useEndpointResource.js +199 -0
- package/src/client/composables/runtime/useFieldErrorBag.js +61 -0
- package/src/client/composables/runtime/useListCore.js +112 -0
- package/src/client/composables/runtime/useUiFeedback.js +98 -0
- package/src/client/composables/runtime/useViewCore.js +93 -0
- package/src/client/composables/runtime/viewUiRuntime.js +96 -0
- package/src/client/composables/support/errorMessageHelpers.js +66 -0
- package/src/client/composables/support/listQueryParamSupport.js +473 -0
- package/src/client/composables/support/listSearchSupport.js +70 -0
- package/src/client/composables/support/refValueHelpers.js +19 -0
- package/src/client/composables/support/requestQueryRuntimeSupport.js +141 -0
- package/src/client/composables/support/resourceLoadStateHelpers.js +208 -0
- package/src/client/composables/support/routeTemplateHelpers.js +285 -0
- package/src/client/composables/support/scopeHelpers.js +145 -0
- package/src/client/composables/useAccess.js +109 -0
- package/src/client/composables/useCommand.js +118 -0
- package/src/client/composables/useCrudAddEditScreen.js +88 -0
- package/src/client/composables/useCrudDeleteAction.js +160 -0
- package/src/client/composables/useCrudListBulkActions.js +147 -0
- package/src/client/composables/useCrudListFilterLookups.js +146 -0
- package/src/client/composables/useCrudListFilters.js +339 -0
- package/src/client/composables/useCrudListParentTitle.js +151 -0
- package/src/client/composables/useCrudListRowActions.js +144 -0
- package/src/client/composables/useCrudListScreen.js +237 -0
- package/src/client/composables/useCrudViewScreen.js +77 -0
- package/src/client/composables/usePagedCollection.js +181 -0
- package/src/client/composables/useRealtimeQueryInvalidation.js +156 -0
- package/src/client/composables/useScopeRuntime.js +135 -0
- package/src/client/filters.js +15 -0
- package/src/client/index.js +24 -0
- package/src/client/lib/httpClient.js +47 -0
- package/src/client/lib/permissions.js +34 -0
- package/src/client/rowActions.js +47 -0
- package/src/client/support/contractGuards.js +34 -0
- package/src/client/support/crudListDateFilterSupport.js +91 -0
- package/test/addEditUiRuntime.test.js +110 -0
- package/test/crudBindingSupport.test.js +110 -0
- package/test/crudHttpClientSupport.test.js +77 -0
- package/test/crudJsonApiTransportSupport.test.js +179 -0
- package/test/crudListBulkActionSurface.test.js +27 -0
- package/test/crudListDateFilterSupport.test.js +92 -0
- package/test/crudListDateFilterSurface.browser.test.js +182 -0
- package/test/crudListFilterSurface.test.js +90 -0
- package/test/crudLookupFieldRuntime.test.js +264 -0
- package/test/crudScreenComponents.test.js +110 -0
- package/test/errorIntentContract.test.js +31 -0
- package/test/errorMessageHelpers.test.js +28 -0
- package/test/exportsContract.test.js +68 -0
- package/test/listQueryParamSupport.test.js +223 -0
- package/test/listUiRuntime.test.js +102 -0
- package/test/operationValidationHelpers.test.js +64 -0
- package/test/packageBoundary.test.js +31 -0
- package/test/permissions.test.js +35 -0
- package/test/refValueHelpers.test.js +14 -0
- package/test/requestTransportOptions.test.js +457 -0
- package/test/resourceLoadStateHelpers.test.js +189 -0
- package/test/routeTemplateHelpers.test.js +85 -0
- package/test/scopeHelpers.test.js +57 -0
- package/test/useAddEditCore.test.js +124 -0
- package/test/useAddEditRequestQueryParams.test.js +190 -0
- package/test/useCrudAddEdit.test.js +415 -0
- package/test/useCrudDeleteAction.test.js +139 -0
- package/test/useCrudListBulkActions.test.js +65 -0
- package/test/useCrudListFilterLookups.test.js +114 -0
- package/test/useCrudListFilters.test.js +293 -0
- package/test/useCrudListParentTitle.test.js +262 -0
- package/test/useCrudListRowActions.test.js +77 -0
- package/test/useListRouteInitialization.test.js +337 -0
- package/test/useListSearchSupport.test.js +61 -0
- package/test/usePagedCollection.test.js +53 -0
- package/test/useViewRequestQueryParams.test.js +20 -0
- package/test/viewCoreLoading.test.js +44 -0
- package/test/viewUiRuntime.test.js +95 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
record: {
|
|
6
|
+
type: Object,
|
|
7
|
+
default: () => ({})
|
|
8
|
+
},
|
|
9
|
+
index: {
|
|
10
|
+
type: Number,
|
|
11
|
+
default: 0
|
|
12
|
+
},
|
|
13
|
+
rowActions: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: null
|
|
16
|
+
},
|
|
17
|
+
viewLocation: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
editLocation: {
|
|
22
|
+
type: Object,
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
25
|
+
showView: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: false
|
|
28
|
+
},
|
|
29
|
+
showEdit: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
buttonLabel: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "Actions"
|
|
36
|
+
},
|
|
37
|
+
buttonVariant: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "text"
|
|
40
|
+
},
|
|
41
|
+
buttonSize: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "small"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const visibleRowActions = computed(() => {
|
|
48
|
+
if (typeof props.rowActions?.visibleActionsFor !== "function") {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
return props.rowActions.visibleActionsFor(props.record, props.index);
|
|
52
|
+
});
|
|
53
|
+
const hasViewAction = computed(() => Boolean(props.showView && props.viewLocation));
|
|
54
|
+
const hasEditAction = computed(() => Boolean(props.showEdit && props.editLocation));
|
|
55
|
+
const hasActions = computed(() =>
|
|
56
|
+
hasViewAction.value || hasEditAction.value || visibleRowActions.value.length > 0
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
function isRowActionLoading(action = {}) {
|
|
60
|
+
return typeof props.rowActions?.isActionLoading === "function" &&
|
|
61
|
+
props.rowActions.isActionLoading(action, props.record, props.index);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function isRowActionDisabled(action = {}) {
|
|
65
|
+
return typeof props.rowActions?.isActionDisabled !== "function" ||
|
|
66
|
+
props.rowActions.isActionDisabled(action, props.record, props.index);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function runRowAction(action = {}) {
|
|
70
|
+
if (typeof props.rowActions?.execute !== "function") {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
void props.rowActions.execute(action, props.record, props.index);
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<template>
|
|
78
|
+
<v-menu v-if="hasActions" location="bottom end">
|
|
79
|
+
<template #activator="{ props: menuProps }">
|
|
80
|
+
<v-btn
|
|
81
|
+
v-bind="menuProps"
|
|
82
|
+
:variant="buttonVariant"
|
|
83
|
+
:size="buttonSize"
|
|
84
|
+
>
|
|
85
|
+
{{ buttonLabel }}
|
|
86
|
+
</v-btn>
|
|
87
|
+
</template>
|
|
88
|
+
<v-list density="compact" min-width="150">
|
|
89
|
+
<v-list-item
|
|
90
|
+
v-if="hasViewAction"
|
|
91
|
+
title="Open"
|
|
92
|
+
:to="viewLocation"
|
|
93
|
+
/>
|
|
94
|
+
<v-list-item
|
|
95
|
+
v-if="hasEditAction"
|
|
96
|
+
title="Edit"
|
|
97
|
+
:to="editLocation"
|
|
98
|
+
/>
|
|
99
|
+
<v-divider v-if="(hasViewAction || hasEditAction) && visibleRowActions.length > 0" />
|
|
100
|
+
<v-list-item
|
|
101
|
+
v-for="action in visibleRowActions"
|
|
102
|
+
:key="action.key"
|
|
103
|
+
:title="action.label"
|
|
104
|
+
:base-color="action.color"
|
|
105
|
+
:disabled="isRowActionDisabled(action)"
|
|
106
|
+
@click="runRowAction(action)"
|
|
107
|
+
>
|
|
108
|
+
<template v-if="isRowActionLoading(action) || action.icon" #prepend>
|
|
109
|
+
<v-progress-circular
|
|
110
|
+
v-if="isRowActionLoading(action)"
|
|
111
|
+
indeterminate
|
|
112
|
+
size="18"
|
|
113
|
+
width="2"
|
|
114
|
+
/>
|
|
115
|
+
<v-icon v-else :icon="action.icon" />
|
|
116
|
+
</template>
|
|
117
|
+
</v-list-item>
|
|
118
|
+
</v-list>
|
|
119
|
+
</v-menu>
|
|
120
|
+
</template>
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, unref } from "vue";
|
|
3
|
+
import { useRoute } from "vue-router";
|
|
4
|
+
import CrudListBulkActionSurface from "./CrudListBulkActionSurface.vue";
|
|
5
|
+
import CrudListFilterSurface from "./CrudListFilterSurface.vue";
|
|
6
|
+
import CrudListRecordActionMenu from "./CrudListRecordActionMenu.vue";
|
|
7
|
+
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
screen: {
|
|
10
|
+
type: Object,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
titleLabel: {
|
|
14
|
+
type: String,
|
|
15
|
+
default: "Records"
|
|
16
|
+
},
|
|
17
|
+
headingTitle: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: ""
|
|
20
|
+
},
|
|
21
|
+
subtitle: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: ""
|
|
24
|
+
},
|
|
25
|
+
createLabel: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: "New record"
|
|
28
|
+
},
|
|
29
|
+
loadErrorTitle: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "Unable to load records"
|
|
32
|
+
},
|
|
33
|
+
loadErrorBody: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "Check the connection and try again."
|
|
36
|
+
},
|
|
37
|
+
emptyTitle: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "No records yet"
|
|
40
|
+
},
|
|
41
|
+
emptyBody: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: "Create the first record to start using this workflow."
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const route = useRoute();
|
|
48
|
+
const records = computed(() => props.screen?.records || {});
|
|
49
|
+
const bulkActions = computed(() => props.screen?.bulkActions || {});
|
|
50
|
+
const rowActions = computed(() => props.screen?.rowActions || {});
|
|
51
|
+
const listFilters = computed(() => props.screen?.listFilters || {});
|
|
52
|
+
const filterRuntime = computed(() => props.screen?.filterRuntime || null);
|
|
53
|
+
const displayRows = computed(() => unref(props.screen?.displayRows) || []);
|
|
54
|
+
const selectableRows = computed(() => unref(props.screen?.selectableRows) || []);
|
|
55
|
+
const listPrimaryAction = computed(() => unref(props.screen?.listPrimaryAction) || "");
|
|
56
|
+
const hasBulkActions = computed(() => Boolean(unref(bulkActions.value?.hasActions)));
|
|
57
|
+
const hasRowActions = computed(() => Boolean(unref(rowActions.value?.hasActions)));
|
|
58
|
+
const hasViewUrl = computed(() => Boolean(props.screen?.hasViewUrl));
|
|
59
|
+
const hasEditUrl = computed(() => Boolean(props.screen?.hasEditUrl));
|
|
60
|
+
const resolvedHeadingTitle = computed(() => String(props.headingTitle || props.titleLabel || "").trim());
|
|
61
|
+
const resolvedSubtitle = computed(() =>
|
|
62
|
+
String(props.subtitle || `Search, review, and update ${props.titleLabel} from this screen.`).trim()
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
function resolveListRecordTitle(record) {
|
|
66
|
+
if (typeof props.screen?.resolveRecordTitle === "function") {
|
|
67
|
+
return props.screen.resolveRecordTitle(record);
|
|
68
|
+
}
|
|
69
|
+
return "Record";
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function formatListCardValue(value) {
|
|
73
|
+
if (typeof props.screen?.formatListCardValue === "function") {
|
|
74
|
+
return props.screen.formatListCardValue(value);
|
|
75
|
+
}
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function resolveViewLocation(record) {
|
|
80
|
+
const path = typeof records.value?.resolveViewUrl === "function"
|
|
81
|
+
? records.value.resolveViewUrl(record)
|
|
82
|
+
: "";
|
|
83
|
+
return path ? { path, query: route.query } : null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function resolveEditLocation(record) {
|
|
87
|
+
const path = typeof records.value?.resolveEditUrl === "function"
|
|
88
|
+
? records.value.resolveEditUrl(record)
|
|
89
|
+
: "";
|
|
90
|
+
return path ? { path, query: route.query } : null;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function hasRowActionsFor(record, index) {
|
|
94
|
+
return typeof rowActions.value?.hasVisibleActionsFor === "function" &&
|
|
95
|
+
rowActions.value.hasVisibleActionsFor(record, index);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function isBulkRowSelected(row = {}) {
|
|
99
|
+
return typeof bulkActions.value?.isRecordSelected === "function" &&
|
|
100
|
+
bulkActions.value.isRecordSelected(row.record, row.index);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function setBulkRowSelected(row = {}, selected = true) {
|
|
104
|
+
if (typeof bulkActions.value?.setRecordSelected !== "function") {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
bulkActions.value.setRecordSelected(row.record, row.index, selected);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function allSelectableRowsSelected() {
|
|
111
|
+
return selectableRows.value.length > 0 && selectableRows.value.every((row) => isBulkRowSelected(row));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function someSelectableRowsSelected() {
|
|
115
|
+
return selectableRows.value.some((row) => isBulkRowSelected(row));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function setSelectableRowsSelected(selected = true) {
|
|
119
|
+
if (typeof bulkActions.value?.setRecordSelected !== "function") {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
for (const row of selectableRows.value) {
|
|
123
|
+
bulkActions.value.setRecordSelected(row.record, row.index, selected);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
</script>
|
|
127
|
+
|
|
128
|
+
<template>
|
|
129
|
+
<section class="generated-ui-screen generated-ui-screen--operator ui-generator-list-element d-flex flex-column ga-4">
|
|
130
|
+
<header class="ui-generator-list-header">
|
|
131
|
+
<div class="ui-generator-list-header__copy">
|
|
132
|
+
<p class="text-overline text-medium-emphasis mb-1">{{ titleLabel }}</p>
|
|
133
|
+
<h1 class="ui-generator-list-header__title">{{ resolvedHeadingTitle }}</h1>
|
|
134
|
+
<p class="text-body-2 text-medium-emphasis mb-0">{{ resolvedSubtitle }}</p>
|
|
135
|
+
</div>
|
|
136
|
+
<div class="ui-generator-list-header__actions">
|
|
137
|
+
<v-btn color="primary" variant="tonal" :loading="records.isFetching" @click="records.reload">Refresh</v-btn>
|
|
138
|
+
<v-btn
|
|
139
|
+
v-if="listPrimaryAction"
|
|
140
|
+
class="ui-generator-list-header__primary-action"
|
|
141
|
+
color="primary"
|
|
142
|
+
variant="flat"
|
|
143
|
+
:to="listPrimaryAction"
|
|
144
|
+
>
|
|
145
|
+
{{ createLabel }}
|
|
146
|
+
</v-btn>
|
|
147
|
+
</div>
|
|
148
|
+
</header>
|
|
149
|
+
|
|
150
|
+
<v-sheet rounded="lg" border class="ui-generator-list-panel">
|
|
151
|
+
<div class="ui-generator-list-toolbar">
|
|
152
|
+
<v-text-field
|
|
153
|
+
v-if="records.searchEnabled"
|
|
154
|
+
v-model="records.searchQuery"
|
|
155
|
+
:label="records.searchLabel"
|
|
156
|
+
:placeholder="records.searchPlaceholder"
|
|
157
|
+
variant="outlined"
|
|
158
|
+
density="comfortable"
|
|
159
|
+
hide-details="auto"
|
|
160
|
+
clearable
|
|
161
|
+
class="ui-generator-list-search"
|
|
162
|
+
:loading="records.isSearchDebouncing"
|
|
163
|
+
/>
|
|
164
|
+
<CrudListFilterSurface
|
|
165
|
+
:filters="listFilters"
|
|
166
|
+
:runtime="filterRuntime"
|
|
167
|
+
/>
|
|
168
|
+
</div>
|
|
169
|
+
<CrudListBulkActionSurface :runtime="bulkActions" />
|
|
170
|
+
|
|
171
|
+
<template v-if="records.showListSkeleton">
|
|
172
|
+
<div class="pa-4">
|
|
173
|
+
<v-skeleton-loader type="text@2, list-item-two-line@5" />
|
|
174
|
+
</div>
|
|
175
|
+
</template>
|
|
176
|
+
<template v-else>
|
|
177
|
+
<v-progress-linear v-if="records.isRefetching" indeterminate />
|
|
178
|
+
|
|
179
|
+
<div v-if="records.loadError" class="ui-generator-list-state">
|
|
180
|
+
<h2 class="text-h6 mb-2">{{ loadErrorTitle }}</h2>
|
|
181
|
+
<p class="text-body-2 text-medium-emphasis mb-4">{{ loadErrorBody }}</p>
|
|
182
|
+
<v-btn color="primary" variant="tonal" :loading="records.isFetching" @click="records.reload">Retry</v-btn>
|
|
183
|
+
</div>
|
|
184
|
+
|
|
185
|
+
<div v-else-if="displayRows.length < 1" class="ui-generator-list-state">
|
|
186
|
+
<h2 class="text-h6 mb-2">{{ emptyTitle }}</h2>
|
|
187
|
+
<p class="text-body-2 text-medium-emphasis mb-4">{{ emptyBody }}</p>
|
|
188
|
+
<v-btn v-if="listPrimaryAction" color="primary" variant="flat" :to="listPrimaryAction">
|
|
189
|
+
{{ createLabel }}
|
|
190
|
+
</v-btn>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
<template v-else>
|
|
194
|
+
<div class="ui-generator-list-cards">
|
|
195
|
+
<v-sheet
|
|
196
|
+
v-for="row in displayRows"
|
|
197
|
+
:key="row.key"
|
|
198
|
+
rounded="lg"
|
|
199
|
+
border
|
|
200
|
+
class="ui-generator-list-card"
|
|
201
|
+
>
|
|
202
|
+
<div class="ui-generator-list-card__header">
|
|
203
|
+
<v-checkbox-btn
|
|
204
|
+
v-if="hasBulkActions && row.selectable !== false"
|
|
205
|
+
:model-value="isBulkRowSelected(row)"
|
|
206
|
+
:aria-label="`Select ${resolveListRecordTitle(row.record)}`"
|
|
207
|
+
class="ui-generator-list-card__select"
|
|
208
|
+
@update:model-value="setBulkRowSelected(row, $event)"
|
|
209
|
+
/>
|
|
210
|
+
<div class="min-w-0">
|
|
211
|
+
<div class="ui-generator-list-card__title">{{ resolveListRecordTitle(row.record) }}</div>
|
|
212
|
+
<div class="text-caption text-medium-emphasis">
|
|
213
|
+
{{ row.recordKey }}
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
<CrudListRecordActionMenu
|
|
217
|
+
v-if="hasViewUrl || hasEditUrl || hasRowActionsFor(row.record, row.index)"
|
|
218
|
+
:record="row.record"
|
|
219
|
+
:index="row.index"
|
|
220
|
+
:row-actions="rowActions"
|
|
221
|
+
:show-view="hasViewUrl && !row.synthetic"
|
|
222
|
+
:show-edit="hasEditUrl && !row.synthetic"
|
|
223
|
+
:view-location="resolveViewLocation(row.record)"
|
|
224
|
+
:edit-location="resolveEditLocation(row.record)"
|
|
225
|
+
/>
|
|
226
|
+
</div>
|
|
227
|
+
<div class="ui-generator-list-card__fields">
|
|
228
|
+
<slot
|
|
229
|
+
name="card-fields"
|
|
230
|
+
:record="row.record"
|
|
231
|
+
:records="records"
|
|
232
|
+
:index="row.index"
|
|
233
|
+
:row="row"
|
|
234
|
+
:format-list-card-value="formatListCardValue"
|
|
235
|
+
/>
|
|
236
|
+
</div>
|
|
237
|
+
</v-sheet>
|
|
238
|
+
</div>
|
|
239
|
+
|
|
240
|
+
<div class="ui-generator-list-table">
|
|
241
|
+
<v-table density="comfortable">
|
|
242
|
+
<thead>
|
|
243
|
+
<tr>
|
|
244
|
+
<th v-if="hasBulkActions" class="ui-generator-list-table__select">
|
|
245
|
+
<v-checkbox-btn
|
|
246
|
+
:model-value="allSelectableRowsSelected()"
|
|
247
|
+
:indeterminate="
|
|
248
|
+
someSelectableRowsSelected() &&
|
|
249
|
+
!allSelectableRowsSelected()
|
|
250
|
+
"
|
|
251
|
+
aria-label="Select visible rows"
|
|
252
|
+
@update:model-value="setSelectableRowsSelected($event)"
|
|
253
|
+
/>
|
|
254
|
+
</th>
|
|
255
|
+
<slot name="table-header" />
|
|
256
|
+
<th v-if="hasViewUrl" class="text-right" />
|
|
257
|
+
<th v-if="hasEditUrl" class="text-right" />
|
|
258
|
+
<th v-if="hasRowActions" class="text-right" />
|
|
259
|
+
</tr>
|
|
260
|
+
</thead>
|
|
261
|
+
<tbody>
|
|
262
|
+
<tr v-for="row in displayRows" :key="row.key">
|
|
263
|
+
<td v-if="hasBulkActions" class="ui-generator-list-table__select">
|
|
264
|
+
<v-checkbox-btn
|
|
265
|
+
v-if="row.selectable !== false"
|
|
266
|
+
:model-value="isBulkRowSelected(row)"
|
|
267
|
+
:aria-label="`Select ${resolveListRecordTitle(row.record)}`"
|
|
268
|
+
@update:model-value="setBulkRowSelected(row, $event)"
|
|
269
|
+
/>
|
|
270
|
+
</td>
|
|
271
|
+
<slot
|
|
272
|
+
name="table-row"
|
|
273
|
+
:record="row.record"
|
|
274
|
+
:records="records"
|
|
275
|
+
:index="row.index"
|
|
276
|
+
:row="row"
|
|
277
|
+
/>
|
|
278
|
+
<td v-if="hasViewUrl" class="text-right">
|
|
279
|
+
<v-btn
|
|
280
|
+
v-if="!row.synthetic"
|
|
281
|
+
size="small"
|
|
282
|
+
color="primary"
|
|
283
|
+
variant="outlined"
|
|
284
|
+
:to="resolveViewLocation(row.record)"
|
|
285
|
+
:disabled="!resolveViewLocation(row.record)"
|
|
286
|
+
>
|
|
287
|
+
Open
|
|
288
|
+
</v-btn>
|
|
289
|
+
</td>
|
|
290
|
+
<td v-if="hasEditUrl" class="text-right">
|
|
291
|
+
<v-btn
|
|
292
|
+
v-if="!row.synthetic"
|
|
293
|
+
size="small"
|
|
294
|
+
color="primary"
|
|
295
|
+
variant="tonal"
|
|
296
|
+
:to="resolveEditLocation(row.record)"
|
|
297
|
+
:disabled="!resolveEditLocation(row.record)"
|
|
298
|
+
>
|
|
299
|
+
Edit
|
|
300
|
+
</v-btn>
|
|
301
|
+
</td>
|
|
302
|
+
<td v-if="hasRowActions" class="text-right">
|
|
303
|
+
<CrudListRecordActionMenu
|
|
304
|
+
v-if="hasRowActionsFor(row.record, row.index)"
|
|
305
|
+
:record="row.record"
|
|
306
|
+
:index="row.index"
|
|
307
|
+
:row-actions="rowActions"
|
|
308
|
+
button-label="More"
|
|
309
|
+
button-variant="outlined"
|
|
310
|
+
/>
|
|
311
|
+
</td>
|
|
312
|
+
</tr>
|
|
313
|
+
</tbody>
|
|
314
|
+
</v-table>
|
|
315
|
+
</div>
|
|
316
|
+
</template>
|
|
317
|
+
|
|
318
|
+
<div v-if="records.hasMore" class="d-flex justify-center pa-4">
|
|
319
|
+
<v-btn color="primary" variant="outlined" :loading="records.isLoadingMore" @click="records.loadMore">
|
|
320
|
+
Load more
|
|
321
|
+
</v-btn>
|
|
322
|
+
</div>
|
|
323
|
+
</template>
|
|
324
|
+
</v-sheet>
|
|
325
|
+
|
|
326
|
+
<v-btn
|
|
327
|
+
v-if="listPrimaryAction"
|
|
328
|
+
class="ui-generator-list-fab"
|
|
329
|
+
color="primary"
|
|
330
|
+
variant="flat"
|
|
331
|
+
:to="listPrimaryAction"
|
|
332
|
+
>
|
|
333
|
+
New
|
|
334
|
+
</v-btn>
|
|
335
|
+
</section>
|
|
336
|
+
</template>
|
|
337
|
+
|
|
338
|
+
<style scoped>
|
|
339
|
+
.generated-ui-screen {
|
|
340
|
+
--generated-ui-screen-title-size: clamp(1.35rem, 2vw, 1.85rem);
|
|
341
|
+
--generated-ui-screen-state-padding: 2.5rem 1.25rem;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.generated-ui-screen--operator {
|
|
345
|
+
--generated-ui-screen-state-padding: 2rem 1rem;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.ui-generator-list-header {
|
|
349
|
+
align-items: flex-start;
|
|
350
|
+
display: flex;
|
|
351
|
+
gap: 1rem;
|
|
352
|
+
justify-content: space-between;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.ui-generator-list-header__copy {
|
|
356
|
+
min-width: 0;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.ui-generator-list-header__title {
|
|
360
|
+
font-size: var(--generated-ui-screen-title-size);
|
|
361
|
+
font-weight: 650;
|
|
362
|
+
letter-spacing: -0.02em;
|
|
363
|
+
line-height: 1.15;
|
|
364
|
+
margin: 0 0 0.35rem;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.ui-generator-list-header__actions {
|
|
368
|
+
display: flex;
|
|
369
|
+
flex-wrap: wrap;
|
|
370
|
+
gap: 0.5rem;
|
|
371
|
+
justify-content: flex-end;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
.ui-generator-list-panel {
|
|
375
|
+
overflow: hidden;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
.ui-generator-list-toolbar {
|
|
379
|
+
padding: 1rem;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.ui-generator-list-search {
|
|
383
|
+
max-width: 26rem;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.ui-generator-list-state {
|
|
387
|
+
margin-inline: auto;
|
|
388
|
+
max-width: 30rem;
|
|
389
|
+
padding: var(--generated-ui-screen-state-padding);
|
|
390
|
+
text-align: center;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.ui-generator-list-cards {
|
|
394
|
+
display: flex;
|
|
395
|
+
flex-direction: column;
|
|
396
|
+
gap: 0.75rem;
|
|
397
|
+
padding: 0 1rem 1rem;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.ui-generator-list-card {
|
|
401
|
+
padding: 0.875rem;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.ui-generator-list-card__header {
|
|
405
|
+
align-items: flex-start;
|
|
406
|
+
display: flex;
|
|
407
|
+
gap: 0.75rem;
|
|
408
|
+
justify-content: space-between;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
.ui-generator-list-card__select {
|
|
412
|
+
flex: 0 0 auto;
|
|
413
|
+
margin-inline-start: -0.35rem;
|
|
414
|
+
margin-top: -0.35rem;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.ui-generator-list-card__title {
|
|
418
|
+
font-size: 1rem;
|
|
419
|
+
font-weight: 650;
|
|
420
|
+
line-height: 1.25;
|
|
421
|
+
overflow-wrap: anywhere;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.ui-generator-list-card__fields {
|
|
425
|
+
display: grid;
|
|
426
|
+
gap: 0.65rem;
|
|
427
|
+
margin-top: 0.85rem;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.ui-generator-list-card__field {
|
|
431
|
+
display: grid;
|
|
432
|
+
gap: 0.15rem;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.ui-generator-list-card__field-label {
|
|
436
|
+
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
|
437
|
+
font-size: 0.72rem;
|
|
438
|
+
letter-spacing: 0.04em;
|
|
439
|
+
line-height: 1.2;
|
|
440
|
+
text-transform: uppercase;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.ui-generator-list-card__field-value {
|
|
444
|
+
font-size: 0.95rem;
|
|
445
|
+
line-height: 1.35;
|
|
446
|
+
overflow-wrap: anywhere;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.ui-generator-list-table {
|
|
450
|
+
display: none;
|
|
451
|
+
overflow-x: auto;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.ui-generator-list-table__select {
|
|
455
|
+
width: 3rem;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.ui-generator-list-fab {
|
|
459
|
+
bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
|
|
460
|
+
display: flex;
|
|
461
|
+
position: fixed;
|
|
462
|
+
right: 1rem;
|
|
463
|
+
z-index: 6;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
@media (min-width: 960px) {
|
|
467
|
+
.ui-generator-list-cards {
|
|
468
|
+
display: none;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.ui-generator-list-table {
|
|
472
|
+
display: block;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.ui-generator-list-fab {
|
|
476
|
+
display: none;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
@media (max-width: 960px) {
|
|
481
|
+
.ui-generator-list-header {
|
|
482
|
+
flex-direction: column;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
.ui-generator-list-header__actions {
|
|
486
|
+
width: 100%;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.ui-generator-list-element :deep(.v-btn) {
|
|
490
|
+
min-height: 48px;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.ui-generator-list-header__primary-action {
|
|
494
|
+
display: none;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.ui-generator-list-search {
|
|
498
|
+
max-width: none;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
</style>
|