@drax/crud-vue 3.46.0 → 3.48.0

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.
Files changed (44) hide show
  1. package/package.json +4 -4
  2. package/src/components/Crud.vue +27 -12
  3. package/src/components/CrudActiveFilters.vue +11 -9
  4. package/src/components/CrudAi.vue +38 -25
  5. package/src/components/CrudAutocomplete.vue +14 -2
  6. package/src/components/CrudDialog.vue +6 -6
  7. package/src/components/CrudExportList.vue +13 -12
  8. package/src/components/CrudFieldRange.vue +8 -4
  9. package/src/components/CrudFilters.vue +8 -2
  10. package/src/components/CrudFiltersAction.vue +3 -3
  11. package/src/components/CrudFiltersDynamic.vue +18 -10
  12. package/src/components/CrudForm.vue +44 -31
  13. package/src/components/CrudFormField.vue +48 -8
  14. package/src/components/CrudFormList.vue +44 -32
  15. package/src/components/CrudFormRecord.vue +19 -11
  16. package/src/components/CrudImportList.vue +17 -16
  17. package/src/components/CrudList.vue +41 -12
  18. package/src/components/CrudListGallery.vue +65 -27
  19. package/src/components/CrudListTable.vue +49 -10
  20. package/src/components/CrudNotify.vue +3 -1
  21. package/src/components/CrudRefDisplay.vue +2 -2
  22. package/src/components/CrudRouteForm.vue +8 -4
  23. package/src/components/CrudRowValue.vue +9 -8
  24. package/src/components/CrudSearch.vue +2 -1
  25. package/src/components/buttons/CrudAiButton.vue +9 -4
  26. package/src/components/buttons/CrudColumnsButton.vue +22 -8
  27. package/src/components/buttons/CrudCreateButton.vue +9 -4
  28. package/src/components/buttons/CrudCreateOnTheFlyButton.vue +13 -4
  29. package/src/components/buttons/CrudDeleteButton.vue +9 -5
  30. package/src/components/buttons/CrudDialogNextButton.vue +19 -0
  31. package/src/components/buttons/CrudDialogPrevButton.vue +19 -0
  32. package/src/components/buttons/CrudExportButton.vue +13 -8
  33. package/src/components/buttons/CrudFilterButton.vue +10 -5
  34. package/src/components/buttons/CrudGroupByButton.vue +33 -16
  35. package/src/components/buttons/CrudImportButton.vue +16 -10
  36. package/src/components/buttons/CrudOpenRouteFormButton.vue +19 -0
  37. package/src/components/buttons/CrudRefreshButton.vue +9 -4
  38. package/src/components/buttons/CrudSavedQueriesButton.vue +42 -20
  39. package/src/components/buttons/CrudUpdateButton.vue +9 -5
  40. package/src/components/buttons/CrudViewButton.vue +9 -5
  41. package/src/components/combobox/EntityCombobox.vue +4 -0
  42. package/src/config/CrudButtonConfig.ts +104 -0
  43. package/src/cruds/EntityCrud.ts +7 -7
  44. package/src/index.ts +33 -1
@@ -50,6 +50,8 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
50
50
 
51
51
  <template>
52
52
  <v-data-table-server
53
+ :id="`crud-list-table-${entity.name}`"
54
+ class="crud-list-table"
53
55
  :density="entity.tableDensity"
54
56
  :striped="entity.tableStriped"
55
57
  :header-props="entity.headerProps"
@@ -71,25 +73,26 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
71
73
  <template v-slot:no-data>
72
74
  <v-alert
73
75
  v-if="paginationError"
76
+ id="crud-list-table-pagination-error"
74
77
  variant="tonal"
75
- class="w-100 ma-2"
78
+ class="crud-list-table__pagination-error w-100 ma-2"
76
79
  style="width: 100%; min-width: 100%"
77
80
  prominent
78
81
  type="error"
79
82
  :text="te(paginationError) ? t(paginationError) : paginationError"
80
83
  />
81
- <v-alert v-else variant="tonal" class="w-100 ma-2 " type="info" :text="te('crud.noData') ? t('crud.noData') : 'No data' " />
84
+ <v-alert v-else id="crud-list-table-no-data" variant="tonal" class="crud-list-table__no-data w-100 ma-2 " type="info" :text="te('crud.noData') ? t('crud.noData') : 'No data' " />
82
85
  </template>
83
86
 
84
87
  <template v-slot:bottom>
85
- <v-data-table-footer :class="entity.footerClass"
88
+ <v-data-table-footer id="crud-list-table-footer" :class="['crud-list-table__footer', entity.footerClass]"
86
89
  :items-per-page-options="[5, 10, 20, 50]"
87
90
  ></v-data-table-footer>
88
91
  </template>
89
92
 
90
93
  <template v-slot:top>
91
- <v-toolbar :class="entity.toolbarClass" :density="entity.toolbarDensity">
92
- <v-toolbar-title>
94
+ <v-toolbar id="crud-list-table-toolbar" :class="['crud-list-table__toolbar', entity.toolbarClass]" :density="entity.toolbarDensity">
95
+ <v-toolbar-title id="crud-list-table-title" class="crud-list-table__title">
93
96
  {{ te(`${entity.name.toLowerCase()}.crud`) ? t(`${entity.name.toLowerCase()}.crud`) : entity.name }}
94
97
  </v-toolbar-title>
95
98
  <v-spacer></v-spacer>
@@ -100,30 +103,42 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
100
103
 
101
104
  <crud-saved-queries-button
102
105
  v-if="entity.isSavedQueriesEnabled"
106
+ id="crud-list-table-saved-queries-button"
107
+ class="crud-list-table__saved-queries-button"
103
108
  :entity="entity"
104
109
  />
105
110
 
106
111
 
107
112
  <crud-import-button
113
+ id="crud-list-table-import-button"
114
+ class="crud-list-table__import-button"
108
115
  :entity="entity"
109
116
  @import="(file:any, format:any) => $emit('import', file, format)"
110
117
  />
111
118
 
112
119
  <crud-export-button
120
+ id="crud-list-table-export-button"
121
+ class="crud-list-table__export-button"
113
122
  :entity="entity"
114
123
  @export="(v:any) => $emit('export',v)"
115
124
  />
116
125
 
117
126
  <crud-group-by-button
118
127
  v-if="entity.isGroupable"
128
+ id="crud-list-table-group-by-button"
129
+ class="crud-list-table__group-by-button"
119
130
  :entity="entity"
120
131
  />
121
132
 
122
133
  <crud-filter-button
134
+ id="crud-list-table-filter-button"
135
+ class="crud-list-table__filter-button"
123
136
  :entity="entity" />
124
137
 
125
138
  <crud-columns-button
126
139
  v-if="entity.isColumnSelectable"
140
+ id="crud-list-table-columns-button"
141
+ class="crud-list-table__columns-button"
127
142
  :entity="entity"
128
143
  />
129
144
 
@@ -134,11 +149,15 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
134
149
 
135
150
  <crud-refresh-button
136
151
  v-if="entity.isRefreshable !== false"
152
+ id="crud-list-table-refresh-button"
153
+ class="crud-list-table__refresh-button"
137
154
  @click="doPaginate"
138
155
  />
139
156
 
140
157
  <crud-create-button
141
158
  v-if="entity.isCreatable"
159
+ id="crud-list-table-create-button"
160
+ class="crud-list-table__create-button"
142
161
  :entity="entity"
143
162
  @click="$emit('create')"
144
163
  />
@@ -150,6 +169,8 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
150
169
  </v-toolbar>
151
170
 
152
171
  <crud-export-list
172
+ id="crud-list-table-export-list"
173
+ class="crud-list-table__export-list"
153
174
  :entity="entity"
154
175
  >
155
176
  <template #export-table="{ exportFiles }">
@@ -158,6 +179,8 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
158
179
  </crud-export-list>
159
180
 
160
181
  <crud-import-list
182
+ id="crud-list-table-import-list"
183
+ class="crud-list-table__import-list"
161
184
  :entity="entity"
162
185
  >
163
186
  <template #import-table="{ importFiles }">
@@ -165,20 +188,24 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
165
188
  </template>
166
189
  </crud-import-list>
167
190
 
168
- <v-card variant="flat">
169
- <v-card-text v-if="entity.searchEnable">
191
+ <v-card id="crud-list-table-controls" class="crud-list-table__controls" variant="flat">
192
+ <v-card-text v-if="entity.searchEnable" id="crud-list-table-search-section" class="crud-list-table__search-section">
170
193
  <crud-search
194
+ id="crud-list-table-search"
195
+ class="crud-list-table__search"
171
196
  v-model="search"
172
197
  />
173
198
  </v-card-text>
174
199
 
175
- <v-card-text class="pt-0">
200
+ <v-card-text id="crud-list-table-filters-section" class="crud-list-table__filters-section pt-0">
176
201
  <slot name="filters" v-bind="{filters}"></slot>
177
202
 
178
- <v-card variant="flat" v-if="!$slots.filters">
203
+ <v-card id="crud-list-table-default-filters" class="crud-list-table__default-filters" variant="flat" v-if="!$slots.filters">
179
204
 
180
205
  <crud-filters
181
206
  v-if="entity.filtersEnable"
207
+ id="crud-list-table-filters"
208
+ class="crud-list-table__filters"
182
209
  :entity="entity"
183
210
  v-model="filters"
184
211
  :auto-filter="!entity.filterButtons"
@@ -199,6 +226,8 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
199
226
 
200
227
  <crud-filters-dynamic
201
228
  v-if="isDynamicFiltersEnable"
229
+ id="crud-list-table-dynamic-filters"
230
+ class="crud-list-table__dynamic-filters"
202
231
  :entity="entity"
203
232
  v-model="filters"
204
233
  :auto-filter="!entity.filterButtons"
@@ -208,6 +237,8 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
208
237
  </crud-filters-dynamic>
209
238
 
210
239
  <crud-filters-action v-if="entity.filterButtons"
240
+ id="crud-list-table-filters-actions"
241
+ class="crud-list-table__filters-actions"
211
242
  :entity="entity"
212
243
  @clearFilter="clearFilters()"
213
244
  @applyFilter="applyFilters()"
@@ -218,7 +249,7 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
218
249
 
219
250
  </v-card>
220
251
 
221
- <v-divider></v-divider>
252
+ <v-divider id="crud-list-table-toolbar-divider" class="crud-list-table__toolbar-divider"></v-divider>
222
253
 
223
254
 
224
255
 
@@ -228,6 +259,8 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
228
259
  <template v-for="header in entity.headers" :key="header.key" v-slot:[`item.${header.key}`]="{item, value}">
229
260
  <slot v-if="$slots[`item.${header.key}`]" :name="`item.${header.key}`" v-bind="{item, value}">
230
261
  <crud-row-value
262
+ :id="`crud-list-table-row-value-${header.key}`"
263
+ class="crud-list-table__row-value"
231
264
  :title="header.title || header.key"
232
265
  :value="value"
233
266
  />
@@ -242,16 +275,22 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
242
275
 
243
276
  <crud-view-button
244
277
  v-if="entity.isViewable && hasPermission(entity.permissions.view)"
278
+ :id="`crud-list-table-row-view-button-${index}`"
279
+ class="crud-list-table__row-view-button"
245
280
  @click="$emit('view', item, index)"
246
281
  />
247
282
 
248
283
  <crud-update-button
249
284
  v-if="entity.isEditable && entity.isItemEditable(item) && hasPermission(entity.permissions?.update)"
285
+ :id="`crud-list-table-row-update-button-${index}`"
286
+ class="crud-list-table__row-update-button"
250
287
  @click="$emit('edit', item, index)"
251
288
  />
252
289
 
253
290
  <crud-delete-button
254
291
  v-if="entity.isDeletable && hasPermission(entity.permissions?.delete)"
292
+ :id="`crud-list-table-row-delete-button-${index}`"
293
+ class="crud-list-table__row-delete-button"
255
294
  @click="$emit('delete', item, index)"
256
295
  />
257
296
 
@@ -11,11 +11,13 @@ defineProps({
11
11
 
12
12
  <template>
13
13
 
14
- <v-snackbar v-model="valueModel" :timeout="timeout" :color="color" >
14
+ <v-snackbar id="crud-notify" class="crud-notify" v-model="valueModel" :timeout="timeout" :color="color" >
15
15
  {{message}}
16
16
 
17
17
  <template v-slot:actions>
18
18
  <v-btn
19
+ id="crud-notify-close-button"
20
+ class="crud-notify__close-button"
19
21
  icon="mdi-close"
20
22
  variant="text"
21
23
  @click="valueModel = false"
@@ -41,6 +41,6 @@ watch(
41
41
  </script>
42
42
 
43
43
  <template>
44
- <span v-if="loading">...</span>
45
- <span v-else>{{display}}</span>
44
+ <span v-if="loading" id="crud-ref-display-loading" class="crud-ref-display crud-ref-display--loading">...</span>
45
+ <span v-else id="crud-ref-display-value" class="crud-ref-display crud-ref-display--value">{{display}}</span>
46
46
  </template>
@@ -163,12 +163,14 @@ async function prepareRouteForm() {
163
163
  </script>
164
164
 
165
165
  <template>
166
- <v-container :fluid="entity.containerFluid" class="mt-5">
167
- <v-card :class="entity.cardClass" :density="entity.cardDensity">
168
- <v-progress-linear v-if="store.loading" indeterminate/>
166
+ <v-container :id="`crud-route-form-container-${entity.name}`" :fluid="entity.containerFluid" class="crud-route-form mt-5">
167
+ <v-card :id="`crud-route-form-card-${entity.name}`" :class="['crud-route-form__card', entity.cardClass]" :density="entity.cardDensity">
168
+ <v-progress-linear v-if="store.loading" id="crud-route-form-loading" class="crud-route-form__loading" indeterminate/>
169
169
 
170
- <v-card-actions class="justify-start pa-2 pb-0">
170
+ <v-card-actions id="crud-route-form-actions" class="crud-route-form__actions justify-start pa-2 pb-0">
171
171
  <v-btn
172
+ id="crud-route-form-back-button"
173
+ class="crud-route-form__back-button"
172
174
  prepend-icon="mdi-arrow-left"
173
175
  variant="text"
174
176
  @click="goToList"
@@ -179,6 +181,8 @@ async function prepareRouteForm() {
179
181
 
180
182
  <crud-form
181
183
  v-if="formReady || store.error"
184
+ id="crud-route-form-form"
185
+ class="crud-route-form__form"
182
186
  :entity="entity"
183
187
  show-submit-and-return
184
188
  @created="created"
@@ -33,24 +33,25 @@ const openFullTextDialog = () => {
33
33
  <template>
34
34
  <span
35
35
  v-if="isLongString"
36
- class="d-inline-block text-truncate crud-row-value__truncated"
36
+ id="crud-row-value-truncated"
37
+ class="crud-row-value crud-row-value--truncated d-inline-block text-truncate crud-row-value__truncated"
37
38
  @click="openFullTextDialog"
38
39
  >
39
40
  {{ displayValue }}
40
41
  </span>
41
- <span v-else>{{ displayValue }}</span>
42
+ <span v-else id="crud-row-value-text" class="crud-row-value crud-row-value--text">{{ displayValue }}</span>
42
43
 
43
- <v-dialog v-model="fullTextDialog" max-width="720">
44
- <v-card>
45
- <v-card-title class="text-wrap">
44
+ <v-dialog id="crud-row-value-dialog" class="crud-row-value-dialog" v-model="fullTextDialog" max-width="720">
45
+ <v-card id="crud-row-value-dialog-card" class="crud-row-value-dialog__card">
46
+ <v-card-title id="crud-row-value-dialog-title" class="crud-row-value-dialog__title text-wrap">
46
47
  {{ title }}
47
48
  </v-card-title>
48
- <v-card-text class="crud-row-value__dialog-text">
49
+ <v-card-text id="crud-row-value-dialog-text" class="crud-row-value-dialog__text crud-row-value__dialog-text">
49
50
  {{ displayValue }}
50
51
  </v-card-text>
51
- <v-card-actions>
52
+ <v-card-actions id="crud-row-value-dialog-actions" class="crud-row-value-dialog__actions">
52
53
  <v-spacer />
53
- <v-btn variant="text" @click="fullTextDialog = false">
54
+ <v-btn id="crud-row-value-dialog-close-button" class="crud-row-value-dialog__close-button" variant="text" @click="fullTextDialog = false">
54
55
  {{ te('action.close') ? t('action.close') : 'Close' }}
55
56
  </v-btn>
56
57
  </v-card-actions>
@@ -28,8 +28,9 @@ function clear() {
28
28
 
29
29
  <template>
30
30
  <v-text-field v-model="input"
31
+ id="crud-search-input"
31
32
  density="compact"
32
- class="mr-2"
33
+ class="crud-search-input mr-2"
33
34
  variant="outlined"
34
35
  append-inner-icon="mdi-magnify"
35
36
  :label="t('action.search')"
@@ -3,6 +3,7 @@ import type {PropType} from "vue";
3
3
  import {computed} from "vue";
4
4
  import {useI18n} from "vue-i18n";
5
5
  import type {IEntityCrud} from "@drax/crud-share";
6
+ import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
6
7
 
7
8
  const expanded = defineModel<boolean>({default: false})
8
9
 
@@ -11,6 +12,7 @@ defineProps({
11
12
  })
12
13
 
13
14
  const {t, te} = useI18n()
15
+ const buttonConfig = useCrudButtonConfig("ai")
14
16
 
15
17
  const tooltip = computed(() => {
16
18
  return te('action.aiAssist') ? t('action.aiAssist') : 'Asistencia IA'
@@ -22,13 +24,16 @@ function toggleExpanded() {
22
24
  </script>
23
25
 
24
26
  <template>
25
- <v-tooltip location="top">
27
+ <v-tooltip :id="`${$attrs.id || 'crud-ai-button'}-tooltip`" class="crud-ai-button__tooltip" location="top">
26
28
  <template v-slot:activator="{ props }">
27
29
  <v-btn
28
30
  v-bind="{ ...$attrs, ...props }"
29
- icon="mdi-robot-outline"
30
- class="mr-1"
31
- variant="text"
31
+ :icon="buttonConfig.icon"
32
+ :id="$attrs.id || 'crud-ai-button'"
33
+ class="crud-ai-button mr-1"
34
+ :variant="buttonConfig.variant"
35
+ :rounded="buttonConfig.rounded"
36
+ :color="buttonConfig.color"
32
37
  @click="toggleExpanded"
33
38
  />
34
39
  </template>
@@ -3,8 +3,10 @@ import type { PropType } from 'vue'
3
3
  import type { IEntityCrud } from '@drax/crud-share'
4
4
  import { useI18n } from 'vue-i18n'
5
5
  import { useCrudColumns } from '../../composables/UseCrudColumns'
6
+ import { useCrudButtonConfig } from '../../config/CrudButtonConfig'
6
7
 
7
8
  const { t } = useI18n()
9
+ const buttonConfig = useCrudButtonConfig('columns')
8
10
 
9
11
  const props = defineProps({
10
12
  entity: { type: Object as PropType<IEntityCrud>, required: true },
@@ -21,27 +23,33 @@ const {
21
23
  </script>
22
24
 
23
25
  <template>
24
- <v-menu offset-y :close-on-content-click="false">
26
+ <v-menu id="crud-columns-menu" class="crud-columns-menu" offset-y :close-on-content-click="false">
25
27
  <template v-slot:activator="{ props }">
26
28
  <v-btn
27
29
  v-bind="props"
30
+ id="crud-columns-button"
31
+ class="crud-columns-button"
28
32
  icon
29
- variant="text"
33
+ :variant="buttonConfig.variant"
34
+ :rounded="buttonConfig.rounded"
35
+ :color="buttonConfig.color"
30
36
  >
31
- <v-icon>mdi-view-column</v-icon>
37
+ <v-icon id="crud-columns-button-icon" class="crud-columns-button__icon">{{ buttonConfig.icon }}</v-icon>
32
38
  <v-tooltip activator="parent" location="bottom">
33
39
  {{ t('crud.columns.select') }}
34
40
  </v-tooltip>
35
41
  </v-btn>
36
42
  </template>
37
- <v-list>
38
- <v-list-subheader>
43
+ <v-list id="crud-columns-list" class="crud-columns-menu__list">
44
+ <v-list-subheader id="crud-columns-title" class="crud-columns-menu__title">
39
45
  {{ t('crud.columns.title') }}
40
46
  </v-list-subheader>
41
47
 
42
- <v-list-item>
43
- <div class="d-flex gap-2">
48
+ <v-list-item id="crud-columns-bulk-actions" class="crud-columns-menu__bulk-actions">
49
+ <div id="crud-columns-bulk-actions-content" class="crud-columns-menu__bulk-actions-content d-flex gap-2">
44
50
  <v-btn
51
+ id="crud-columns-select-all-button"
52
+ class="crud-columns-menu__select-all-button"
45
53
  size="small"
46
54
  variant="text"
47
55
  color="primary"
@@ -51,6 +59,8 @@ const {
51
59
  {{ t('crud.columns.selectAll') }}
52
60
  </v-btn>
53
61
  <v-btn
62
+ id="crud-columns-deselect-all-button"
63
+ class="crud-columns-menu__deselect-all-button"
54
64
  size="small"
55
65
  variant="text"
56
66
  color="primary"
@@ -67,15 +77,19 @@ const {
67
77
  <v-list-item
68
78
  v-for="column in availableColumns"
69
79
  :key="column.key"
80
+ :id="`crud-columns-item-${column.key}`"
81
+ class="crud-columns-menu__item"
70
82
  @click="toggleColumn(column.key)"
71
83
  >
72
84
  <template v-slot:prepend>
73
85
  <v-checkbox-btn
86
+ :id="`crud-columns-checkbox-${column.key}`"
87
+ class="crud-columns-menu__checkbox"
74
88
  :model-value="column.visible"
75
89
  @click.stop="toggleColumn(column.key)"
76
90
  ></v-checkbox-btn>
77
91
  </template>
78
- <v-list-item-title>{{ column.title }}</v-list-item-title>
92
+ <v-list-item-title class="crud-columns-menu__item-title">{{ column.title }}</v-list-item-title>
79
93
  </v-list-item>
80
94
  </v-list>
81
95
  </v-menu>
@@ -1,17 +1,22 @@
1
1
  <script setup lang="ts">
2
2
  import {useI18n} from "vue-i18n";
3
+ import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
3
4
 
4
5
  const {t} = useI18n()
6
+ const buttonConfig = useCrudButtonConfig("create")
5
7
  </script>
6
8
 
7
9
  <template>
8
- <v-tooltip location="top">
10
+ <v-tooltip :id="`${$attrs.id || 'crud-create-button'}-tooltip`" class="crud-create-button__tooltip" location="top">
9
11
  <template v-slot:activator="{ props }">
10
12
  <v-btn
11
13
  v-bind="{ ...$attrs, ...props }"
12
- icon="mdi-plus"
13
- class="mr-1"
14
- variant="text"
14
+ :icon="buttonConfig.icon"
15
+ :id="$attrs.id || 'crud-create-button'"
16
+ class="crud-create-button mr-1"
17
+ :variant="buttonConfig.variant"
18
+ :rounded="buttonConfig.rounded"
19
+ :color="buttonConfig.color"
15
20
  >
16
21
  </v-btn>
17
22
  </template>
@@ -6,8 +6,10 @@ import CrudForm from "../CrudForm.vue";
6
6
  import CrudDialog from "../CrudDialog.vue";
7
7
  import {useCrudStore} from "../../stores/UseCrudStore";
8
8
  import {useCrud} from "../../composables/UseCrud";
9
+ import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
9
10
 
10
11
  const {t} = useI18n()
12
+ const buttonConfig = useCrudButtonConfig("createOnTheFly")
11
13
 
12
14
  const dialog = ref(false)
13
15
 
@@ -38,13 +40,16 @@ const emit = defineEmits(['created'])
38
40
  </script>
39
41
 
40
42
  <template>
41
- <v-tooltip location="top">
43
+ <v-tooltip :id="`${$attrs.id || 'crud-create-on-the-fly-button'}-tooltip`" class="crud-create-on-the-fly-button__tooltip" location="top">
42
44
  <template v-slot:activator="{ props }">
43
45
  <v-btn
44
46
  v-bind="{ ...$attrs, ...props }"
45
- icon="mdi-plus"
46
- class="mr-1"
47
- variant="text"
47
+ :icon="buttonConfig.icon"
48
+ :id="$attrs.id || 'crud-create-on-the-fly-button'"
49
+ class="crud-create-on-the-fly-button mr-1"
50
+ :variant="buttonConfig.variant"
51
+ :rounded="buttonConfig.rounded"
52
+ :color="buttonConfig.color"
48
53
  @click="openDialog"
49
54
  >
50
55
  </v-btn>
@@ -53,12 +58,16 @@ const emit = defineEmits(['created'])
53
58
  </v-tooltip>
54
59
 
55
60
  <crud-dialog
61
+ id="crud-create-on-the-fly-dialog"
62
+ class="crud-create-on-the-fly-dialog"
56
63
  v-model="dialog"
57
64
  :entity="entity"
58
65
  operation="create"
59
66
  :fullscreen="false"
60
67
  >
61
68
  <crud-form
69
+ id="crud-create-on-the-fly-form"
70
+ class="crud-create-on-the-fly-form"
62
71
  :entity="entity"
63
72
  @created="onCreated"
64
73
  @canceled="onCanceled"
@@ -1,18 +1,22 @@
1
1
  <script setup lang="ts">
2
2
  import {useI18n} from "vue-i18n";
3
+ import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
3
4
 
4
5
  const {t} = useI18n()
6
+ const buttonConfig = useCrudButtonConfig("delete")
5
7
  </script>
6
8
 
7
9
  <template>
8
- <v-tooltip location="top">
10
+ <v-tooltip :id="`${$attrs.id || 'crud-delete-button'}-tooltip`" class="crud-delete-button__tooltip" location="top">
9
11
  <template v-slot:activator="{ props}">
10
12
  <v-btn
11
13
  v-bind="{ ...$attrs, ...props }"
12
- icon="mdi-delete"
13
- class="mr-1"
14
- variant="text"
15
- color="red"
14
+ :icon="buttonConfig.icon"
15
+ :id="$attrs.id || 'crud-delete-button'"
16
+ class="crud-delete-button mr-1"
17
+ :variant="buttonConfig.variant"
18
+ :rounded="buttonConfig.rounded"
19
+ :color="buttonConfig.color"
16
20
  >
17
21
  </v-btn>
18
22
  </template>
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
3
+
4
+ defineOptions({inheritAttrs: false})
5
+
6
+ const buttonConfig = useCrudButtonConfig("dialogNext")
7
+ </script>
8
+
9
+ <template>
10
+ <v-btn
11
+ v-bind="$attrs"
12
+ :id="$attrs.id || 'crud-dialog-next-button'"
13
+ class="crud-dialog-next-button"
14
+ :icon="buttonConfig.icon"
15
+ :variant="buttonConfig.variant"
16
+ :rounded="buttonConfig.rounded"
17
+ :color="buttonConfig.color"
18
+ />
19
+ </template>
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
3
+
4
+ defineOptions({inheritAttrs: false})
5
+
6
+ const buttonConfig = useCrudButtonConfig("dialogPrev")
7
+ </script>
8
+
9
+ <template>
10
+ <v-btn
11
+ v-bind="$attrs"
12
+ :id="$attrs.id || 'crud-dialog-prev-button'"
13
+ class="crud-dialog-prev-button"
14
+ :icon="buttonConfig.icon"
15
+ :variant="buttonConfig.variant"
16
+ :rounded="buttonConfig.rounded"
17
+ :color="buttonConfig.color"
18
+ />
19
+ </template>
@@ -3,8 +3,10 @@ import type {PropType} from "vue";
3
3
  import type {IEntityCrud} from "@drax/crud-share"
4
4
  import {useCrud} from "../../composables/UseCrud";
5
5
  import {useI18n} from "vue-i18n";
6
+ import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
6
7
 
7
8
  const {t} = useI18n()
9
+ const buttonConfig = useCrudButtonConfig("export")
8
10
 
9
11
  const {entity} = defineProps({
10
12
  entity: {type: Object as PropType<IEntityCrud>, required: true},
@@ -16,26 +18,29 @@ const {
16
18
  </script>
17
19
 
18
20
  <template>
19
- <v-menu v-if="entity.isExportable">
21
+ <v-menu v-if="entity.isExportable" id="crud-export-menu" class="crud-export-menu">
20
22
  <template v-slot:activator="{ props: mp }">
21
- <v-tooltip location="top">
23
+ <v-tooltip id="crud-export-button-tooltip" class="crud-export-button__tooltip" location="top">
22
24
  <template v-slot:activator="{ props: tp }">
23
25
  <v-btn
24
26
  v-bind="{...mp, ...tp}"
25
27
  :disabled="exportLoading"
26
- class="mr-1"
27
- variant="text"
28
+ id="crud-export-button"
29
+ class="crud-export-button mr-1"
30
+ :variant="buttonConfig.variant"
31
+ :rounded="buttonConfig.rounded"
32
+ :color="buttonConfig.color"
28
33
  :loading="exportLoading"
29
- icon="mdi-database-export-outline"
34
+ :icon="buttonConfig.icon"
30
35
  ></v-btn>
31
36
  </template>
32
37
  {{ t('action.export')}}
33
38
  </v-tooltip>
34
39
 
35
40
  </template>
36
- <v-list>
37
- <v-list-item v-for="format in entity.exportFormats" @click="$emit('export', format)">
38
- <v-list-item-title>{{format}}</v-list-item-title>
41
+ <v-list id="crud-export-format-list" class="crud-export-menu__list">
42
+ <v-list-item v-for="format in entity.exportFormats" :id="`crud-export-format-${format}`" class="crud-export-menu__item" @click="$emit('export', format)">
43
+ <v-list-item-title class="crud-export-menu__item-title">{{format}}</v-list-item-title>
39
44
  </v-list-item>
40
45
  </v-list>
41
46
 
@@ -4,6 +4,7 @@ import {computed} from "vue";
4
4
  import type {PropType} from "vue";
5
5
  import type {IEntityCrud} from "@drax/crud-share";
6
6
  import {useCrudStore} from "../../stores/UseCrudStore";
7
+ import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
7
8
 
8
9
  const {entity} = defineProps({
9
10
  entity: {type: Object as PropType<IEntityCrud>, required: true},
@@ -17,17 +18,21 @@ let dynamicFiltersEnable = computed({
17
18
  })
18
19
 
19
20
  const {t} = useI18n()
21
+ const buttonConfig = useCrudButtonConfig("filter")
20
22
  </script>
21
23
 
22
24
  <template>
23
- <div v-if="entity.dynamicFiltersEnable">
24
- <v-tooltip location="top">
25
+ <div v-if="entity.dynamicFiltersEnable" id="crud-filter-button-wrapper" class="crud-filter-button-wrapper">
26
+ <v-tooltip id="crud-filter-button-tooltip" class="crud-filter-button__tooltip" location="top">
25
27
  <template v-slot:activator="{ props }">
26
28
  <v-btn
27
29
  v-bind="{ ...$attrs, ...props }"
28
- :icon="dynamicFiltersEnable ? 'mdi-filter-off' : 'mdi-filter' "
29
- class="mr-1"
30
- variant="text"
30
+ :icon="dynamicFiltersEnable ? buttonConfig.activeIcon : buttonConfig.icon"
31
+ id="crud-filter-button"
32
+ class="crud-filter-button mr-1"
33
+ :variant="buttonConfig.variant"
34
+ :rounded="buttonConfig.rounded"
35
+ :color="buttonConfig.color"
31
36
  @click="dynamicFiltersEnable = !dynamicFiltersEnable"
32
37
  >
33
38
  </v-btn>