@jskit-ai/http-web 0.2.14 → 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,8 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, useId } from "vue";
|
|
3
|
-
import
|
|
3
|
+
import ShellPageAction from "@jskit-ai/shell-web/client/components/ShellPageAction";
|
|
4
4
|
import { useJskitText } from "../i18n.js";
|
|
5
5
|
|
|
6
|
+
// Delete as a page action (in the top app bar, an icon on compact windows), confirmed in a Material 3 dialog.
|
|
7
|
+
|
|
6
8
|
const props = defineProps({
|
|
7
9
|
action: {
|
|
8
10
|
type: /** @type {import("vue").PropType<import("../types.js").CrudDeleteAction>} */ (Object),
|
|
@@ -35,20 +37,16 @@ function handleDialogModelUpdate(isOpen) {
|
|
|
35
37
|
</script>
|
|
36
38
|
|
|
37
39
|
<template>
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
:prepend-icon="mdiDeleteOutline"
|
|
42
|
-
min-height="48"
|
|
40
|
+
<ShellPageAction
|
|
41
|
+
icon="$delete"
|
|
42
|
+
:label="t('jskit.http.crud.delete.button', { resource: resourceLabel })"
|
|
43
43
|
:disabled="!action.canDelete"
|
|
44
44
|
@click="action.request"
|
|
45
|
-
|
|
46
|
-
{{ t("jskit.http.crud.delete.button", { resource: resourceLabel }) }}
|
|
47
|
-
</v-btn>
|
|
45
|
+
/>
|
|
48
46
|
|
|
49
47
|
<v-dialog
|
|
50
48
|
:model-value="action.isOpen"
|
|
51
|
-
max-width="
|
|
49
|
+
max-width="560"
|
|
52
50
|
role="alertdialog"
|
|
53
51
|
aria-modal="true"
|
|
54
52
|
:aria-labelledby="titleId"
|
|
@@ -57,7 +55,9 @@ function handleDialogModelUpdate(isOpen) {
|
|
|
57
55
|
@update:model-value="handleDialogModelUpdate"
|
|
58
56
|
>
|
|
59
57
|
<v-card>
|
|
60
|
-
<v-card-title :id="titleId"
|
|
58
|
+
<v-card-title :id="titleId" class="crud-delete-action__headline">
|
|
59
|
+
{{ t("jskit.http.crud.delete.title", { resource: resourceLabel }) }}
|
|
60
|
+
</v-card-title>
|
|
61
61
|
<v-card-text>
|
|
62
62
|
<p :id="descriptionId" class="mb-0">
|
|
63
63
|
{{ t("jskit.http.crud.delete.description", { resource: resourceLabel.toLowerCase() }) }}
|
|
@@ -65,8 +65,10 @@ function handleDialogModelUpdate(isOpen) {
|
|
|
65
65
|
<v-alert
|
|
66
66
|
v-if="action.error"
|
|
67
67
|
class="mt-4"
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
color="error-container"
|
|
69
|
+
icon="$warning"
|
|
70
|
+
variant="flat"
|
|
71
|
+
:rounded="12"
|
|
70
72
|
>
|
|
71
73
|
{{ action.error }}
|
|
72
74
|
</v-alert>
|
|
@@ -83,7 +85,7 @@ function handleDialogModelUpdate(isOpen) {
|
|
|
83
85
|
</v-btn>
|
|
84
86
|
<v-btn
|
|
85
87
|
color="error"
|
|
86
|
-
variant="
|
|
88
|
+
variant="text"
|
|
87
89
|
:disabled="!action.canDelete"
|
|
88
90
|
@click="action.confirm"
|
|
89
91
|
>
|
|
@@ -93,3 +95,13 @@ function handleDialogModelUpdate(isOpen) {
|
|
|
93
95
|
</v-card>
|
|
94
96
|
</v-dialog>
|
|
95
97
|
</template>
|
|
98
|
+
|
|
99
|
+
<style scoped>
|
|
100
|
+
.crud-delete-action__headline {
|
|
101
|
+
font-size: 1.5rem;
|
|
102
|
+
font-weight: 400;
|
|
103
|
+
line-height: 2rem;
|
|
104
|
+
padding: 24px 24px 16px;
|
|
105
|
+
white-space: normal;
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { useShellWindowSizeClass } from "@jskit-ai/shell-web/client/composables/useShellWindowSizeClass";
|
|
4
4
|
import { useJskitText } from "../i18n.js";
|
|
5
5
|
|
|
6
6
|
const props = defineProps({
|
|
@@ -19,7 +19,7 @@ const resolvedTitle = computed(() =>
|
|
|
19
19
|
props.title === undefined ? t("jskit.http.crud.bulk.selection") : text(props.title)
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
const {
|
|
22
|
+
const { isCompact: isCompactLayout } = useShellWindowSizeClass();
|
|
23
23
|
|
|
24
24
|
const actions = computed(() => props.runtime.actions);
|
|
25
25
|
const selectedCount = computed(() => props.runtime.selectedCount.value);
|
|
@@ -56,10 +56,10 @@ function actionLabel(action = {}) {
|
|
|
56
56
|
<section v-if="shouldRender" class="crud-list-bulk-action-surface">
|
|
57
57
|
<div class="crud-list-bulk-action-surface__summary">
|
|
58
58
|
<div class="crud-list-bulk-action-surface__copy">
|
|
59
|
-
<span class="
|
|
60
|
-
<
|
|
59
|
+
<span class="crud-list-bulk-action-surface__title">{{ resolvedTitle }}</span>
|
|
60
|
+
<span class="crud-list-bulk-action-surface__count">{{ t("jskit.http.crud.bulk.selected", { count: selectedCount }) }}</span>
|
|
61
61
|
</div>
|
|
62
|
-
<v-btn
|
|
62
|
+
<v-btn variant="text" color="on-secondary-container" @click="clearSelection">{{ t("jskit.http.actions.clear") }}</v-btn>
|
|
63
63
|
</div>
|
|
64
64
|
|
|
65
65
|
<div v-if="!isCompactLayout" class="crud-list-bulk-action-surface__actions">
|
|
@@ -78,9 +78,9 @@ function actionLabel(action = {}) {
|
|
|
78
78
|
|
|
79
79
|
<v-menu v-else location="bottom end">
|
|
80
80
|
<template #activator="{ props: menuProps }">
|
|
81
|
-
<v-btn v-bind="menuProps" color="primary"
|
|
81
|
+
<v-btn v-bind="menuProps" color="primary">{{ t("jskit.http.crud.bulk.actions") }}</v-btn>
|
|
82
82
|
</template>
|
|
83
|
-
<v-list
|
|
83
|
+
<v-list min-width="180">
|
|
84
84
|
<v-list-item
|
|
85
85
|
v-for="action in actions"
|
|
86
86
|
:key="action.key"
|
|
@@ -95,15 +95,18 @@ function actionLabel(action = {}) {
|
|
|
95
95
|
</template>
|
|
96
96
|
|
|
97
97
|
<style scoped>
|
|
98
|
+
/* A selection toolbar in the secondary container, as Material 3 marks a selected state. */
|
|
98
99
|
.crud-list-bulk-action-surface {
|
|
99
100
|
align-items: center;
|
|
100
|
-
background:
|
|
101
|
-
border-
|
|
101
|
+
background: rgb(var(--v-theme-secondary-container));
|
|
102
|
+
border-radius: 16px;
|
|
103
|
+
color: rgb(var(--v-theme-on-secondary-container));
|
|
102
104
|
display: flex;
|
|
103
|
-
|
|
105
|
+
flex-wrap: wrap;
|
|
106
|
+
gap: 8px;
|
|
104
107
|
justify-content: space-between;
|
|
105
108
|
min-width: 0;
|
|
106
|
-
padding:
|
|
109
|
+
padding: 8px 8px 8px 16px;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
.crud-list-bulk-action-surface__summary,
|
|
@@ -111,24 +114,26 @@ function actionLabel(action = {}) {
|
|
|
111
114
|
align-items: center;
|
|
112
115
|
display: flex;
|
|
113
116
|
flex-wrap: wrap;
|
|
114
|
-
gap:
|
|
117
|
+
gap: 8px;
|
|
115
118
|
min-width: 0;
|
|
116
119
|
}
|
|
117
120
|
|
|
118
121
|
.crud-list-bulk-action-surface__copy {
|
|
119
122
|
display: grid;
|
|
120
|
-
gap: 0.1rem;
|
|
121
123
|
min-width: 0;
|
|
122
124
|
}
|
|
123
125
|
|
|
124
|
-
.crud-list-bulk-action-
|
|
125
|
-
|
|
126
|
+
.crud-list-bulk-action-surface__title {
|
|
127
|
+
font-size: 0.75rem;
|
|
128
|
+
font-weight: 500;
|
|
129
|
+
letter-spacing: 0.03125rem;
|
|
130
|
+
line-height: 1rem;
|
|
126
131
|
}
|
|
127
132
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
.crud-list-bulk-action-surface__count {
|
|
134
|
+
font-size: 1rem;
|
|
135
|
+
font-weight: 500;
|
|
136
|
+
letter-spacing: 0.009375rem;
|
|
137
|
+
line-height: 1.5rem;
|
|
133
138
|
}
|
|
134
139
|
</style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import ShellPageAction from "@jskit-ai/shell-web/client/components/ShellPageAction";
|
|
3
|
+
import ShellPageActions from "@jskit-ai/shell-web/client/components/ShellPageActions";
|
|
4
|
+
import { useShellWindowSizeClass } from "@jskit-ai/shell-web/client/composables/useShellWindowSizeClass";
|
|
5
|
+
|
|
6
|
+
// A list's create action as Material 3 places it: an extended FAB above the navigation bar or beside the rail on
|
|
7
|
+
// compact and medium windows, the app bar's filled primary action on expanded and large ones. Its layout order puts
|
|
8
|
+
// it inside the shell's navigation bar, so the FAB sits above the bar instead of over it.
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
label: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true
|
|
13
|
+
},
|
|
14
|
+
to: {
|
|
15
|
+
type: [String, Object],
|
|
16
|
+
required: true
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const { isCompact, isMedium } = useShellWindowSizeClass();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<v-fab
|
|
25
|
+
v-if="isCompact || isMedium"
|
|
26
|
+
class="crud-list-fab"
|
|
27
|
+
app
|
|
28
|
+
extended
|
|
29
|
+
location="bottom end"
|
|
30
|
+
order="1"
|
|
31
|
+
prepend-icon="$add"
|
|
32
|
+
:text="props.label"
|
|
33
|
+
:to="props.to"
|
|
34
|
+
/>
|
|
35
|
+
<ShellPageActions v-else>
|
|
36
|
+
<ShellPageAction primary icon="$add" :label="props.label" :to="props.to" />
|
|
37
|
+
</ShellPageActions>
|
|
38
|
+
</template>
|
|
@@ -50,7 +50,6 @@ function placeholder(filter = {}, fallbackKey = "") {
|
|
|
50
50
|
v-model="runtimeValues[filter.key]"
|
|
51
51
|
:label="filterLabel(filter)"
|
|
52
52
|
color="primary"
|
|
53
|
-
density="comfortable"
|
|
54
53
|
hide-details
|
|
55
54
|
class="crud-list-filter-surface__control"
|
|
56
55
|
/>
|
|
@@ -66,8 +65,6 @@ function placeholder(filter = {}, fallbackKey = "") {
|
|
|
66
65
|
clearable
|
|
67
66
|
item-title="label"
|
|
68
67
|
item-value="value"
|
|
69
|
-
variant="outlined"
|
|
70
|
-
density="comfortable"
|
|
71
68
|
hide-details="auto"
|
|
72
69
|
class="crud-list-filter-surface__control"
|
|
73
70
|
/>
|
|
@@ -80,8 +77,6 @@ function placeholder(filter = {}, fallbackKey = "") {
|
|
|
80
77
|
chips
|
|
81
78
|
closable-chips
|
|
82
79
|
clearable
|
|
83
|
-
variant="outlined"
|
|
84
|
-
density="comfortable"
|
|
85
80
|
hide-details="auto"
|
|
86
81
|
class="crud-list-filter-surface__control"
|
|
87
82
|
/>
|
|
@@ -91,8 +86,6 @@ function placeholder(filter = {}, fallbackKey = "") {
|
|
|
91
86
|
:label="filterLabel(filter)"
|
|
92
87
|
:placeholder="placeholder(filter, 'jskit.http.crud.filters.enterId')"
|
|
93
88
|
clearable
|
|
94
|
-
variant="outlined"
|
|
95
|
-
density="comfortable"
|
|
96
89
|
hide-details="auto"
|
|
97
90
|
class="crud-list-filter-surface__control"
|
|
98
91
|
/>
|
|
@@ -122,16 +115,12 @@ function placeholder(filter = {}, fallbackKey = "") {
|
|
|
122
115
|
v-model="runtimeValues[filter.key].min"
|
|
123
116
|
:label="filterLabel(filter, 'jskit.http.crud.filters.rangeMin')"
|
|
124
117
|
type="number"
|
|
125
|
-
variant="outlined"
|
|
126
|
-
density="comfortable"
|
|
127
118
|
hide-details="auto"
|
|
128
119
|
/>
|
|
129
120
|
<v-text-field
|
|
130
121
|
v-model="runtimeValues[filter.key].max"
|
|
131
122
|
:label="filterLabel(filter, 'jskit.http.crud.filters.rangeMax')"
|
|
132
123
|
type="number"
|
|
133
|
-
variant="outlined"
|
|
134
|
-
density="comfortable"
|
|
135
124
|
hide-details="auto"
|
|
136
125
|
/>
|
|
137
126
|
</div>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import CrudListFilterControls from "./CrudListFilterControls.vue";
|
|
3
|
+
import { useJskitText } from "../i18n.js";
|
|
4
|
+
|
|
5
|
+
// Every list filter control, the content of the Filters bottom sheet or dialog.
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
filters: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
runtime: {
|
|
12
|
+
type: /** @type {import("vue").PropType<import("../types.js").CrudListFilterRuntime>} */ (Object),
|
|
13
|
+
required: true
|
|
14
|
+
},
|
|
15
|
+
title: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const emit = defineEmits(["close"]);
|
|
21
|
+
|
|
22
|
+
const { t } = useJskitText();
|
|
23
|
+
|
|
24
|
+
function close() {
|
|
25
|
+
emit("close");
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<v-card class="crud-list-filter-sheet">
|
|
31
|
+
<v-card-title class="crud-list-filter-sheet__headline">
|
|
32
|
+
<h2 class="text-headline-small">{{ props.title }}</h2>
|
|
33
|
+
</v-card-title>
|
|
34
|
+
<v-card-text>
|
|
35
|
+
<CrudListFilterControls :filters="props.filters" :runtime="props.runtime" stacked />
|
|
36
|
+
</v-card-text>
|
|
37
|
+
<v-card-actions class="crud-list-filter-sheet__actions">
|
|
38
|
+
<v-btn variant="text" @click="props.runtime.clearFilters()">{{ t("jskit.http.actions.clearAll") }}</v-btn>
|
|
39
|
+
<v-spacer />
|
|
40
|
+
<v-btn variant="text" @click="close">{{ t("jskit.http.actions.apply") }}</v-btn>
|
|
41
|
+
</v-card-actions>
|
|
42
|
+
</v-card>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<style scoped>
|
|
46
|
+
.crud-list-filter-sheet__headline {
|
|
47
|
+
padding: 24px 24px 16px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.crud-list-filter-sheet__headline h2 {
|
|
51
|
+
font-weight: 400;
|
|
52
|
+
margin: 0;
|
|
53
|
+
white-space: normal;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.crud-list-filter-sheet__actions {
|
|
57
|
+
padding: 8px 24px 24px;
|
|
58
|
+
}
|
|
59
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, ref } from "vue";
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { useShellWindowSizeClass } from "@jskit-ai/shell-web/client/composables/useShellWindowSizeClass";
|
|
4
|
+
import CrudListFilterSheet from "./CrudListFilterSheet.vue";
|
|
5
5
|
import { useJskitText } from "../i18n.js";
|
|
6
6
|
|
|
7
7
|
const props = defineProps({
|
|
@@ -24,7 +24,10 @@ const resolvedTitle = computed(() =>
|
|
|
24
24
|
props.title === undefined ? t("jskit.http.crud.filters.title") : text(props.title)
|
|
25
25
|
);
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
// Material 3 filters: one row of chips. The Filters chip opens every control, in a bottom sheet on compact windows and a
|
|
28
|
+
// dialog on wider ones; on/off filters are toggle chips in the row itself, and each other active filter is a chip
|
|
29
|
+
// that clears it.
|
|
30
|
+
const { isCompact } = useShellWindowSizeClass();
|
|
28
31
|
|
|
29
32
|
const sheetOpen = ref(false);
|
|
30
33
|
|
|
@@ -34,119 +37,90 @@ const filterEntries = computed(() =>
|
|
|
34
37
|
: {})
|
|
35
38
|
.filter((filter) => filter?.key && filter?.type)
|
|
36
39
|
);
|
|
40
|
+
const flagFilters = computed(() => filterEntries.value.filter((filter) => filter.type === "flag"));
|
|
41
|
+
const runtimeValues = computed(() => props.runtime.values);
|
|
37
42
|
const activeChips = computed(() => props.runtime.activeChips.value);
|
|
43
|
+
const valueChips = computed(() =>
|
|
44
|
+
activeChips.value.filter((chip) => !flagFilters.value.some((filter) => filter.key === chip.filterKey))
|
|
45
|
+
);
|
|
38
46
|
const hasActiveFilters = computed(() => props.runtime.hasActiveFilters.value);
|
|
39
47
|
const shouldRender = computed(() => filterEntries.value.length > 0);
|
|
40
48
|
|
|
41
|
-
function
|
|
42
|
-
|
|
49
|
+
function toggleFlag(filter) {
|
|
50
|
+
runtimeValues.value[filter.key] = !runtimeValues.value[filter.key];
|
|
43
51
|
}
|
|
44
52
|
|
|
45
|
-
function
|
|
46
|
-
props.runtime.
|
|
53
|
+
function clearChip(chip) {
|
|
54
|
+
props.runtime.clearChip(chip);
|
|
47
55
|
}
|
|
48
56
|
</script>
|
|
49
57
|
|
|
50
58
|
<template>
|
|
51
59
|
<section v-if="shouldRender" class="crud-list-filter-surface">
|
|
52
|
-
<div class="crud-list-filter-
|
|
53
|
-
<v-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
variant="tonal"
|
|
60
|
+
<div class="crud-list-filter-surface__chips">
|
|
61
|
+
<v-chip
|
|
62
|
+
tag="button"
|
|
63
|
+
type="button"
|
|
57
64
|
class="crud-list-filter-surface__open"
|
|
65
|
+
prepend-icon="$tune"
|
|
66
|
+
:variant="hasActiveFilters ? 'flat' : 'outlined'"
|
|
67
|
+
:color="hasActiveFilters ? 'secondary-container' : undefined"
|
|
68
|
+
aria-haspopup="dialog"
|
|
58
69
|
@click="sheetOpen = true"
|
|
59
70
|
>
|
|
60
71
|
{{ resolvedTitle }}
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
<span v-if="activeChips.length > 0" class="crud-list-filter-surface__count">{{ activeChips.length }}</span>
|
|
73
|
+
</v-chip>
|
|
74
|
+
<v-chip
|
|
75
|
+
v-for="filter in flagFilters"
|
|
76
|
+
:key="filter.key"
|
|
77
|
+
tag="button"
|
|
78
|
+
type="button"
|
|
79
|
+
:variant="runtimeValues[filter.key] ? 'flat' : 'outlined'"
|
|
80
|
+
:color="runtimeValues[filter.key] ? 'secondary-container' : undefined"
|
|
81
|
+
:prepend-icon="runtimeValues[filter.key] ? '$check' : undefined"
|
|
82
|
+
:aria-pressed="runtimeValues[filter.key] ? 'true' : 'false'"
|
|
83
|
+
@click="toggleFlag(filter)"
|
|
84
|
+
>
|
|
85
|
+
{{ text(filter.label) }}
|
|
86
|
+
</v-chip>
|
|
87
|
+
<v-chip
|
|
88
|
+
v-for="chip in valueChips"
|
|
89
|
+
:key="chip.id"
|
|
90
|
+
variant="flat"
|
|
91
|
+
color="secondary-container"
|
|
92
|
+
closable
|
|
93
|
+
:close-label="t('jskit.http.actions.clear')"
|
|
94
|
+
@click:close="clearChip(chip)"
|
|
95
|
+
>
|
|
96
|
+
{{ chip.label }}
|
|
97
|
+
</v-chip>
|
|
98
|
+
<v-btn v-if="hasActiveFilters" variant="text" @click="props.runtime.clearFilters()">{{ t("jskit.http.actions.clearAll") }}</v-btn>
|
|
80
99
|
</div>
|
|
81
100
|
|
|
82
|
-
<v-sheet v-if="
|
|
83
|
-
<
|
|
84
|
-
</v-sheet>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
<v-card rounded="lg" class="crud-list-filter-surface__sheet">
|
|
88
|
-
<v-card-title class="d-flex align-center justify-space-between">
|
|
89
|
-
<span>{{ resolvedTitle }}</span>
|
|
90
|
-
<v-btn variant="text" @click="sheetOpen = false">{{ t("jskit.http.actions.close") }}</v-btn>
|
|
91
|
-
</v-card-title>
|
|
92
|
-
<v-card-text>
|
|
93
|
-
<CrudListFilterControls :filters="filterEntries" :runtime="runtime" stacked />
|
|
94
|
-
</v-card-text>
|
|
95
|
-
<v-card-actions class="justify-space-between">
|
|
96
|
-
<v-btn variant="text" @click="clearFilters">{{ t("jskit.http.actions.clearAll") }}</v-btn>
|
|
97
|
-
<v-btn color="primary" variant="flat" @click="sheetOpen = false">{{ t("jskit.http.actions.apply") }}</v-btn>
|
|
98
|
-
</v-card-actions>
|
|
99
|
-
</v-card>
|
|
101
|
+
<v-bottom-sheet v-if="isCompact" v-model="sheetOpen">
|
|
102
|
+
<CrudListFilterSheet :filters="filterEntries" :runtime="runtime" :title="resolvedTitle" @close="sheetOpen = false" />
|
|
103
|
+
</v-bottom-sheet>
|
|
104
|
+
<v-dialog v-else v-model="sheetOpen" max-width="560">
|
|
105
|
+
<CrudListFilterSheet :filters="filterEntries" :runtime="runtime" :title="resolvedTitle" @close="sheetOpen = false" />
|
|
100
106
|
</v-dialog>
|
|
101
107
|
</section>
|
|
102
108
|
</template>
|
|
103
109
|
|
|
104
110
|
<style scoped>
|
|
105
111
|
.crud-list-filter-surface {
|
|
106
|
-
display: flex;
|
|
107
|
-
flex-direction: column;
|
|
108
|
-
gap: 0.75rem;
|
|
109
112
|
min-width: 0;
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
.crud-list-filter-surface__summary {
|
|
113
|
-
align-items: center;
|
|
114
|
-
display: flex;
|
|
115
|
-
flex-wrap: wrap;
|
|
116
|
-
gap: 0.75rem;
|
|
117
|
-
justify-content: space-between;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.crud-list-filter-surface__open {
|
|
121
|
-
min-height: 48px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
115
|
.crud-list-filter-surface__chips {
|
|
125
116
|
align-items: center;
|
|
126
117
|
display: flex;
|
|
127
118
|
flex-wrap: wrap;
|
|
128
|
-
gap:
|
|
119
|
+
gap: 8px;
|
|
129
120
|
min-width: 0;
|
|
130
121
|
}
|
|
131
122
|
|
|
132
|
-
.crud-list-filter-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.crud-list-filter-surface__sheet {
|
|
137
|
-
margin: 0.75rem;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.crud-list-filter-surface :deep(.v-field),
|
|
141
|
-
.crud-list-filter-surface :deep(.v-btn),
|
|
142
|
-
.crud-list-filter-surface :deep(.v-selection-control) {
|
|
143
|
-
min-height: 48px;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
@media (max-width: 640px) {
|
|
147
|
-
.crud-list-filter-surface__summary {
|
|
148
|
-
align-items: stretch;
|
|
149
|
-
flex-direction: column;
|
|
150
|
-
}
|
|
123
|
+
.crud-list-filter-surface__count {
|
|
124
|
+
margin-inline-start: 6px;
|
|
151
125
|
}
|
|
152
126
|
</style>
|
|
@@ -31,23 +31,16 @@ const props = defineProps({
|
|
|
31
31
|
type: Boolean,
|
|
32
32
|
default: false
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
// The record's title, which names the menu for assistive technology.
|
|
35
|
+
title: {
|
|
35
36
|
type: String,
|
|
36
|
-
default:
|
|
37
|
-
},
|
|
38
|
-
buttonVariant: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: "text"
|
|
41
|
-
},
|
|
42
|
-
buttonSize: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: "small"
|
|
37
|
+
default: ""
|
|
45
38
|
}
|
|
46
39
|
});
|
|
47
40
|
|
|
48
41
|
const { t, text } = useJskitText();
|
|
49
|
-
const
|
|
50
|
-
props.
|
|
42
|
+
const buttonLabel = computed(() =>
|
|
43
|
+
props.title ? t("jskit.http.crud.list.recordActions", { title: props.title }) : t("jskit.http.actions.more")
|
|
51
44
|
);
|
|
52
45
|
|
|
53
46
|
const visibleRowActions = computed(() => props.rowActions.visibleActionsFor(props.record, props.index));
|
|
@@ -81,20 +74,23 @@ function runRowAction(action) {
|
|
|
81
74
|
<template #activator="{ props: menuProps }">
|
|
82
75
|
<v-btn
|
|
83
76
|
v-bind="menuProps"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
class="crud-list-record-action-menu"
|
|
78
|
+
icon="$moreVert"
|
|
79
|
+
variant="text"
|
|
80
|
+
color="on-surface-variant"
|
|
81
|
+
:aria-label="buttonLabel"
|
|
82
|
+
/>
|
|
89
83
|
</template>
|
|
90
|
-
<v-list
|
|
84
|
+
<v-list min-width="160">
|
|
91
85
|
<v-list-item
|
|
92
86
|
v-if="hasViewAction"
|
|
87
|
+
prepend-icon="$visibility"
|
|
93
88
|
:title="t('jskit.http.actions.open')"
|
|
94
89
|
:to="viewLocation"
|
|
95
90
|
/>
|
|
96
91
|
<v-list-item
|
|
97
92
|
v-if="hasEditAction"
|
|
93
|
+
prepend-icon="$edit"
|
|
98
94
|
:title="t('jskit.http.actions.edit')"
|
|
99
95
|
:to="editLocation"
|
|
100
96
|
/>
|