@jskit-ai/http-web 0.2.15 → 0.2.16
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/CHANGELOG.md +5 -0
- package/fixtures/crud-list-date-filters/App.vue +3 -3
- package/fixtures/crud-list-date-filters/main.js +3 -9
- package/fixtures/crud-screens/App.vue +14 -0
- package/fixtures/crud-screens/index.html +12 -0
- package/fixtures/crud-screens/main.js +114 -0
- package/fixtures/crud-screens/vite.config.mjs +24 -0
- package/fixtures/select-field/main.js +3 -9
- package/locales/en.json +1 -2
- package/package.json +10 -8
- package/patterns/crud-screen-set/PATTERN.md +13 -0
- package/patterns/crud-screen-set/example/books/BookEditPage.vue +2 -0
- package/patterns/crud-screen-set/example/books/BookFormFields.vue +0 -6
- package/patterns/crud-screen-set/example/books/BookListPage.vue +5 -2
- package/patterns/crud-screen-set/example/books/BookNewPage.vue +2 -0
- package/patterns/crud-screen-set/example/books/BookViewPage.vue +5 -9
- package/src/client/components/CrudAddEditScreen.vue +70 -75
- package/src/client/components/CrudDeleteAction.vue +26 -14
- package/src/client/components/CrudListBulkActionSurface.vue +25 -20
- package/src/client/components/CrudListCreateAction.vue +38 -0
- package/src/client/components/CrudListDateFilterControl.vue +0 -1
- package/src/client/components/CrudListFilterControls.vue +0 -11
- package/src/client/components/CrudListFilterSheet.vue +59 -0
- package/src/client/components/CrudListFilterSurface.vue +58 -84
- package/src/client/components/CrudListRecordActionMenu.vue +14 -18
- package/src/client/components/CrudListScreen.vue +305 -245
- package/src/client/components/CrudViewScreen.vue +84 -99
- package/src/client/composables/records/useCrudAddEdit.js +6 -4
- package/src/client/composables/records/useView.js +1 -0
- package/src/client/composables/runtime/useViewCore.js +4 -4
- package/src/client/composables/useCrudDeleteAction.js +4 -3
- package/src/client/types.js +0 -1
- package/test/crudAddEditActions.test.js +19 -2
- package/test/crudListBulkActionSurface.test.js +3 -2
- package/test/crudListDateFilterSurface.browser.test.js +23 -14
- package/test/crudListFilterSurface.test.js +11 -7
- package/test/crudScreenComponents.test.js +89 -16
- package/test/crudScreenPattern.test.js +3 -0
- package/test/crudScreensMaterialBaselines.browser.test.js +170 -0
- package/test/translation.test.js +6 -2
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, unref } from "vue";
|
|
3
|
-
import { useRoute } from "vue-router";
|
|
3
|
+
import { useRoute, useRouter } from "vue-router";
|
|
4
|
+
import ShellPageAction from "@jskit-ai/shell-web/client/components/ShellPageAction";
|
|
5
|
+
import ShellPageActions from "@jskit-ai/shell-web/client/components/ShellPageActions";
|
|
4
6
|
import CrudListBulkActionSurface from "./CrudListBulkActionSurface.vue";
|
|
7
|
+
import CrudListCreateAction from "./CrudListCreateAction.vue";
|
|
5
8
|
import CrudListFilterSurface from "./CrudListFilterSurface.vue";
|
|
6
9
|
import CrudListRecordActionMenu from "./CrudListRecordActionMenu.vue";
|
|
7
10
|
import { useJskitText } from "../i18n.js";
|
|
@@ -38,6 +41,7 @@ const resolvedEmptyBody = computed(() =>
|
|
|
38
41
|
);
|
|
39
42
|
|
|
40
43
|
const route = useRoute();
|
|
44
|
+
const router = useRouter();
|
|
41
45
|
const records = computed(() => props.screen.records);
|
|
42
46
|
const bulkActions = computed(() => props.screen.bulkActions);
|
|
43
47
|
const rowActions = computed(() => props.screen.rowActions);
|
|
@@ -50,6 +54,10 @@ const hasBulkActions = computed(() => Boolean(unref(bulkActions.value.hasActions
|
|
|
50
54
|
const hasRowActions = computed(() => Boolean(unref(rowActions.value.hasActions)));
|
|
51
55
|
const hasViewUrl = computed(() => Boolean(props.screen.hasViewUrl));
|
|
52
56
|
const hasEditUrl = computed(() => Boolean(props.screen.hasEditUrl));
|
|
57
|
+
const trailingActionCount = computed(() =>
|
|
58
|
+
Number(hasViewUrl.value) + Number(hasEditUrl.value) + Number(hasRowActions.value)
|
|
59
|
+
);
|
|
60
|
+
const trailingActionsWidth = computed(() => `${trailingActionCount.value * 48 + 16}px`);
|
|
53
61
|
|
|
54
62
|
function resolveListRecordTitle(record) {
|
|
55
63
|
return props.screen.resolveRecordTitle(record);
|
|
@@ -69,6 +77,24 @@ function resolveEditLocation(record) {
|
|
|
69
77
|
return path ? { path, query: route.query } : null;
|
|
70
78
|
}
|
|
71
79
|
|
|
80
|
+
// A card or row opens its record: the view page, or the edit page when the list has no view.
|
|
81
|
+
function resolveOpenLocation(row) {
|
|
82
|
+
if (row.synthetic) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return (hasViewUrl.value && resolveViewLocation(row.record)) || (hasEditUrl.value && resolveEditLocation(row.record)) || null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// A click anywhere on a table row opens it, except on the row's own controls.
|
|
89
|
+
function openRow(row, event) {
|
|
90
|
+
const location = resolveOpenLocation(row);
|
|
91
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
92
|
+
if (!location || target?.closest("a, button, input, label, select, textarea, [role='button'], [role='checkbox']")) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
void router.push(location);
|
|
96
|
+
}
|
|
97
|
+
|
|
72
98
|
function hasRowActionsFor(record, index) {
|
|
73
99
|
return rowActions.value.hasVisibleActionsFor(record, index);
|
|
74
100
|
}
|
|
@@ -97,333 +123,367 @@ function setSelectableRowsSelected(selected = true) {
|
|
|
97
123
|
</script>
|
|
98
124
|
|
|
99
125
|
<template>
|
|
100
|
-
<section class="crud-screen crud-
|
|
101
|
-
<
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
126
|
+
<section class="crud-screen crud-list">
|
|
127
|
+
<ShellPageActions>
|
|
128
|
+
<ShellPageAction
|
|
129
|
+
icon="$refresh"
|
|
130
|
+
:label="records.isFetching ? t('jskit.http.actions.refreshing') : t('jskit.http.actions.refresh')"
|
|
105
131
|
:disabled="records.isFetching"
|
|
106
132
|
@click="records.reload"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
/>
|
|
134
|
+
</ShellPageActions>
|
|
135
|
+
<CrudListCreateAction v-if="listPrimaryAction" :label="resolvedCreateLabel" :to="listPrimaryAction" />
|
|
136
|
+
|
|
137
|
+
<div class="crud-list-toolbar">
|
|
138
|
+
<v-text-field
|
|
139
|
+
v-if="records.searchEnabled"
|
|
140
|
+
v-model="records.searchQuery"
|
|
141
|
+
:placeholder="records.searchPlaceholder || records.searchLabel"
|
|
142
|
+
:aria-label="records.searchLabel"
|
|
143
|
+
variant="solo-filled"
|
|
144
|
+
bg-color="surface-container-high"
|
|
145
|
+
flat
|
|
146
|
+
rounded="pill"
|
|
147
|
+
single-line
|
|
148
|
+
hide-details
|
|
149
|
+
clearable
|
|
150
|
+
prepend-inner-icon="$search"
|
|
151
|
+
class="crud-list-search"
|
|
152
|
+
:aria-busy="records.isSearchDebouncing ? 'true' : undefined"
|
|
153
|
+
/>
|
|
154
|
+
<CrudListFilterSurface
|
|
155
|
+
:filters="listFilters"
|
|
156
|
+
:runtime="filterRuntime"
|
|
157
|
+
/>
|
|
119
158
|
</div>
|
|
159
|
+
<CrudListBulkActionSurface :runtime="bulkActions" />
|
|
160
|
+
|
|
161
|
+
<v-skeleton-loader v-if="records.showListSkeleton" type="list-item-two-line@5" />
|
|
162
|
+
<template v-else>
|
|
163
|
+
<div v-if="records.loadError" class="crud-list-state">
|
|
164
|
+
<v-icon icon="$cloudOff" size="48" class="crud-list-state__icon" />
|
|
165
|
+
<p class="text-body-large">{{ resolvedLoadErrorBody }}</p>
|
|
166
|
+
<v-btn
|
|
167
|
+
color="secondary-container"
|
|
168
|
+
prepend-icon="$refresh"
|
|
169
|
+
:disabled="records.isFetching"
|
|
170
|
+
@click="records.reload"
|
|
171
|
+
>
|
|
172
|
+
{{ records.isFetching ? t("jskit.http.actions.retrying") : t("jskit.http.actions.retry") }}
|
|
173
|
+
</v-btn>
|
|
174
|
+
</div>
|
|
120
175
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
:placeholder="records.searchPlaceholder"
|
|
128
|
-
variant="outlined"
|
|
129
|
-
density="comfortable"
|
|
130
|
-
hide-details="auto"
|
|
131
|
-
clearable
|
|
132
|
-
class="crud-list-search"
|
|
133
|
-
:aria-busy="records.isSearchDebouncing ? 'true' : undefined"
|
|
134
|
-
/>
|
|
135
|
-
<CrudListFilterSurface
|
|
136
|
-
:filters="listFilters"
|
|
137
|
-
:runtime="filterRuntime"
|
|
138
|
-
/>
|
|
176
|
+
<div v-else-if="displayRows.length < 1" class="crud-list-state">
|
|
177
|
+
<v-icon icon="$inbox" size="48" class="crud-list-state__icon" />
|
|
178
|
+
<p class="text-body-large">{{ resolvedEmptyBody }}</p>
|
|
179
|
+
<v-btn v-if="listPrimaryAction" prepend-icon="$add" :to="listPrimaryAction">
|
|
180
|
+
{{ resolvedCreateLabel }}
|
|
181
|
+
</v-btn>
|
|
139
182
|
</div>
|
|
140
|
-
<CrudListBulkActionSurface :runtime="bulkActions" />
|
|
141
183
|
|
|
142
|
-
<template v-if="records.showListSkeleton">
|
|
143
|
-
<div class="pa-4">
|
|
144
|
-
<v-skeleton-loader type="text@2, list-item-two-line@5" />
|
|
145
|
-
</div>
|
|
146
|
-
</template>
|
|
147
184
|
<template v-else>
|
|
148
|
-
<div
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
:disabled="records.isFetching"
|
|
154
|
-
@click="records.reload"
|
|
185
|
+
<div class="crud-list-cards">
|
|
186
|
+
<v-card
|
|
187
|
+
v-for="row in displayRows"
|
|
188
|
+
:key="row.key"
|
|
189
|
+
class="crud-list-card"
|
|
155
190
|
>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
191
|
+
<div class="crud-list-card__header">
|
|
192
|
+
<v-checkbox-btn
|
|
193
|
+
v-if="hasBulkActions && row.selectable !== false"
|
|
194
|
+
:model-value="isBulkRowSelected(row)"
|
|
195
|
+
:aria-label="t('jskit.http.crud.list.selectRecord', { title: resolveListRecordTitle(row.record) })"
|
|
196
|
+
class="crud-list-card__control"
|
|
197
|
+
@update:model-value="setBulkRowSelected(row, $event)"
|
|
198
|
+
/>
|
|
199
|
+
<div class="crud-list-card__heading">
|
|
200
|
+
<RouterLink
|
|
201
|
+
v-if="resolveOpenLocation(row)"
|
|
202
|
+
class="crud-list-card__title crud-list-card__link"
|
|
203
|
+
:to="resolveOpenLocation(row)"
|
|
204
|
+
>
|
|
205
|
+
{{ resolveListRecordTitle(row.record) }}
|
|
206
|
+
</RouterLink>
|
|
207
|
+
<div v-else class="crud-list-card__title">{{ resolveListRecordTitle(row.record) }}</div>
|
|
208
|
+
</div>
|
|
209
|
+
<CrudListRecordActionMenu
|
|
210
|
+
v-if="(hasViewUrl && hasEditUrl) || hasRowActionsFor(row.record, row.index)"
|
|
211
|
+
class="crud-list-card__control"
|
|
212
|
+
:record="row.record"
|
|
213
|
+
:index="row.index"
|
|
214
|
+
:title="resolveListRecordTitle(row.record)"
|
|
215
|
+
:row-actions="rowActions"
|
|
216
|
+
:show-edit="hasViewUrl && hasEditUrl && !row.synthetic"
|
|
217
|
+
:edit-location="resolveEditLocation(row.record)"
|
|
218
|
+
/>
|
|
219
|
+
</div>
|
|
220
|
+
<div class="crud-list-card__fields">
|
|
221
|
+
<slot
|
|
222
|
+
name="card-fields"
|
|
223
|
+
:record="row.record"
|
|
224
|
+
:records="records"
|
|
225
|
+
:index="row.index"
|
|
226
|
+
:row="row"
|
|
227
|
+
:format-list-card-value="formatListCardValue"
|
|
228
|
+
/>
|
|
229
|
+
</div>
|
|
230
|
+
</v-card>
|
|
165
231
|
</div>
|
|
166
232
|
|
|
167
|
-
<
|
|
168
|
-
<
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
{{ row.recordKey }}
|
|
188
|
-
</div>
|
|
189
|
-
</div>
|
|
190
|
-
<CrudListRecordActionMenu
|
|
191
|
-
v-if="hasViewUrl || hasEditUrl || hasRowActionsFor(row.record, row.index)"
|
|
192
|
-
:record="row.record"
|
|
193
|
-
:index="row.index"
|
|
194
|
-
:row-actions="rowActions"
|
|
195
|
-
:show-view="hasViewUrl && !row.synthetic"
|
|
196
|
-
:show-edit="hasEditUrl && !row.synthetic"
|
|
197
|
-
:view-location="resolveViewLocation(row.record)"
|
|
198
|
-
:edit-location="resolveEditLocation(row.record)"
|
|
233
|
+
<div class="crud-list-table">
|
|
234
|
+
<v-table>
|
|
235
|
+
<thead>
|
|
236
|
+
<tr>
|
|
237
|
+
<th v-if="hasBulkActions" class="crud-list-table__select">
|
|
238
|
+
<v-checkbox-btn
|
|
239
|
+
:model-value="allSelectableRowsSelected()"
|
|
240
|
+
:indeterminate="
|
|
241
|
+
someSelectableRowsSelected() &&
|
|
242
|
+
!allSelectableRowsSelected()
|
|
243
|
+
"
|
|
244
|
+
:aria-label="t('jskit.http.crud.list.selectVisibleRows')"
|
|
245
|
+
@update:model-value="setSelectableRowsSelected($event)"
|
|
246
|
+
/>
|
|
247
|
+
</th>
|
|
248
|
+
<slot name="table-header" />
|
|
249
|
+
<th
|
|
250
|
+
v-if="trailingActionCount > 0"
|
|
251
|
+
class="crud-list-table__actions"
|
|
252
|
+
:style="{ width: trailingActionsWidth }"
|
|
199
253
|
/>
|
|
200
|
-
</
|
|
201
|
-
|
|
254
|
+
</tr>
|
|
255
|
+
</thead>
|
|
256
|
+
<tbody>
|
|
257
|
+
<tr
|
|
258
|
+
v-for="row in displayRows"
|
|
259
|
+
:key="row.key"
|
|
260
|
+
:class="{ 'crud-list-table__row--link': resolveOpenLocation(row) }"
|
|
261
|
+
@click="openRow(row, $event)"
|
|
262
|
+
>
|
|
263
|
+
<td v-if="hasBulkActions" class="crud-list-table__select">
|
|
264
|
+
<v-checkbox-btn
|
|
265
|
+
v-if="row.selectable !== false"
|
|
266
|
+
:model-value="isBulkRowSelected(row)"
|
|
267
|
+
:aria-label="t('jskit.http.crud.list.selectRecord', { title: resolveListRecordTitle(row.record) })"
|
|
268
|
+
@update:model-value="setBulkRowSelected(row, $event)"
|
|
269
|
+
/>
|
|
270
|
+
</td>
|
|
202
271
|
<slot
|
|
203
|
-
name="
|
|
272
|
+
name="table-row"
|
|
204
273
|
:record="row.record"
|
|
205
274
|
:records="records"
|
|
206
275
|
:index="row.index"
|
|
207
276
|
:row="row"
|
|
208
|
-
:format-list-card-value="formatListCardValue"
|
|
209
277
|
/>
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
<td v-if="hasBulkActions" class="crud-list-table__select">
|
|
238
|
-
<v-checkbox-btn
|
|
239
|
-
v-if="row.selectable !== false"
|
|
240
|
-
:model-value="isBulkRowSelected(row)"
|
|
241
|
-
:aria-label="t('jskit.http.crud.list.selectRecord', { title: resolveListRecordTitle(row.record) })"
|
|
242
|
-
@update:model-value="setBulkRowSelected(row, $event)"
|
|
243
|
-
/>
|
|
244
|
-
</td>
|
|
245
|
-
<slot
|
|
246
|
-
name="table-row"
|
|
278
|
+
<td v-if="trailingActionCount > 0" class="crud-list-table__actions">
|
|
279
|
+
<v-btn
|
|
280
|
+
v-if="hasViewUrl && !row.synthetic"
|
|
281
|
+
icon
|
|
282
|
+
variant="text"
|
|
283
|
+
color="on-surface-variant"
|
|
284
|
+
:to="resolveViewLocation(row.record)"
|
|
285
|
+
:disabled="!resolveViewLocation(row.record)"
|
|
286
|
+
:aria-label="t('jskit.http.actions.open')"
|
|
287
|
+
>
|
|
288
|
+
<v-icon icon="$chevronRight" />
|
|
289
|
+
<v-tooltip activator="parent" location="top" :text="t('jskit.http.actions.open')" />
|
|
290
|
+
</v-btn>
|
|
291
|
+
<v-btn
|
|
292
|
+
v-if="hasEditUrl && !row.synthetic"
|
|
293
|
+
icon
|
|
294
|
+
variant="text"
|
|
295
|
+
color="on-surface-variant"
|
|
296
|
+
:to="resolveEditLocation(row.record)"
|
|
297
|
+
:disabled="!resolveEditLocation(row.record)"
|
|
298
|
+
:aria-label="t('jskit.http.actions.edit')"
|
|
299
|
+
>
|
|
300
|
+
<v-icon icon="$edit" />
|
|
301
|
+
<v-tooltip activator="parent" location="top" :text="t('jskit.http.actions.edit')" />
|
|
302
|
+
</v-btn>
|
|
303
|
+
<CrudListRecordActionMenu
|
|
304
|
+
v-if="hasRowActions && hasRowActionsFor(row.record, row.index)"
|
|
247
305
|
:record="row.record"
|
|
248
|
-
:records="records"
|
|
249
306
|
:index="row.index"
|
|
250
|
-
:
|
|
307
|
+
:title="resolveListRecordTitle(row.record)"
|
|
308
|
+
:row-actions="rowActions"
|
|
251
309
|
/>
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
color="primary"
|
|
257
|
-
variant="outlined"
|
|
258
|
-
:to="resolveViewLocation(row.record)"
|
|
259
|
-
:disabled="!resolveViewLocation(row.record)"
|
|
260
|
-
>
|
|
261
|
-
{{ t("jskit.http.actions.open") }}
|
|
262
|
-
</v-btn>
|
|
263
|
-
</td>
|
|
264
|
-
<td v-if="hasEditUrl" class="text-right">
|
|
265
|
-
<v-btn
|
|
266
|
-
v-if="!row.synthetic"
|
|
267
|
-
size="small"
|
|
268
|
-
color="primary"
|
|
269
|
-
variant="tonal"
|
|
270
|
-
:to="resolveEditLocation(row.record)"
|
|
271
|
-
:disabled="!resolveEditLocation(row.record)"
|
|
272
|
-
>
|
|
273
|
-
{{ t("jskit.http.actions.edit") }}
|
|
274
|
-
</v-btn>
|
|
275
|
-
</td>
|
|
276
|
-
<td v-if="hasRowActions" class="text-right">
|
|
277
|
-
<CrudListRecordActionMenu
|
|
278
|
-
v-if="hasRowActionsFor(row.record, row.index)"
|
|
279
|
-
:record="row.record"
|
|
280
|
-
:index="row.index"
|
|
281
|
-
:row-actions="rowActions"
|
|
282
|
-
:button-label="t('jskit.http.actions.more')"
|
|
283
|
-
button-variant="outlined"
|
|
284
|
-
/>
|
|
285
|
-
</td>
|
|
286
|
-
</tr>
|
|
287
|
-
</tbody>
|
|
288
|
-
</v-table>
|
|
289
|
-
</div>
|
|
290
|
-
</template>
|
|
291
|
-
|
|
292
|
-
<div v-if="records.hasMore" class="d-flex justify-center pa-4">
|
|
293
|
-
<v-btn
|
|
294
|
-
color="primary"
|
|
295
|
-
variant="outlined"
|
|
296
|
-
:disabled="records.isLoadingMore"
|
|
297
|
-
@click="records.loadMore"
|
|
298
|
-
>
|
|
299
|
-
{{ records.isLoadingMore ? t("jskit.http.actions.loadingMore") : t("jskit.http.actions.loadMore") }}
|
|
300
|
-
</v-btn>
|
|
310
|
+
</td>
|
|
311
|
+
</tr>
|
|
312
|
+
</tbody>
|
|
313
|
+
</v-table>
|
|
301
314
|
</div>
|
|
302
315
|
</template>
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
316
|
+
|
|
317
|
+
<div v-if="records.hasMore" class="crud-list-more">
|
|
318
|
+
<v-btn
|
|
319
|
+
variant="outlined"
|
|
320
|
+
color="primary"
|
|
321
|
+
:disabled="records.isLoadingMore"
|
|
322
|
+
@click="records.loadMore"
|
|
323
|
+
>
|
|
324
|
+
{{ records.isLoadingMore ? t("jskit.http.actions.loadingMore") : t("jskit.http.actions.loadMore") }}
|
|
325
|
+
</v-btn>
|
|
326
|
+
</div>
|
|
327
|
+
</template>
|
|
314
328
|
</section>
|
|
315
329
|
</template>
|
|
316
330
|
|
|
317
331
|
<style scoped>
|
|
318
|
-
|
|
332
|
+
/* The list picks cards or a table from its own width, so it never scrolls sideways beside a drawer or a detail pane. */
|
|
333
|
+
.crud-list {
|
|
334
|
+
container: crud-list / inline-size;
|
|
319
335
|
display: flex;
|
|
320
|
-
flex-
|
|
321
|
-
gap:
|
|
322
|
-
|
|
336
|
+
flex-direction: column;
|
|
337
|
+
gap: 16px;
|
|
338
|
+
min-width: 0;
|
|
323
339
|
}
|
|
324
340
|
|
|
325
|
-
.crud-list-
|
|
326
|
-
|
|
341
|
+
.crud-list-toolbar {
|
|
342
|
+
display: flex;
|
|
343
|
+
flex-direction: column;
|
|
344
|
+
gap: 12px;
|
|
345
|
+
min-width: 0;
|
|
327
346
|
}
|
|
328
347
|
|
|
329
|
-
.crud-list-toolbar {
|
|
330
|
-
|
|
348
|
+
.crud-list-toolbar:empty {
|
|
349
|
+
display: none;
|
|
331
350
|
}
|
|
332
351
|
|
|
333
352
|
.crud-list-search {
|
|
334
|
-
max-width:
|
|
353
|
+
max-width: 720px;
|
|
354
|
+
width: 100%;
|
|
335
355
|
}
|
|
336
356
|
|
|
337
357
|
.crud-list-state {
|
|
358
|
+
align-items: center;
|
|
359
|
+
color: rgb(var(--v-theme-on-surface-variant));
|
|
360
|
+
display: flex;
|
|
361
|
+
flex-direction: column;
|
|
362
|
+
gap: 16px;
|
|
338
363
|
margin-inline: auto;
|
|
339
|
-
max-width:
|
|
340
|
-
padding:
|
|
364
|
+
max-width: 480px;
|
|
365
|
+
padding: 48px 16px;
|
|
341
366
|
text-align: center;
|
|
342
367
|
}
|
|
343
368
|
|
|
344
369
|
.crud-list-cards {
|
|
345
370
|
display: flex;
|
|
346
371
|
flex-direction: column;
|
|
347
|
-
gap:
|
|
348
|
-
padding: 0 1rem 1rem;
|
|
372
|
+
gap: 8px;
|
|
349
373
|
}
|
|
350
374
|
|
|
351
375
|
.crud-list-card {
|
|
352
|
-
padding:
|
|
376
|
+
padding: 16px;
|
|
377
|
+
position: relative;
|
|
353
378
|
}
|
|
354
379
|
|
|
355
380
|
.crud-list-card__header {
|
|
356
381
|
align-items: flex-start;
|
|
357
382
|
display: flex;
|
|
358
|
-
gap:
|
|
359
|
-
justify-content: space-between;
|
|
383
|
+
gap: 12px;
|
|
360
384
|
}
|
|
361
385
|
|
|
362
|
-
.crud-list-
|
|
386
|
+
.crud-list-card__heading {
|
|
387
|
+
flex: 1 1 auto;
|
|
388
|
+
min-width: 0;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.crud-list-card__control {
|
|
363
392
|
flex: 0 0 auto;
|
|
364
|
-
margin-
|
|
365
|
-
|
|
393
|
+
margin-block: -8px;
|
|
394
|
+
position: relative;
|
|
395
|
+
z-index: 1;
|
|
366
396
|
}
|
|
367
397
|
|
|
368
398
|
.crud-list-card__title {
|
|
399
|
+
color: rgb(var(--v-theme-on-surface));
|
|
400
|
+
display: block;
|
|
369
401
|
font-size: 1rem;
|
|
370
|
-
font-weight:
|
|
371
|
-
|
|
402
|
+
font-weight: 500;
|
|
403
|
+
letter-spacing: 0.009375rem;
|
|
404
|
+
line-height: 1.5rem;
|
|
372
405
|
overflow-wrap: anywhere;
|
|
406
|
+
text-decoration: none;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/* The title link covers the whole card, so a tap anywhere opens the record; the card's controls sit above it. */
|
|
410
|
+
.crud-list-card__link::after {
|
|
411
|
+
border-radius: inherit;
|
|
412
|
+
content: "";
|
|
413
|
+
inset: 0;
|
|
414
|
+
position: absolute;
|
|
415
|
+
transition: background-color 200ms cubic-bezier(0.2, 0, 0, 1);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.crud-list-card__link:hover::after {
|
|
419
|
+
background: rgba(var(--v-theme-on-surface), var(--v-hover-opacity));
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.crud-list-card__link:focus-visible {
|
|
423
|
+
outline: none;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.crud-list-card__link:focus-visible::after {
|
|
427
|
+
outline: 3px solid rgb(var(--v-theme-secondary));
|
|
428
|
+
outline-offset: 2px;
|
|
373
429
|
}
|
|
374
430
|
|
|
375
431
|
.crud-list-card__fields {
|
|
432
|
+
color: rgb(var(--v-theme-on-surface-variant));
|
|
376
433
|
display: grid;
|
|
377
|
-
gap:
|
|
378
|
-
|
|
434
|
+
gap: 8px;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.crud-list-card__fields:not(:empty) {
|
|
438
|
+
margin-top: 12px;
|
|
379
439
|
}
|
|
380
440
|
|
|
381
441
|
.crud-list-table {
|
|
382
442
|
display: none;
|
|
383
|
-
overflow-x: auto;
|
|
384
443
|
}
|
|
385
444
|
|
|
386
|
-
.crud-list-
|
|
387
|
-
|
|
445
|
+
.crud-list-table :deep(table) {
|
|
446
|
+
table-layout: fixed;
|
|
388
447
|
}
|
|
389
448
|
|
|
390
|
-
.crud-list-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
z-index: 6;
|
|
449
|
+
.crud-list-table :deep(th),
|
|
450
|
+
.crud-list-table :deep(td) {
|
|
451
|
+
overflow: hidden;
|
|
452
|
+
text-overflow: ellipsis;
|
|
453
|
+
white-space: nowrap;
|
|
396
454
|
}
|
|
397
455
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
}
|
|
456
|
+
.crud-list-table__select {
|
|
457
|
+
width: 56px;
|
|
458
|
+
}
|
|
402
459
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
460
|
+
.crud-list-table .crud-list-table__actions {
|
|
461
|
+
overflow: visible;
|
|
462
|
+
padding-inline: 8px;
|
|
463
|
+
text-align: end;
|
|
464
|
+
}
|
|
406
465
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
466
|
+
.crud-list-table__row--link {
|
|
467
|
+
cursor: pointer;
|
|
410
468
|
}
|
|
411
469
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
470
|
+
.crud-list-table__row--link:hover > td {
|
|
471
|
+
background: rgba(var(--v-theme-on-surface), var(--v-hover-opacity));
|
|
472
|
+
}
|
|
416
473
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
474
|
+
.crud-list-more {
|
|
475
|
+
display: flex;
|
|
476
|
+
justify-content: center;
|
|
477
|
+
padding: 8px 0 16px;
|
|
478
|
+
}
|
|
420
479
|
|
|
421
|
-
|
|
480
|
+
@container crud-list (min-width: 720px) {
|
|
481
|
+
.crud-list-cards {
|
|
422
482
|
display: none;
|
|
423
483
|
}
|
|
424
484
|
|
|
425
|
-
.crud-list-
|
|
426
|
-
|
|
485
|
+
.crud-list-table {
|
|
486
|
+
display: block;
|
|
427
487
|
}
|
|
428
488
|
}
|
|
429
489
|
</style>
|