@jskit-ai/users-web 0.1.80 → 0.1.82
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/package.descriptor.mjs +137 -21
- package/package.json +21 -10
- package/src/client/bulkActions.js +47 -0
- package/src/client/components/AccountSettingsClientElement.vue +69 -24
- package/src/client/components/CrudAddEditScreen.vue +186 -0
- package/src/client/components/CrudListBulkActionSurface.vue +126 -0
- package/src/client/components/CrudListFilterSurface.vue +377 -0
- package/src/client/components/CrudListScreen.vue +434 -0
- package/src/client/components/CrudViewScreen.vue +186 -0
- package/src/client/components/ProfileClientElement.vue +19 -12
- package/src/client/components/UsersHomeToolsWidget.vue +0 -1
- package/src/client/composables/records/useAddEdit.js +23 -2
- package/src/client/composables/records/useCrudList.js +5 -1
- package/src/client/composables/records/useView.js +1 -0
- package/src/client/composables/runtime/operationUiHelpers.js +7 -3
- package/src/client/composables/runtime/useEndpointResource.js +12 -2
- package/src/client/composables/runtime/useUiFeedback.js +4 -2
- package/src/client/composables/support/resourceLoadStateHelpers.js +33 -1
- package/src/client/composables/useAccountSettingsRuntime.js +10 -1
- package/src/client/composables/useCrudAddEditScreen.js +88 -0
- package/src/client/composables/useCrudListBulkActions.js +147 -0
- package/src/client/composables/useCrudListScreen.js +107 -0
- package/src/client/composables/useCrudViewScreen.js +67 -0
- package/src/client/composables/usePagedCollection.js +6 -1
- package/src/client/filters.js +15 -0
- package/src/client/index.js +5 -0
- package/src/shared/toolsOutletContracts.js +0 -4
- package/templates/src/components/account/settings/AccountSettingsNotificationsSection.vue +34 -8
- package/templates/src/components/account/settings/AccountSettingsPreferencesSection.vue +34 -8
- package/templates/src/components/account/settings/AccountSettingsProfileSection.vue +34 -8
- package/test/crudListBulkActionSurface.test.js +27 -0
- package/test/crudListFilterSurface.test.js +45 -0
- package/test/crudScreenComponents.test.js +62 -0
- package/test/errorIntentContract.test.js +31 -0
- package/test/exportsContract.test.js +11 -0
- package/test/resourceLoadStateHelpers.test.js +35 -1
- package/test/settingsPlacementContract.test.js +146 -14
- package/test/useCrudListBulkActions.test.js +65 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, unref } from "vue";
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
screen: {
|
|
6
|
+
type: Object,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
resolveLookupItems: {
|
|
10
|
+
type: Function,
|
|
11
|
+
default: null
|
|
12
|
+
},
|
|
13
|
+
resolveLookupLoading: {
|
|
14
|
+
type: Function,
|
|
15
|
+
default: null
|
|
16
|
+
},
|
|
17
|
+
resolveLookupSearch: {
|
|
18
|
+
type: Function,
|
|
19
|
+
default: null
|
|
20
|
+
},
|
|
21
|
+
setLookupSearch: {
|
|
22
|
+
type: Function,
|
|
23
|
+
default: null
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const formRuntime = computed(() => props.screen?.formRuntime || {});
|
|
28
|
+
const addEdit = computed(() => props.screen?.addEdit || formRuntime.value?.addEdit || {});
|
|
29
|
+
const formState = computed(() => props.screen?.formState || formRuntime.value?.form || {});
|
|
30
|
+
const mode = computed(() => String(unref(props.screen?.mode) || "new").trim() || "new");
|
|
31
|
+
const title = computed(() => String(unref(props.screen?.title) || "").trim());
|
|
32
|
+
const subtitle = computed(() => String(unref(props.screen?.subtitle) || "").trim());
|
|
33
|
+
const saveLabel = computed(() => String(unref(props.screen?.saveLabel) || "Save").trim() || "Save");
|
|
34
|
+
const cancelTo = computed(() => unref(props.screen?.cancelTo) || "");
|
|
35
|
+
|
|
36
|
+
function resolveFieldErrors(fieldKey) {
|
|
37
|
+
if (typeof props.screen?.resolveFieldErrors === "function") {
|
|
38
|
+
return props.screen.resolveFieldErrors(fieldKey);
|
|
39
|
+
}
|
|
40
|
+
if (typeof formRuntime.value?.resolveFieldErrors === "function") {
|
|
41
|
+
return formRuntime.value.resolveFieldErrors(fieldKey);
|
|
42
|
+
}
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function resolveCancelTo(target = cancelTo.value) {
|
|
47
|
+
if (typeof props.screen?.resolveCancelTo === "function") {
|
|
48
|
+
return props.screen.resolveCancelTo(target);
|
|
49
|
+
}
|
|
50
|
+
return target || "";
|
|
51
|
+
}
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<section class="generated-ui-screen generated-ui-screen--operator ui-generator-add-edit-form d-flex flex-column ga-4">
|
|
56
|
+
<header class="ui-generator-add-edit-form__header">
|
|
57
|
+
<div class="ui-generator-add-edit-form__copy">
|
|
58
|
+
<h1 class="ui-generator-add-edit-form__title">{{ title }}</h1>
|
|
59
|
+
<p v-if="subtitle" class="text-body-2 text-medium-emphasis mb-0">{{ subtitle }}</p>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="ui-generator-add-edit-form__actions">
|
|
62
|
+
<v-btn v-if="cancelTo" color="primary" variant="outlined" :to="resolveCancelTo(cancelTo)">Cancel</v-btn>
|
|
63
|
+
<v-btn
|
|
64
|
+
color="primary"
|
|
65
|
+
variant="flat"
|
|
66
|
+
:loading="addEdit.isSaving"
|
|
67
|
+
:disabled="addEdit.isSubmitDisabled"
|
|
68
|
+
@click="addEdit.submit"
|
|
69
|
+
>
|
|
70
|
+
{{ saveLabel }}
|
|
71
|
+
</v-btn>
|
|
72
|
+
</div>
|
|
73
|
+
</header>
|
|
74
|
+
|
|
75
|
+
<v-sheet rounded="lg" border class="ui-generator-add-edit-form__panel">
|
|
76
|
+
<div v-if="addEdit.loadError" class="ui-generator-add-edit-form__state">
|
|
77
|
+
<h2 class="text-h6 mb-2">Unable to load form</h2>
|
|
78
|
+
<p class="text-body-2 text-medium-emphasis mb-4">
|
|
79
|
+
{{ addEdit.loadError }}
|
|
80
|
+
</p>
|
|
81
|
+
<v-btn
|
|
82
|
+
v-if="addEdit.canRetryLoad"
|
|
83
|
+
color="primary"
|
|
84
|
+
variant="tonal"
|
|
85
|
+
:loading="addEdit.isFetching"
|
|
86
|
+
@click="addEdit.refresh"
|
|
87
|
+
>
|
|
88
|
+
Retry
|
|
89
|
+
</v-btn>
|
|
90
|
+
</div>
|
|
91
|
+
<template v-else-if="formRuntime.showFormSkeleton">
|
|
92
|
+
<div class="pa-4">
|
|
93
|
+
<v-skeleton-loader type="heading, text@2, article" />
|
|
94
|
+
</div>
|
|
95
|
+
</template>
|
|
96
|
+
<v-form v-else class="pa-4" @submit.prevent="addEdit.submit" novalidate>
|
|
97
|
+
<v-progress-linear v-if="addEdit.isRefetching" indeterminate class="mb-4" />
|
|
98
|
+
<v-row class="ui-generator-add-edit-form__fields">
|
|
99
|
+
<slot
|
|
100
|
+
name="fields"
|
|
101
|
+
:mode="mode"
|
|
102
|
+
:form-runtime="formRuntime"
|
|
103
|
+
:form-state="formState"
|
|
104
|
+
:add-edit="addEdit"
|
|
105
|
+
:resolve-field-errors="resolveFieldErrors"
|
|
106
|
+
:resolve-lookup-items="resolveLookupItems"
|
|
107
|
+
:resolve-lookup-loading="resolveLookupLoading"
|
|
108
|
+
:resolve-lookup-search="resolveLookupSearch"
|
|
109
|
+
:set-lookup-search="setLookupSearch"
|
|
110
|
+
/>
|
|
111
|
+
</v-row>
|
|
112
|
+
</v-form>
|
|
113
|
+
</v-sheet>
|
|
114
|
+
</section>
|
|
115
|
+
</template>
|
|
116
|
+
|
|
117
|
+
<style scoped>
|
|
118
|
+
.generated-ui-screen {
|
|
119
|
+
--generated-ui-screen-title-size: clamp(1.35rem, 2vw, 1.85rem);
|
|
120
|
+
--generated-ui-screen-state-padding: 2.5rem 1.25rem;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.generated-ui-screen--operator {
|
|
124
|
+
--generated-ui-screen-state-padding: 2rem 1rem;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.ui-generator-add-edit-form__header {
|
|
128
|
+
align-items: flex-start;
|
|
129
|
+
display: flex;
|
|
130
|
+
gap: 1rem;
|
|
131
|
+
justify-content: space-between;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.ui-generator-add-edit-form__copy {
|
|
135
|
+
min-width: 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.ui-generator-add-edit-form__title {
|
|
139
|
+
font-size: var(--generated-ui-screen-title-size);
|
|
140
|
+
font-weight: 650;
|
|
141
|
+
letter-spacing: -0.02em;
|
|
142
|
+
line-height: 1.15;
|
|
143
|
+
margin: 0 0 0.35rem;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.ui-generator-add-edit-form__actions {
|
|
147
|
+
display: flex;
|
|
148
|
+
flex-wrap: wrap;
|
|
149
|
+
gap: 0.5rem;
|
|
150
|
+
justify-content: flex-end;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.ui-generator-add-edit-form__panel {
|
|
154
|
+
overflow: hidden;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.ui-generator-add-edit-form__state {
|
|
158
|
+
margin-inline: auto;
|
|
159
|
+
max-width: 30rem;
|
|
160
|
+
padding: var(--generated-ui-screen-state-padding);
|
|
161
|
+
text-align: center;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.ui-generator-add-edit-form__fields :deep(.v-col) {
|
|
165
|
+
min-width: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@media (max-width: 960px) {
|
|
169
|
+
.ui-generator-add-edit-form__header {
|
|
170
|
+
flex-direction: column;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.ui-generator-add-edit-form__actions {
|
|
174
|
+
width: 100%;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.ui-generator-add-edit-form__actions :deep(.v-btn) {
|
|
178
|
+
min-height: 48px;
|
|
179
|
+
flex: 1 1 10rem;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.ui-generator-add-edit-form__state :deep(.v-btn) {
|
|
183
|
+
min-height: 48px;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
</style>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useDisplay } from "vuetify";
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
runtime: {
|
|
7
|
+
type: Object,
|
|
8
|
+
default: null
|
|
9
|
+
},
|
|
10
|
+
title: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "Selection"
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const display = useDisplay();
|
|
17
|
+
const isCompactLayout = computed(() => {
|
|
18
|
+
const displayName = String(display?.name?.value || "").trim().toLowerCase();
|
|
19
|
+
return displayName === "xs" || displayName === "sm";
|
|
20
|
+
});
|
|
21
|
+
const actions = computed(() => Array.isArray(props.runtime?.actions) ? props.runtime.actions : []);
|
|
22
|
+
const selectedCount = computed(() => Number(props.runtime?.selectedCount?.value || 0));
|
|
23
|
+
const shouldRender = computed(() =>
|
|
24
|
+
Boolean(props.runtime?.hasActions?.value) &&
|
|
25
|
+
Boolean(props.runtime?.hasSelection?.value) &&
|
|
26
|
+
selectedCount.value > 0
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
function clearSelection() {
|
|
30
|
+
props.runtime?.clearSelection?.();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function execute(action = {}) {
|
|
34
|
+
props.runtime?.execute?.(action);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function isActionDisabled(action = {}) {
|
|
38
|
+
return Boolean(props.runtime?.isActionDisabled?.(action));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function isActionExecuting(action = {}) {
|
|
42
|
+
return Boolean(props.runtime?.isActionExecuting?.(action));
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<section v-if="shouldRender" class="crud-list-bulk-action-surface">
|
|
48
|
+
<div class="crud-list-bulk-action-surface__summary">
|
|
49
|
+
<div class="crud-list-bulk-action-surface__copy">
|
|
50
|
+
<span class="text-overline text-medium-emphasis">{{ title }}</span>
|
|
51
|
+
<strong>{{ selectedCount }} selected</strong>
|
|
52
|
+
</div>
|
|
53
|
+
<v-btn size="small" variant="text" @click="clearSelection">Clear</v-btn>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div v-if="!isCompactLayout" class="crud-list-bulk-action-surface__actions">
|
|
57
|
+
<v-btn
|
|
58
|
+
v-for="action in actions"
|
|
59
|
+
:key="action.key"
|
|
60
|
+
:color="action.color"
|
|
61
|
+
:variant="action.variant"
|
|
62
|
+
:prepend-icon="action.icon || undefined"
|
|
63
|
+
:disabled="isActionDisabled(action)"
|
|
64
|
+
:loading="isActionExecuting(action)"
|
|
65
|
+
@click="execute(action)"
|
|
66
|
+
>
|
|
67
|
+
{{ action.label }}
|
|
68
|
+
</v-btn>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<v-menu v-else location="bottom end">
|
|
72
|
+
<template #activator="{ props: menuProps }">
|
|
73
|
+
<v-btn v-bind="menuProps" color="primary" variant="tonal">Bulk actions</v-btn>
|
|
74
|
+
</template>
|
|
75
|
+
<v-list density="compact" min-width="180">
|
|
76
|
+
<v-list-item
|
|
77
|
+
v-for="action in actions"
|
|
78
|
+
:key="action.key"
|
|
79
|
+
:title="action.label"
|
|
80
|
+
:prepend-icon="action.icon || undefined"
|
|
81
|
+
:disabled="isActionDisabled(action)"
|
|
82
|
+
@click="execute(action)"
|
|
83
|
+
/>
|
|
84
|
+
</v-list>
|
|
85
|
+
</v-menu>
|
|
86
|
+
</section>
|
|
87
|
+
</template>
|
|
88
|
+
|
|
89
|
+
<style scoped>
|
|
90
|
+
.crud-list-bulk-action-surface {
|
|
91
|
+
align-items: center;
|
|
92
|
+
background: rgba(var(--v-theme-primary), 0.08);
|
|
93
|
+
border-block: 1px solid rgba(var(--v-theme-primary), 0.18);
|
|
94
|
+
display: flex;
|
|
95
|
+
gap: 0.75rem;
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
min-width: 0;
|
|
98
|
+
padding: 0.75rem 1rem;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.crud-list-bulk-action-surface__summary,
|
|
102
|
+
.crud-list-bulk-action-surface__actions {
|
|
103
|
+
align-items: center;
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-wrap: wrap;
|
|
106
|
+
gap: 0.5rem;
|
|
107
|
+
min-width: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.crud-list-bulk-action-surface__copy {
|
|
111
|
+
display: grid;
|
|
112
|
+
gap: 0.1rem;
|
|
113
|
+
min-width: 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.crud-list-bulk-action-surface :deep(.v-btn) {
|
|
117
|
+
min-height: 48px;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@media (max-width: 640px) {
|
|
121
|
+
.crud-list-bulk-action-surface {
|
|
122
|
+
align-items: stretch;
|
|
123
|
+
flex-direction: column;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
</style>
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed, ref } from "vue";
|
|
3
|
+
import { useDisplay } from "vuetify";
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
filters: {
|
|
7
|
+
type: Object,
|
|
8
|
+
default: () => ({})
|
|
9
|
+
},
|
|
10
|
+
runtime: {
|
|
11
|
+
type: Object,
|
|
12
|
+
default: null
|
|
13
|
+
},
|
|
14
|
+
title: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "Filters"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const display = useDisplay();
|
|
21
|
+
const sheetOpen = ref(false);
|
|
22
|
+
|
|
23
|
+
const filterEntries = computed(() =>
|
|
24
|
+
Object.values(props.filters && typeof props.filters === "object" && !Array.isArray(props.filters)
|
|
25
|
+
? props.filters
|
|
26
|
+
: {})
|
|
27
|
+
.filter((filter) => filter?.key && filter?.type)
|
|
28
|
+
);
|
|
29
|
+
const runtimeValues = computed(() => props.runtime?.values || {});
|
|
30
|
+
const activeChips = computed(() => Array.isArray(props.runtime?.activeChips?.value) ? props.runtime.activeChips.value : []);
|
|
31
|
+
const hasActiveFilters = computed(() => Boolean(props.runtime?.hasActiveFilters?.value));
|
|
32
|
+
const shouldRender = computed(() => filterEntries.value.length > 0 && Boolean(props.runtime?.values));
|
|
33
|
+
const isCompactLayout = computed(() => {
|
|
34
|
+
const displayName = String(display?.name?.value || "").trim().toLowerCase();
|
|
35
|
+
return displayName === "xs" || displayName === "sm";
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
function optionItems(filter = {}) {
|
|
39
|
+
return Array.isArray(filter.options) ? filter.options : [];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function placeholder(filter = {}, fallback = "") {
|
|
43
|
+
return String(filter?.ui?.placeholder || fallback || "").trim();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function clearChip(chip = {}) {
|
|
47
|
+
props.runtime?.clearChip?.(chip);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function clearFilters() {
|
|
51
|
+
props.runtime?.clearFilters?.();
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<section v-if="shouldRender" class="crud-list-filter-surface">
|
|
57
|
+
<div class="crud-list-filter-surface__summary">
|
|
58
|
+
<v-btn
|
|
59
|
+
v-if="isCompactLayout"
|
|
60
|
+
color="primary"
|
|
61
|
+
variant="tonal"
|
|
62
|
+
class="crud-list-filter-surface__open"
|
|
63
|
+
@click="sheetOpen = true"
|
|
64
|
+
>
|
|
65
|
+
{{ title }}
|
|
66
|
+
<v-chip v-if="activeChips.length > 0" class="ml-2" size="x-small" color="primary" variant="flat">
|
|
67
|
+
{{ activeChips.length }}
|
|
68
|
+
</v-chip>
|
|
69
|
+
</v-btn>
|
|
70
|
+
|
|
71
|
+
<div v-if="hasActiveFilters" class="crud-list-filter-surface__chips">
|
|
72
|
+
<v-chip
|
|
73
|
+
v-for="chip in activeChips"
|
|
74
|
+
:key="chip.id"
|
|
75
|
+
closable
|
|
76
|
+
size="small"
|
|
77
|
+
variant="tonal"
|
|
78
|
+
@click:close="clearChip(chip)"
|
|
79
|
+
>
|
|
80
|
+
{{ chip.label }}
|
|
81
|
+
</v-chip>
|
|
82
|
+
<v-btn size="small" variant="text" @click="clearFilters">Clear all</v-btn>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<v-sheet v-if="!isCompactLayout" rounded="lg" border class="crud-list-filter-surface__panel">
|
|
87
|
+
<div class="crud-list-filter-surface__controls">
|
|
88
|
+
<template v-for="filter in filterEntries" :key="filter.key">
|
|
89
|
+
<v-switch
|
|
90
|
+
v-if="filter.type === 'flag'"
|
|
91
|
+
v-model="runtimeValues[filter.key]"
|
|
92
|
+
:label="filter.label"
|
|
93
|
+
color="primary"
|
|
94
|
+
density="comfortable"
|
|
95
|
+
hide-details
|
|
96
|
+
class="crud-list-filter-surface__control"
|
|
97
|
+
/>
|
|
98
|
+
<v-select
|
|
99
|
+
v-else-if="filter.type === 'enum' || filter.type === 'enumMany' || filter.type === 'presence'"
|
|
100
|
+
v-model="runtimeValues[filter.key]"
|
|
101
|
+
:items="optionItems(filter)"
|
|
102
|
+
:label="filter.label"
|
|
103
|
+
:placeholder="placeholder(filter)"
|
|
104
|
+
:multiple="filter.type === 'enumMany'"
|
|
105
|
+
:chips="filter.type === 'enumMany'"
|
|
106
|
+
:closable-chips="filter.type === 'enumMany'"
|
|
107
|
+
clearable
|
|
108
|
+
item-title="label"
|
|
109
|
+
item-value="value"
|
|
110
|
+
variant="outlined"
|
|
111
|
+
density="comfortable"
|
|
112
|
+
hide-details="auto"
|
|
113
|
+
class="crud-list-filter-surface__control"
|
|
114
|
+
/>
|
|
115
|
+
<v-combobox
|
|
116
|
+
v-else-if="filter.type === 'recordIdMany'"
|
|
117
|
+
v-model="runtimeValues[filter.key]"
|
|
118
|
+
:label="filter.label"
|
|
119
|
+
:placeholder="placeholder(filter, 'Enter ids')"
|
|
120
|
+
multiple
|
|
121
|
+
chips
|
|
122
|
+
closable-chips
|
|
123
|
+
clearable
|
|
124
|
+
variant="outlined"
|
|
125
|
+
density="comfortable"
|
|
126
|
+
hide-details="auto"
|
|
127
|
+
class="crud-list-filter-surface__control"
|
|
128
|
+
/>
|
|
129
|
+
<v-text-field
|
|
130
|
+
v-else-if="filter.type === 'recordId'"
|
|
131
|
+
v-model="runtimeValues[filter.key]"
|
|
132
|
+
:label="filter.label"
|
|
133
|
+
:placeholder="placeholder(filter, 'Enter id')"
|
|
134
|
+
clearable
|
|
135
|
+
variant="outlined"
|
|
136
|
+
density="comfortable"
|
|
137
|
+
hide-details="auto"
|
|
138
|
+
class="crud-list-filter-surface__control"
|
|
139
|
+
/>
|
|
140
|
+
<div v-else-if="filter.type === 'dateRange'" class="crud-list-filter-surface__range">
|
|
141
|
+
<v-text-field
|
|
142
|
+
v-model="runtimeValues[filter.key].from"
|
|
143
|
+
:label="`${filter.label} from`"
|
|
144
|
+
type="date"
|
|
145
|
+
variant="outlined"
|
|
146
|
+
density="comfortable"
|
|
147
|
+
hide-details="auto"
|
|
148
|
+
/>
|
|
149
|
+
<v-text-field
|
|
150
|
+
v-model="runtimeValues[filter.key].to"
|
|
151
|
+
:label="`${filter.label} to`"
|
|
152
|
+
type="date"
|
|
153
|
+
variant="outlined"
|
|
154
|
+
density="comfortable"
|
|
155
|
+
hide-details="auto"
|
|
156
|
+
/>
|
|
157
|
+
</div>
|
|
158
|
+
<div v-else-if="filter.type === 'numberRange'" class="crud-list-filter-surface__range">
|
|
159
|
+
<v-text-field
|
|
160
|
+
v-model="runtimeValues[filter.key].min"
|
|
161
|
+
:label="`${filter.label} min`"
|
|
162
|
+
type="number"
|
|
163
|
+
variant="outlined"
|
|
164
|
+
density="comfortable"
|
|
165
|
+
hide-details="auto"
|
|
166
|
+
/>
|
|
167
|
+
<v-text-field
|
|
168
|
+
v-model="runtimeValues[filter.key].max"
|
|
169
|
+
:label="`${filter.label} max`"
|
|
170
|
+
type="number"
|
|
171
|
+
variant="outlined"
|
|
172
|
+
density="comfortable"
|
|
173
|
+
hide-details="auto"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
<v-text-field
|
|
177
|
+
v-else-if="filter.type === 'date'"
|
|
178
|
+
v-model="runtimeValues[filter.key]"
|
|
179
|
+
:label="filter.label"
|
|
180
|
+
type="date"
|
|
181
|
+
clearable
|
|
182
|
+
variant="outlined"
|
|
183
|
+
density="comfortable"
|
|
184
|
+
hide-details="auto"
|
|
185
|
+
class="crud-list-filter-surface__control"
|
|
186
|
+
/>
|
|
187
|
+
</template>
|
|
188
|
+
</div>
|
|
189
|
+
</v-sheet>
|
|
190
|
+
|
|
191
|
+
<v-dialog v-model="sheetOpen" max-width="640" location="bottom">
|
|
192
|
+
<v-card rounded="lg" class="crud-list-filter-surface__sheet">
|
|
193
|
+
<v-card-title class="d-flex align-center justify-space-between">
|
|
194
|
+
<span>{{ title }}</span>
|
|
195
|
+
<v-btn variant="text" @click="sheetOpen = false">Close</v-btn>
|
|
196
|
+
</v-card-title>
|
|
197
|
+
<v-card-text>
|
|
198
|
+
<div class="crud-list-filter-surface__controls crud-list-filter-surface__controls--stacked">
|
|
199
|
+
<template v-for="filter in filterEntries" :key="filter.key">
|
|
200
|
+
<v-switch
|
|
201
|
+
v-if="filter.type === 'flag'"
|
|
202
|
+
v-model="runtimeValues[filter.key]"
|
|
203
|
+
:label="filter.label"
|
|
204
|
+
color="primary"
|
|
205
|
+
density="comfortable"
|
|
206
|
+
hide-details
|
|
207
|
+
/>
|
|
208
|
+
<v-select
|
|
209
|
+
v-else-if="filter.type === 'enum' || filter.type === 'enumMany' || filter.type === 'presence'"
|
|
210
|
+
v-model="runtimeValues[filter.key]"
|
|
211
|
+
:items="optionItems(filter)"
|
|
212
|
+
:label="filter.label"
|
|
213
|
+
:placeholder="placeholder(filter)"
|
|
214
|
+
:multiple="filter.type === 'enumMany'"
|
|
215
|
+
:chips="filter.type === 'enumMany'"
|
|
216
|
+
:closable-chips="filter.type === 'enumMany'"
|
|
217
|
+
clearable
|
|
218
|
+
item-title="label"
|
|
219
|
+
item-value="value"
|
|
220
|
+
variant="outlined"
|
|
221
|
+
density="comfortable"
|
|
222
|
+
hide-details="auto"
|
|
223
|
+
/>
|
|
224
|
+
<v-combobox
|
|
225
|
+
v-else-if="filter.type === 'recordIdMany'"
|
|
226
|
+
v-model="runtimeValues[filter.key]"
|
|
227
|
+
:label="filter.label"
|
|
228
|
+
:placeholder="placeholder(filter, 'Enter ids')"
|
|
229
|
+
multiple
|
|
230
|
+
chips
|
|
231
|
+
closable-chips
|
|
232
|
+
clearable
|
|
233
|
+
variant="outlined"
|
|
234
|
+
density="comfortable"
|
|
235
|
+
hide-details="auto"
|
|
236
|
+
/>
|
|
237
|
+
<v-text-field
|
|
238
|
+
v-else-if="filter.type === 'recordId'"
|
|
239
|
+
v-model="runtimeValues[filter.key]"
|
|
240
|
+
:label="filter.label"
|
|
241
|
+
:placeholder="placeholder(filter, 'Enter id')"
|
|
242
|
+
clearable
|
|
243
|
+
variant="outlined"
|
|
244
|
+
density="comfortable"
|
|
245
|
+
hide-details="auto"
|
|
246
|
+
/>
|
|
247
|
+
<div v-else-if="filter.type === 'dateRange'" class="crud-list-filter-surface__range">
|
|
248
|
+
<v-text-field
|
|
249
|
+
v-model="runtimeValues[filter.key].from"
|
|
250
|
+
:label="`${filter.label} from`"
|
|
251
|
+
type="date"
|
|
252
|
+
variant="outlined"
|
|
253
|
+
density="comfortable"
|
|
254
|
+
hide-details="auto"
|
|
255
|
+
/>
|
|
256
|
+
<v-text-field
|
|
257
|
+
v-model="runtimeValues[filter.key].to"
|
|
258
|
+
:label="`${filter.label} to`"
|
|
259
|
+
type="date"
|
|
260
|
+
variant="outlined"
|
|
261
|
+
density="comfortable"
|
|
262
|
+
hide-details="auto"
|
|
263
|
+
/>
|
|
264
|
+
</div>
|
|
265
|
+
<div v-else-if="filter.type === 'numberRange'" class="crud-list-filter-surface__range">
|
|
266
|
+
<v-text-field
|
|
267
|
+
v-model="runtimeValues[filter.key].min"
|
|
268
|
+
:label="`${filter.label} min`"
|
|
269
|
+
type="number"
|
|
270
|
+
variant="outlined"
|
|
271
|
+
density="comfortable"
|
|
272
|
+
hide-details="auto"
|
|
273
|
+
/>
|
|
274
|
+
<v-text-field
|
|
275
|
+
v-model="runtimeValues[filter.key].max"
|
|
276
|
+
:label="`${filter.label} max`"
|
|
277
|
+
type="number"
|
|
278
|
+
variant="outlined"
|
|
279
|
+
density="comfortable"
|
|
280
|
+
hide-details="auto"
|
|
281
|
+
/>
|
|
282
|
+
</div>
|
|
283
|
+
<v-text-field
|
|
284
|
+
v-else-if="filter.type === 'date'"
|
|
285
|
+
v-model="runtimeValues[filter.key]"
|
|
286
|
+
:label="filter.label"
|
|
287
|
+
type="date"
|
|
288
|
+
clearable
|
|
289
|
+
variant="outlined"
|
|
290
|
+
density="comfortable"
|
|
291
|
+
hide-details="auto"
|
|
292
|
+
/>
|
|
293
|
+
</template>
|
|
294
|
+
</div>
|
|
295
|
+
</v-card-text>
|
|
296
|
+
<v-card-actions class="justify-space-between">
|
|
297
|
+
<v-btn variant="text" @click="clearFilters">Clear all</v-btn>
|
|
298
|
+
<v-btn color="primary" variant="flat" @click="sheetOpen = false">Apply</v-btn>
|
|
299
|
+
</v-card-actions>
|
|
300
|
+
</v-card>
|
|
301
|
+
</v-dialog>
|
|
302
|
+
</section>
|
|
303
|
+
</template>
|
|
304
|
+
|
|
305
|
+
<style scoped>
|
|
306
|
+
.crud-list-filter-surface {
|
|
307
|
+
display: flex;
|
|
308
|
+
flex-direction: column;
|
|
309
|
+
gap: 0.75rem;
|
|
310
|
+
min-width: 0;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.crud-list-filter-surface__summary {
|
|
314
|
+
align-items: center;
|
|
315
|
+
display: flex;
|
|
316
|
+
flex-wrap: wrap;
|
|
317
|
+
gap: 0.75rem;
|
|
318
|
+
justify-content: space-between;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.crud-list-filter-surface__open {
|
|
322
|
+
min-height: 48px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.crud-list-filter-surface__chips {
|
|
326
|
+
align-items: center;
|
|
327
|
+
display: flex;
|
|
328
|
+
flex-wrap: wrap;
|
|
329
|
+
gap: 0.5rem;
|
|
330
|
+
min-width: 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.crud-list-filter-surface__panel {
|
|
334
|
+
padding: 1rem;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.crud-list-filter-surface__controls {
|
|
338
|
+
display: grid;
|
|
339
|
+
gap: 0.75rem;
|
|
340
|
+
grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.crud-list-filter-surface__controls--stacked {
|
|
344
|
+
grid-template-columns: 1fr;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.crud-list-filter-surface__control {
|
|
348
|
+
min-width: 0;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.crud-list-filter-surface__range {
|
|
352
|
+
display: grid;
|
|
353
|
+
gap: 0.75rem;
|
|
354
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.crud-list-filter-surface__sheet {
|
|
358
|
+
margin: 0.75rem;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.crud-list-filter-surface :deep(.v-field),
|
|
362
|
+
.crud-list-filter-surface :deep(.v-btn),
|
|
363
|
+
.crud-list-filter-surface :deep(.v-selection-control) {
|
|
364
|
+
min-height: 48px;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
@media (max-width: 640px) {
|
|
368
|
+
.crud-list-filter-surface__summary {
|
|
369
|
+
align-items: stretch;
|
|
370
|
+
flex-direction: column;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.crud-list-filter-surface__range {
|
|
374
|
+
grid-template-columns: 1fr;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
</style>
|