@jskit-ai/users-web 0.1.172 → 0.1.174
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.json +18 -149
- package/src/client/composables/account-settings/accountSettingsAvatarUploadRuntime.js +2 -2
- package/src/client/composables/useAccountSettingsRuntime.js +3 -3
- package/src/client/index.js +0 -11
- package/test/exportsContract.test.js +3 -29
- package/test/settingsPlacementContract.test.js +10 -0
- package/fixtures/crud-list-date-filters/App.vue +0 -107
- package/fixtures/crud-list-date-filters/index.html +0 -12
- package/fixtures/crud-list-date-filters/main.js +0 -24
- package/fixtures/crud-list-date-filters/vite.config.mjs +0 -18
- package/src/client/bulkActions.js +0 -47
- package/src/client/components/CrudAddEditScreen.vue +0 -186
- package/src/client/components/CrudDeleteAction.vue +0 -93
- package/src/client/components/CrudListBulkActionSurface.vue +0 -126
- package/src/client/components/CrudListDateFilterControl.vue +0 -188
- package/src/client/components/CrudListFilterSurface.vue +0 -388
- package/src/client/components/CrudListRecordActionMenu.vue +0 -120
- package/src/client/components/CrudListScreen.vue +0 -501
- package/src/client/components/CrudViewScreen.vue +0 -197
- package/src/client/composables/crud/crudBindingSupport.js +0 -75
- package/src/client/composables/crud/crudHttpClientSupport.js +0 -57
- package/src/client/composables/crud/crudJsonApiTransportSupport.js +0 -145
- package/src/client/composables/crud/crudLookupFieldLabelSupport.js +0 -151
- package/src/client/composables/crud/crudLookupFieldRuntime.js +0 -251
- package/src/client/composables/crud/crudSchemaFormHelpers.js +0 -464
- package/src/client/composables/internal/crudListFilterLookupSupport.js +0 -161
- package/src/client/composables/internal/crudListParentTitleSupport.js +0 -171
- package/src/client/composables/internal/useOperationScope.js +0 -144
- package/src/client/composables/records/useAddEdit.js +0 -224
- package/src/client/composables/records/useCrudAddEdit.js +0 -227
- package/src/client/composables/records/useCrudList.js +0 -101
- package/src/client/composables/records/useCrudView.js +0 -47
- package/src/client/composables/records/useList.js +0 -500
- package/src/client/composables/records/useView.js +0 -164
- package/src/client/composables/runtime/addEditUiRuntime.js +0 -130
- package/src/client/composables/runtime/listUiRuntime.js +0 -123
- package/src/client/composables/runtime/modelStateHelpers.js +0 -90
- package/src/client/composables/runtime/operationAdapters.js +0 -34
- package/src/client/composables/runtime/operationUiHelpers.js +0 -125
- package/src/client/composables/runtime/operationValidationHelpers.js +0 -51
- package/src/client/composables/runtime/useAddEditCore.js +0 -112
- package/src/client/composables/runtime/useCommandCore.js +0 -123
- package/src/client/composables/runtime/useEndpointResource.js +0 -199
- package/src/client/composables/runtime/useFieldErrorBag.js +0 -61
- package/src/client/composables/runtime/useListCore.js +0 -112
- package/src/client/composables/runtime/useUiFeedback.js +0 -98
- package/src/client/composables/runtime/useViewCore.js +0 -93
- package/src/client/composables/runtime/viewUiRuntime.js +0 -96
- package/src/client/composables/support/errorMessageHelpers.js +0 -66
- package/src/client/composables/support/listQueryParamSupport.js +0 -473
- package/src/client/composables/support/listSearchSupport.js +0 -70
- package/src/client/composables/support/refValueHelpers.js +0 -19
- package/src/client/composables/support/requestQueryRuntimeSupport.js +0 -141
- package/src/client/composables/support/resourceLoadStateHelpers.js +0 -208
- package/src/client/composables/support/routeTemplateHelpers.js +0 -285
- package/src/client/composables/support/scopeHelpers.js +0 -145
- package/src/client/composables/useAccess.js +0 -109
- package/src/client/composables/useCommand.js +0 -118
- package/src/client/composables/useCrudAddEditScreen.js +0 -88
- package/src/client/composables/useCrudDeleteAction.js +0 -160
- package/src/client/composables/useCrudListBulkActions.js +0 -147
- package/src/client/composables/useCrudListFilterLookups.js +0 -146
- package/src/client/composables/useCrudListFilters.js +0 -339
- package/src/client/composables/useCrudListParentTitle.js +0 -151
- package/src/client/composables/useCrudListRowActions.js +0 -144
- package/src/client/composables/useCrudListScreen.js +0 -237
- package/src/client/composables/useCrudViewScreen.js +0 -77
- package/src/client/composables/usePagedCollection.js +0 -181
- package/src/client/composables/useRealtimeQueryInvalidation.js +0 -156
- package/src/client/composables/useScopeRuntime.js +0 -135
- package/src/client/filters.js +0 -15
- package/src/client/lib/httpClient.js +0 -47
- package/src/client/lib/permissions.js +0 -34
- package/src/client/rowActions.js +0 -47
- package/src/client/support/contractGuards.js +0 -34
- package/src/client/support/crudListDateFilterSupport.js +0 -91
- package/test/addEditUiRuntime.test.js +0 -110
- package/test/crudBindingSupport.test.js +0 -110
- package/test/crudHttpClientSupport.test.js +0 -77
- package/test/crudJsonApiTransportSupport.test.js +0 -179
- package/test/crudListBulkActionSurface.test.js +0 -27
- package/test/crudListDateFilterSupport.test.js +0 -92
- package/test/crudListDateFilterSurface.browser.test.js +0 -182
- package/test/crudListFilterSurface.test.js +0 -90
- package/test/crudLookupFieldRuntime.test.js +0 -264
- package/test/crudScreenComponents.test.js +0 -117
- package/test/errorIntentContract.test.js +0 -31
- package/test/errorMessageHelpers.test.js +0 -28
- package/test/listQueryParamSupport.test.js +0 -223
- package/test/listUiRuntime.test.js +0 -102
- package/test/operationValidationHelpers.test.js +0 -64
- package/test/permissions.test.js +0 -35
- package/test/refValueHelpers.test.js +0 -14
- package/test/requestTransportOptions.test.js +0 -457
- package/test/resourceLoadStateHelpers.test.js +0 -189
- package/test/routeTemplateHelpers.test.js +0 -85
- package/test/scopeHelpers.test.js +0 -57
- package/test/useAddEditCore.test.js +0 -124
- package/test/useAddEditRequestQueryParams.test.js +0 -190
- package/test/useCrudAddEdit.test.js +0 -415
- package/test/useCrudDeleteAction.test.js +0 -139
- package/test/useCrudListBulkActions.test.js +0 -65
- package/test/useCrudListFilterLookups.test.js +0 -114
- package/test/useCrudListFilters.test.js +0 -293
- package/test/useCrudListParentTitle.test.js +0 -262
- package/test/useCrudListRowActions.test.js +0 -77
- package/test/useListRouteInitialization.test.js +0 -337
- package/test/useListSearchSupport.test.js +0 -61
- package/test/usePagedCollection.test.js +0 -53
- package/test/useViewRequestQueryParams.test.js +0 -20
- package/test/viewCoreLoading.test.js +0 -44
- package/test/viewUiRuntime.test.js +0 -95
|
@@ -1,186 +0,0 @@
|
|
|
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>
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed, useId } from "vue";
|
|
3
|
-
import { mdiDeleteOutline } from "@mdi/js";
|
|
4
|
-
|
|
5
|
-
const props = defineProps({
|
|
6
|
-
action: {
|
|
7
|
-
type: Object,
|
|
8
|
-
required: true
|
|
9
|
-
},
|
|
10
|
-
resourceSingularTitle: {
|
|
11
|
-
type: String,
|
|
12
|
-
default: "Record"
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const resourceLabel = computed(() =>
|
|
17
|
-
String(props.resourceSingularTitle || "Record").trim() || "Record"
|
|
18
|
-
);
|
|
19
|
-
const componentId = useId();
|
|
20
|
-
const titleId = `${componentId}-delete-title`;
|
|
21
|
-
const descriptionId = `${componentId}-delete-description`;
|
|
22
|
-
|
|
23
|
-
function closeDialog() {
|
|
24
|
-
props.action.cancel();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function handleDialogModelUpdate(isOpen) {
|
|
28
|
-
if (!isOpen) {
|
|
29
|
-
closeDialog();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
</script>
|
|
33
|
-
|
|
34
|
-
<template>
|
|
35
|
-
<v-btn
|
|
36
|
-
color="error"
|
|
37
|
-
variant="tonal"
|
|
38
|
-
:prepend-icon="mdiDeleteOutline"
|
|
39
|
-
min-height="48"
|
|
40
|
-
:disabled="!action.canDelete"
|
|
41
|
-
@click="action.request"
|
|
42
|
-
>
|
|
43
|
-
Delete {{ resourceLabel }}
|
|
44
|
-
</v-btn>
|
|
45
|
-
|
|
46
|
-
<v-dialog
|
|
47
|
-
:model-value="action.isOpen"
|
|
48
|
-
max-width="32rem"
|
|
49
|
-
role="alertdialog"
|
|
50
|
-
aria-modal="true"
|
|
51
|
-
:aria-labelledby="titleId"
|
|
52
|
-
:aria-describedby="descriptionId"
|
|
53
|
-
:persistent="action.isDeleting"
|
|
54
|
-
@update:model-value="handleDialogModelUpdate"
|
|
55
|
-
>
|
|
56
|
-
<v-card>
|
|
57
|
-
<v-card-title :id="titleId">Delete {{ resourceLabel }}?</v-card-title>
|
|
58
|
-
<v-card-text>
|
|
59
|
-
<p :id="descriptionId" class="mb-0">
|
|
60
|
-
This permanently deletes this {{ resourceLabel.toLowerCase() }}. This action cannot be undone.
|
|
61
|
-
</p>
|
|
62
|
-
<v-alert
|
|
63
|
-
v-if="action.error"
|
|
64
|
-
class="mt-4"
|
|
65
|
-
type="error"
|
|
66
|
-
variant="tonal"
|
|
67
|
-
>
|
|
68
|
-
{{ action.error }}
|
|
69
|
-
</v-alert>
|
|
70
|
-
</v-card-text>
|
|
71
|
-
<v-card-actions>
|
|
72
|
-
<v-spacer />
|
|
73
|
-
<v-btn
|
|
74
|
-
autofocus
|
|
75
|
-
variant="text"
|
|
76
|
-
:disabled="action.isDeleting"
|
|
77
|
-
@click="closeDialog"
|
|
78
|
-
>
|
|
79
|
-
Cancel
|
|
80
|
-
</v-btn>
|
|
81
|
-
<v-btn
|
|
82
|
-
color="error"
|
|
83
|
-
variant="flat"
|
|
84
|
-
:loading="action.isDeleting"
|
|
85
|
-
:disabled="!action.canDelete"
|
|
86
|
-
@click="action.confirm"
|
|
87
|
-
>
|
|
88
|
-
Delete
|
|
89
|
-
</v-btn>
|
|
90
|
-
</v-card-actions>
|
|
91
|
-
</v-card>
|
|
92
|
-
</v-dialog>
|
|
93
|
-
</template>
|
|
@@ -1,126 +0,0 @@
|
|
|
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>
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed, nextTick, ref, useAttrs, useId } from "vue";
|
|
3
|
-
import { useLocale } from "vuetify";
|
|
4
|
-
import {
|
|
5
|
-
parseDateOnlyValue,
|
|
6
|
-
formatDateOnlyValue,
|
|
7
|
-
formatDateOnlyDisplay
|
|
8
|
-
} from "../support/crudListDateFilterSupport.js";
|
|
9
|
-
|
|
10
|
-
defineOptions({
|
|
11
|
-
inheritAttrs: false
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const props = defineProps({
|
|
15
|
-
modelValue: {
|
|
16
|
-
type: String,
|
|
17
|
-
default: ""
|
|
18
|
-
},
|
|
19
|
-
label: {
|
|
20
|
-
type: String,
|
|
21
|
-
required: true
|
|
22
|
-
},
|
|
23
|
-
controlId: {
|
|
24
|
-
type: String,
|
|
25
|
-
default: ""
|
|
26
|
-
},
|
|
27
|
-
placeholder: {
|
|
28
|
-
type: String,
|
|
29
|
-
default: "Select date"
|
|
30
|
-
},
|
|
31
|
-
disabled: {
|
|
32
|
-
type: Boolean,
|
|
33
|
-
default: false
|
|
34
|
-
},
|
|
35
|
-
readonly: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
default: false
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const emit = defineEmits(["update:modelValue"]);
|
|
42
|
-
const attrs = useAttrs();
|
|
43
|
-
const { current: currentLocale } = useLocale();
|
|
44
|
-
const generatedId = useId();
|
|
45
|
-
const menuOpen = ref(false);
|
|
46
|
-
const textFieldRef = ref(null);
|
|
47
|
-
|
|
48
|
-
const resolvedControlId = computed(() => props.controlId || `crud-list-date-${generatedId}`);
|
|
49
|
-
const pickerId = computed(() => `${resolvedControlId.value}-picker`);
|
|
50
|
-
const pickerValue = computed(() => parseDateOnlyValue(props.modelValue));
|
|
51
|
-
const displayValue = computed(() => formatDateOnlyDisplay(props.modelValue, {
|
|
52
|
-
locale: currentLocale?.value
|
|
53
|
-
}));
|
|
54
|
-
const pickerTitle = computed(() => `${props.label} calendar`);
|
|
55
|
-
|
|
56
|
-
function restoreFocus() {
|
|
57
|
-
void nextTick(() => {
|
|
58
|
-
textFieldRef.value?.focus?.();
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function openMenu() {
|
|
63
|
-
if (props.disabled || props.readonly) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
menuOpen.value = true;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function closeMenu() {
|
|
70
|
-
menuOpen.value = false;
|
|
71
|
-
restoreFocus();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function clearDate() {
|
|
75
|
-
if (props.disabled || props.readonly) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
emit("update:modelValue", "");
|
|
79
|
-
closeMenu();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function selectDate(value) {
|
|
83
|
-
const nextValue = formatDateOnlyValue(value);
|
|
84
|
-
if (!nextValue) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
emit("update:modelValue", nextValue);
|
|
88
|
-
closeMenu();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function handleActivatorKeydown(event) {
|
|
92
|
-
if (!["Enter", " ", "ArrowDown"].includes(event.key)) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
event.preventDefault();
|
|
96
|
-
openMenu();
|
|
97
|
-
}
|
|
98
|
-
</script>
|
|
99
|
-
|
|
100
|
-
<template>
|
|
101
|
-
<v-menu
|
|
102
|
-
v-model="menuOpen"
|
|
103
|
-
:close-on-content-click="false"
|
|
104
|
-
:open-on-click="false"
|
|
105
|
-
location="bottom start"
|
|
106
|
-
:offset="6"
|
|
107
|
-
min-width="0"
|
|
108
|
-
>
|
|
109
|
-
<template #activator="{ props: activatorProps }">
|
|
110
|
-
<v-text-field
|
|
111
|
-
v-bind="{ ...attrs, ...activatorProps }"
|
|
112
|
-
:id="resolvedControlId"
|
|
113
|
-
ref="textFieldRef"
|
|
114
|
-
:model-value="displayValue"
|
|
115
|
-
:label="label"
|
|
116
|
-
:placeholder="placeholder"
|
|
117
|
-
:aria-label="label"
|
|
118
|
-
:aria-controls="pickerId"
|
|
119
|
-
:aria-expanded="String(menuOpen)"
|
|
120
|
-
aria-haspopup="dialog"
|
|
121
|
-
:data-date-filter-control="resolvedControlId"
|
|
122
|
-
append-inner-icon="$calendar"
|
|
123
|
-
:disabled="disabled"
|
|
124
|
-
:clearable="Boolean(modelValue) && !disabled && !readonly"
|
|
125
|
-
persistent-clear
|
|
126
|
-
persistent-placeholder
|
|
127
|
-
readonly
|
|
128
|
-
inputmode="none"
|
|
129
|
-
variant="outlined"
|
|
130
|
-
density="comfortable"
|
|
131
|
-
hide-details="auto"
|
|
132
|
-
class="crud-list-date-filter-control"
|
|
133
|
-
@click:control="openMenu"
|
|
134
|
-
@click:append-inner="openMenu"
|
|
135
|
-
@click:clear.stop="clearDate"
|
|
136
|
-
@keydown="handleActivatorKeydown"
|
|
137
|
-
/>
|
|
138
|
-
</template>
|
|
139
|
-
|
|
140
|
-
<v-card
|
|
141
|
-
:id="pickerId"
|
|
142
|
-
:aria-label="pickerTitle"
|
|
143
|
-
role="dialog"
|
|
144
|
-
class="crud-list-date-filter-control__picker"
|
|
145
|
-
@keydown.esc.stop.prevent="closeMenu"
|
|
146
|
-
>
|
|
147
|
-
<v-date-picker
|
|
148
|
-
:model-value="pickerValue"
|
|
149
|
-
:title="pickerTitle"
|
|
150
|
-
:header="label"
|
|
151
|
-
:disabled="disabled || readonly"
|
|
152
|
-
color="primary"
|
|
153
|
-
show-adjacent-months
|
|
154
|
-
width="100%"
|
|
155
|
-
@update:model-value="selectDate"
|
|
156
|
-
/>
|
|
157
|
-
<v-divider />
|
|
158
|
-
<v-card-actions>
|
|
159
|
-
<v-btn
|
|
160
|
-
variant="text"
|
|
161
|
-
:disabled="disabled || readonly || !modelValue"
|
|
162
|
-
@click="clearDate"
|
|
163
|
-
>
|
|
164
|
-
Clear
|
|
165
|
-
</v-btn>
|
|
166
|
-
<v-spacer />
|
|
167
|
-
<v-btn color="primary" variant="text" @click="closeMenu">Close</v-btn>
|
|
168
|
-
</v-card-actions>
|
|
169
|
-
</v-card>
|
|
170
|
-
</v-menu>
|
|
171
|
-
</template>
|
|
172
|
-
|
|
173
|
-
<style scoped>
|
|
174
|
-
.crud-list-date-filter-control {
|
|
175
|
-
min-width: 0;
|
|
176
|
-
width: 100%;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
.crud-list-date-filter-control__picker {
|
|
180
|
-
max-width: calc(100vw - 2rem);
|
|
181
|
-
overflow: hidden;
|
|
182
|
-
width: 22rem;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.crud-list-date-filter-control__picker :deep(.v-date-picker) {
|
|
186
|
-
max-width: 100%;
|
|
187
|
-
}
|
|
188
|
-
</style>
|