@drax/crud-vue 3.47.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.
- package/package.json +4 -4
- package/src/components/Crud.vue +6 -9
- package/src/components/buttons/CrudAiButton.vue +6 -2
- package/src/components/buttons/CrudColumnsButton.vue +6 -2
- package/src/components/buttons/CrudCreateButton.vue +6 -2
- package/src/components/buttons/CrudCreateOnTheFlyButton.vue +6 -2
- package/src/components/buttons/CrudDeleteButton.vue +6 -3
- package/src/components/buttons/CrudDialogNextButton.vue +19 -0
- package/src/components/buttons/CrudDialogPrevButton.vue +19 -0
- package/src/components/buttons/CrudExportButton.vue +6 -2
- package/src/components/buttons/CrudFilterButton.vue +6 -2
- package/src/components/buttons/CrudGroupByButton.vue +7 -3
- package/src/components/buttons/CrudImportButton.vue +6 -2
- package/src/components/buttons/CrudOpenRouteFormButton.vue +19 -0
- package/src/components/buttons/CrudRefreshButton.vue +6 -2
- package/src/components/buttons/CrudSavedQueriesButton.vue +7 -3
- package/src/components/buttons/CrudUpdateButton.vue +6 -3
- package/src/components/buttons/CrudViewButton.vue +6 -3
- package/src/config/CrudButtonConfig.ts +104 -0
- package/src/cruds/EntityCrud.ts +7 -7
- package/src/index.ts +33 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "3.
|
|
6
|
+
"version": "3.48.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./src/index.ts",
|
|
9
9
|
"module": "./src/index.ts",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@drax/common-front": "^3.29.0",
|
|
28
28
|
"@drax/crud-front": "^3.21.0",
|
|
29
|
-
"@drax/crud-share": "^3.
|
|
30
|
-
"@drax/media-vue": "^3.
|
|
29
|
+
"@drax/crud-share": "^3.48.0",
|
|
30
|
+
"@drax/media-vue": "^3.48.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"pinia": "^3.0.4",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"vue-tsc": "^3.2.4",
|
|
51
51
|
"vuetify": "^3.11.8"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "455427fd48fc742af2e301ab85af2d48e5b2da16"
|
|
54
54
|
}
|
package/src/components/Crud.vue
CHANGED
|
@@ -9,6 +9,9 @@ import CrudRouteForm from "./CrudRouteForm.vue";
|
|
|
9
9
|
import CrudNotify from "./CrudNotify.vue";
|
|
10
10
|
import CrudDialog from "./CrudDialog.vue";
|
|
11
11
|
import CrudAiButton from "./buttons/CrudAiButton.vue";
|
|
12
|
+
import CrudDialogNextButton from "./buttons/CrudDialogNextButton.vue";
|
|
13
|
+
import CrudDialogPrevButton from "./buttons/CrudDialogPrevButton.vue";
|
|
14
|
+
import CrudOpenRouteFormButton from "./buttons/CrudOpenRouteFormButton.vue";
|
|
12
15
|
import CrudAi from "./CrudAi.vue";
|
|
13
16
|
import {useCrud} from "../composables/UseCrud";
|
|
14
17
|
import {useDisplay} from 'vuetify'
|
|
@@ -240,31 +243,25 @@ watch(dialog, (value) => {
|
|
|
240
243
|
:operation="operation"
|
|
241
244
|
>
|
|
242
245
|
<template #toolbar-actions>
|
|
243
|
-
<
|
|
246
|
+
<crud-open-route-form-button
|
|
244
247
|
v-if="canOpenRouteCrudForm"
|
|
245
248
|
id="crud-open-route-form-button"
|
|
246
249
|
class="crud__open-route-form-button"
|
|
247
|
-
icon="mdi-open-in-new"
|
|
248
|
-
variant="text"
|
|
249
250
|
@click="openRouteCrudForm"
|
|
250
251
|
/>
|
|
251
252
|
|
|
252
|
-
<
|
|
253
|
+
<crud-dialog-prev-button
|
|
253
254
|
v-if="canNavigateItems"
|
|
254
255
|
id="crud-dialog-prev-button"
|
|
255
256
|
class="crud__dialog-prev-button"
|
|
256
|
-
icon="mdi-chevron-left"
|
|
257
|
-
variant="text"
|
|
258
257
|
:disabled="!canNavigatePrev"
|
|
259
258
|
@click="navigateView(-1)"
|
|
260
259
|
/>
|
|
261
260
|
|
|
262
|
-
<
|
|
261
|
+
<crud-dialog-next-button
|
|
263
262
|
v-if="canNavigateItems"
|
|
264
263
|
id="crud-dialog-next-button"
|
|
265
264
|
class="crud__dialog-next-button"
|
|
266
|
-
icon="mdi-chevron-right"
|
|
267
|
-
variant="text"
|
|
268
265
|
:disabled="!canNavigateNext"
|
|
269
266
|
@click="navigateView(1)"
|
|
270
267
|
/>
|
|
@@ -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'
|
|
@@ -26,10 +28,12 @@ function toggleExpanded() {
|
|
|
26
28
|
<template v-slot:activator="{ props }">
|
|
27
29
|
<v-btn
|
|
28
30
|
v-bind="{ ...$attrs, ...props }"
|
|
29
|
-
icon="
|
|
31
|
+
:icon="buttonConfig.icon"
|
|
30
32
|
:id="$attrs.id || 'crud-ai-button'"
|
|
31
33
|
class="crud-ai-button mr-1"
|
|
32
|
-
variant="
|
|
34
|
+
:variant="buttonConfig.variant"
|
|
35
|
+
:rounded="buttonConfig.rounded"
|
|
36
|
+
:color="buttonConfig.color"
|
|
33
37
|
@click="toggleExpanded"
|
|
34
38
|
/>
|
|
35
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 },
|
|
@@ -28,9 +30,11 @@ const {
|
|
|
28
30
|
id="crud-columns-button"
|
|
29
31
|
class="crud-columns-button"
|
|
30
32
|
icon
|
|
31
|
-
variant="
|
|
33
|
+
:variant="buttonConfig.variant"
|
|
34
|
+
:rounded="buttonConfig.rounded"
|
|
35
|
+
:color="buttonConfig.color"
|
|
32
36
|
>
|
|
33
|
-
<v-icon id="crud-columns-button-icon" class="crud-columns-button__icon">
|
|
37
|
+
<v-icon id="crud-columns-button-icon" class="crud-columns-button__icon">{{ buttonConfig.icon }}</v-icon>
|
|
34
38
|
<v-tooltip activator="parent" location="bottom">
|
|
35
39
|
{{ t('crud.columns.select') }}
|
|
36
40
|
</v-tooltip>
|
|
@@ -1,7 +1,9 @@
|
|
|
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>
|
|
@@ -9,10 +11,12 @@ const {t} = useI18n()
|
|
|
9
11
|
<template v-slot:activator="{ props }">
|
|
10
12
|
<v-btn
|
|
11
13
|
v-bind="{ ...$attrs, ...props }"
|
|
12
|
-
icon="
|
|
14
|
+
:icon="buttonConfig.icon"
|
|
13
15
|
:id="$attrs.id || 'crud-create-button'"
|
|
14
16
|
class="crud-create-button mr-1"
|
|
15
|
-
variant="
|
|
17
|
+
:variant="buttonConfig.variant"
|
|
18
|
+
:rounded="buttonConfig.rounded"
|
|
19
|
+
:color="buttonConfig.color"
|
|
16
20
|
>
|
|
17
21
|
</v-btn>
|
|
18
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
|
|
|
@@ -42,10 +44,12 @@ const emit = defineEmits(['created'])
|
|
|
42
44
|
<template v-slot:activator="{ props }">
|
|
43
45
|
<v-btn
|
|
44
46
|
v-bind="{ ...$attrs, ...props }"
|
|
45
|
-
icon="
|
|
47
|
+
:icon="buttonConfig.icon"
|
|
46
48
|
:id="$attrs.id || 'crud-create-on-the-fly-button'"
|
|
47
49
|
class="crud-create-on-the-fly-button mr-1"
|
|
48
|
-
variant="
|
|
50
|
+
:variant="buttonConfig.variant"
|
|
51
|
+
:rounded="buttonConfig.rounded"
|
|
52
|
+
:color="buttonConfig.color"
|
|
49
53
|
@click="openDialog"
|
|
50
54
|
>
|
|
51
55
|
</v-btn>
|
|
@@ -1,7 +1,9 @@
|
|
|
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>
|
|
@@ -9,11 +11,12 @@ const {t} = useI18n()
|
|
|
9
11
|
<template v-slot:activator="{ props}">
|
|
10
12
|
<v-btn
|
|
11
13
|
v-bind="{ ...$attrs, ...props }"
|
|
12
|
-
icon="
|
|
14
|
+
:icon="buttonConfig.icon"
|
|
13
15
|
:id="$attrs.id || 'crud-delete-button'"
|
|
14
16
|
class="crud-delete-button mr-1"
|
|
15
|
-
variant="
|
|
16
|
-
|
|
17
|
+
:variant="buttonConfig.variant"
|
|
18
|
+
:rounded="buttonConfig.rounded"
|
|
19
|
+
:color="buttonConfig.color"
|
|
17
20
|
>
|
|
18
21
|
</v-btn>
|
|
19
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},
|
|
@@ -25,9 +27,11 @@ const {
|
|
|
25
27
|
:disabled="exportLoading"
|
|
26
28
|
id="crud-export-button"
|
|
27
29
|
class="crud-export-button mr-1"
|
|
28
|
-
variant="
|
|
30
|
+
:variant="buttonConfig.variant"
|
|
31
|
+
:rounded="buttonConfig.rounded"
|
|
32
|
+
:color="buttonConfig.color"
|
|
29
33
|
:loading="exportLoading"
|
|
30
|
-
icon="
|
|
34
|
+
:icon="buttonConfig.icon"
|
|
31
35
|
></v-btn>
|
|
32
36
|
</template>
|
|
33
37
|
{{ t('action.export')}}
|
|
@@ -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,6 +18,7 @@ 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>
|
|
@@ -25,10 +27,12 @@ const {t} = useI18n()
|
|
|
25
27
|
<template v-slot:activator="{ props }">
|
|
26
28
|
<v-btn
|
|
27
29
|
v-bind="{ ...$attrs, ...props }"
|
|
28
|
-
:icon="dynamicFiltersEnable ?
|
|
30
|
+
:icon="dynamicFiltersEnable ? buttonConfig.activeIcon : buttonConfig.icon"
|
|
29
31
|
id="crud-filter-button"
|
|
30
32
|
class="crud-filter-button mr-1"
|
|
31
|
-
variant="
|
|
33
|
+
:variant="buttonConfig.variant"
|
|
34
|
+
:rounded="buttonConfig.rounded"
|
|
35
|
+
:color="buttonConfig.color"
|
|
32
36
|
@click="dynamicFiltersEnable = !dynamicFiltersEnable"
|
|
33
37
|
>
|
|
34
38
|
</v-btn>
|
|
@@ -6,8 +6,10 @@ import { useDateFormat } from "@drax/common-vue"
|
|
|
6
6
|
import { useI18n } from "vue-i18n"
|
|
7
7
|
import { useCrudGroupBy } from '../../composables/UseCrudGroupBy'
|
|
8
8
|
import CrudActiveFilters from "../CrudActiveFilters.vue";
|
|
9
|
+
import { useCrudButtonConfig } from "../../config/CrudButtonConfig";
|
|
9
10
|
|
|
10
11
|
const { t, te } = useI18n()
|
|
12
|
+
const buttonConfig = useCrudButtonConfig("groupBy")
|
|
11
13
|
|
|
12
14
|
const {formatDateByUnit} = useDateFormat()
|
|
13
15
|
|
|
@@ -69,12 +71,14 @@ const totalCount = computed(() => {
|
|
|
69
71
|
<div id="crud-group-by-wrapper" class="crud-group-by-wrapper">
|
|
70
72
|
<v-btn
|
|
71
73
|
id="crud-group-by-button"
|
|
72
|
-
class="crud-group-by-button"
|
|
74
|
+
class="crud-group-by-button mr-1"
|
|
73
75
|
icon
|
|
74
|
-
variant="
|
|
76
|
+
:variant="buttonConfig.variant"
|
|
77
|
+
:rounded="buttonConfig.rounded"
|
|
78
|
+
:color="buttonConfig.color"
|
|
75
79
|
@click="openDialog"
|
|
76
80
|
>
|
|
77
|
-
<v-icon id="crud-group-by-button-icon" class="crud-group-by-button__icon">
|
|
81
|
+
<v-icon id="crud-group-by-button-icon" class="crud-group-by-button__icon">{{ buttonConfig.icon }}</v-icon>
|
|
78
82
|
<v-tooltip activator="parent" location="bottom">
|
|
79
83
|
{{ t('crud.groupBy.button') }}
|
|
80
84
|
</v-tooltip>
|
|
@@ -4,8 +4,10 @@ import type {PropType} from "vue";
|
|
|
4
4
|
import type {IEntityCrud} from "@drax/crud-share"
|
|
5
5
|
import {useCrud} from "../../composables/UseCrud";
|
|
6
6
|
import {useI18n} from "vue-i18n";
|
|
7
|
+
import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
|
|
7
8
|
|
|
8
9
|
const {t} = useI18n()
|
|
10
|
+
const buttonConfig = useCrudButtonConfig("import")
|
|
9
11
|
const {entity} = defineProps({
|
|
10
12
|
entity: {type: Object as PropType<IEntityCrud>, required: true},
|
|
11
13
|
})
|
|
@@ -55,9 +57,11 @@ function onFileChange(event: Event) {
|
|
|
55
57
|
:disabled="importLoading"
|
|
56
58
|
id="crud-import-button"
|
|
57
59
|
class="crud-import-button mr-1"
|
|
58
|
-
variant="
|
|
60
|
+
:variant="buttonConfig.variant"
|
|
61
|
+
:rounded="buttonConfig.rounded"
|
|
62
|
+
:color="buttonConfig.color"
|
|
59
63
|
:loading="importLoading"
|
|
60
|
-
icon="
|
|
64
|
+
:icon="buttonConfig.icon"
|
|
61
65
|
></v-btn>
|
|
62
66
|
</template>
|
|
63
67
|
{{ t('action.import')}}
|
|
@@ -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("openRouteForm")
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<v-btn
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
:id="$attrs.id || 'crud-open-route-form-button'"
|
|
13
|
+
class="crud-open-route-form-button"
|
|
14
|
+
:icon="buttonConfig.icon"
|
|
15
|
+
:variant="buttonConfig.variant"
|
|
16
|
+
:rounded="buttonConfig.rounded"
|
|
17
|
+
:color="buttonConfig.color"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
@@ -1,7 +1,9 @@
|
|
|
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("refresh")
|
|
5
7
|
</script>
|
|
6
8
|
|
|
7
9
|
<template>
|
|
@@ -9,10 +11,12 @@ const {t} = useI18n()
|
|
|
9
11
|
<template v-slot:activator="{ props }">
|
|
10
12
|
<v-btn
|
|
11
13
|
v-bind="{ ...$attrs, ...props }"
|
|
12
|
-
icon="
|
|
14
|
+
:icon="buttonConfig.icon"
|
|
13
15
|
:id="$attrs.id || 'crud-refresh-button'"
|
|
14
16
|
class="crud-refresh-button mr-1"
|
|
15
|
-
variant="
|
|
17
|
+
:variant="buttonConfig.variant"
|
|
18
|
+
:rounded="buttonConfig.rounded"
|
|
19
|
+
:color="buttonConfig.color"
|
|
16
20
|
>
|
|
17
21
|
</v-btn>
|
|
18
22
|
</template>
|
|
@@ -8,10 +8,12 @@ import {useCrudColumns} from "../../composables/UseCrudColumns";
|
|
|
8
8
|
import {CrudSavedQueryProvider} from "@drax/crud-front";
|
|
9
9
|
import {useAuth, useAuthStore} from "@drax/identity-vue";
|
|
10
10
|
import {createCrudFilterValue} from "../../helpers/CrudRangeFilters";
|
|
11
|
+
import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
|
|
11
12
|
|
|
12
13
|
const {t, te} = useI18n();
|
|
13
14
|
const {hasPermission} = useAuth();
|
|
14
15
|
const authStore = useAuthStore();
|
|
16
|
+
const buttonConfig = useCrudButtonConfig("savedQueries");
|
|
15
17
|
|
|
16
18
|
const props = defineProps({
|
|
17
19
|
entity: {type: Object as PropType<IEntityCrud>, required: true},
|
|
@@ -227,11 +229,13 @@ function onMenuUpdate(value: boolean) {
|
|
|
227
229
|
<v-btn
|
|
228
230
|
v-bind="activatorProps"
|
|
229
231
|
id="crud-saved-queries-button"
|
|
230
|
-
class="crud-saved-queries-button"
|
|
232
|
+
class="crud-saved-queries-button mr-1"
|
|
231
233
|
icon
|
|
232
|
-
variant="
|
|
234
|
+
:variant="buttonConfig.variant"
|
|
235
|
+
:rounded="buttonConfig.rounded"
|
|
236
|
+
:color="buttonConfig.color"
|
|
233
237
|
>
|
|
234
|
-
<v-icon id="crud-saved-queries-button-icon" class="crud-saved-queries-button__icon">
|
|
238
|
+
<v-icon id="crud-saved-queries-button-icon" class="crud-saved-queries-button__icon">{{ buttonConfig.icon }}</v-icon>
|
|
235
239
|
<v-tooltip activator="parent" location="bottom">
|
|
236
240
|
{{ title }}
|
|
237
241
|
</v-tooltip>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {useI18n} from "vue-i18n";
|
|
3
|
+
import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
|
|
3
4
|
const {t} = useI18n()
|
|
5
|
+
const buttonConfig = useCrudButtonConfig("update")
|
|
4
6
|
</script>
|
|
5
7
|
|
|
6
8
|
<template>
|
|
@@ -8,11 +10,12 @@ const {t} = useI18n()
|
|
|
8
10
|
<template v-slot:activator="{ props}">
|
|
9
11
|
<v-btn
|
|
10
12
|
v-bind="{ ...$attrs, ...props }"
|
|
11
|
-
icon="
|
|
13
|
+
:icon="buttonConfig.icon"
|
|
12
14
|
:id="$attrs.id || 'crud-update-button'"
|
|
13
15
|
class="crud-update-button mr-1"
|
|
14
|
-
variant="
|
|
15
|
-
|
|
16
|
+
:variant="buttonConfig.variant"
|
|
17
|
+
:rounded="buttonConfig.rounded"
|
|
18
|
+
:color="buttonConfig.color"
|
|
16
19
|
slim
|
|
17
20
|
>
|
|
18
21
|
</v-btn>
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {useI18n} from "vue-i18n";
|
|
3
|
+
import {useCrudButtonConfig} from "../../config/CrudButtonConfig";
|
|
3
4
|
const {t} = useI18n()
|
|
5
|
+
const buttonConfig = useCrudButtonConfig("view")
|
|
4
6
|
</script>
|
|
5
7
|
|
|
6
8
|
<template>
|
|
@@ -8,11 +10,12 @@ const {t} = useI18n()
|
|
|
8
10
|
<template v-slot:activator="{ props}">
|
|
9
11
|
<v-btn
|
|
10
12
|
v-bind="{ ...$attrs, ...props }"
|
|
11
|
-
icon="
|
|
13
|
+
:icon="buttonConfig.icon"
|
|
12
14
|
:id="$attrs.id || 'crud-view-button'"
|
|
13
15
|
class="crud-view-button mr-1"
|
|
14
|
-
variant="
|
|
15
|
-
|
|
16
|
+
:variant="buttonConfig.variant"
|
|
17
|
+
:rounded="buttonConfig.rounded"
|
|
18
|
+
:color="buttonConfig.color"
|
|
16
19
|
slim
|
|
17
20
|
>
|
|
18
21
|
</v-btn>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {computed, reactive} from "vue";
|
|
2
|
+
|
|
3
|
+
export type CrudButtonName =
|
|
4
|
+
"ai"
|
|
5
|
+
| "columns"
|
|
6
|
+
| "create"
|
|
7
|
+
| "createOnTheFly"
|
|
8
|
+
| "delete"
|
|
9
|
+
| "dialogNext"
|
|
10
|
+
| "dialogPrev"
|
|
11
|
+
| "export"
|
|
12
|
+
| "filter"
|
|
13
|
+
| "groupBy"
|
|
14
|
+
| "import"
|
|
15
|
+
| "openRouteForm"
|
|
16
|
+
| "refresh"
|
|
17
|
+
| "savedQueries"
|
|
18
|
+
| "update"
|
|
19
|
+
| "view";
|
|
20
|
+
|
|
21
|
+
export type CrudButtonRounded = boolean | string | number;
|
|
22
|
+
export type CrudButtonVariant = "flat" | "text" | "elevated" | "outlined" | "plain" | "tonal";
|
|
23
|
+
|
|
24
|
+
export interface CrudButtonStyle {
|
|
25
|
+
icon?: string;
|
|
26
|
+
activeIcon?: string;
|
|
27
|
+
variant?: CrudButtonVariant;
|
|
28
|
+
rounded?: CrudButtonRounded;
|
|
29
|
+
color?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type CrudButtonGlobalStyle = Pick<CrudButtonStyle, "variant" | "rounded" | "color">;
|
|
33
|
+
|
|
34
|
+
export type CrudButtonsConfig = {
|
|
35
|
+
defaults?: CrudButtonGlobalStyle;
|
|
36
|
+
buttons?: Partial<Record<CrudButtonName, CrudButtonStyle>>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const crudButtonDefaultStyles: Record<CrudButtonName, CrudButtonStyle> = {
|
|
40
|
+
ai: {icon: "mdi-robot-outline", variant: "text"},
|
|
41
|
+
columns: {icon: "mdi-view-column", variant: "text"},
|
|
42
|
+
create: {icon: "mdi-plus", variant: "text"},
|
|
43
|
+
createOnTheFly: {icon: "mdi-plus", variant: "text"},
|
|
44
|
+
delete: {icon: "mdi-delete", variant: "text", color: "red"},
|
|
45
|
+
dialogNext: {icon: "mdi-chevron-right", variant: "text"},
|
|
46
|
+
dialogPrev: {icon: "mdi-chevron-left", variant: "text"},
|
|
47
|
+
export: {icon: "mdi-database-export-outline", variant: "text"},
|
|
48
|
+
filter: {icon: "mdi-filter", activeIcon: "mdi-filter-off", variant: "text"},
|
|
49
|
+
groupBy: {icon: "mdi-chart-bar", variant: "text"},
|
|
50
|
+
import: {icon: "mdi-database-import-outline", variant: "text"},
|
|
51
|
+
openRouteForm: {icon: "mdi-open-in-new", variant: "text"},
|
|
52
|
+
refresh: {icon: "mdi-refresh", variant: "text"},
|
|
53
|
+
savedQueries: {icon: "mdi-content-save-cog", variant: "text"},
|
|
54
|
+
update: {icon: "mdi-pencil", variant: "text", color: "blue"},
|
|
55
|
+
view: {icon: "mdi-magnify", variant: "text", color: "teal"},
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const crudButtonsConfig = reactive<Required<CrudButtonsConfig>>({
|
|
59
|
+
defaults: {},
|
|
60
|
+
buttons: {},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
export function configureCrudButtons(config: CrudButtonsConfig) {
|
|
64
|
+
if (config.defaults) {
|
|
65
|
+
Object.assign(crudButtonsConfig.defaults, config.defaults);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (config.buttons) {
|
|
69
|
+
Object.entries(config.buttons).forEach(([buttonName, buttonConfig]) => {
|
|
70
|
+
if (!buttonConfig) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const key = buttonName as CrudButtonName;
|
|
75
|
+
crudButtonsConfig.buttons[key] = {
|
|
76
|
+
...(crudButtonsConfig.buttons[key] || {}),
|
|
77
|
+
...buttonConfig,
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function resetCrudButtonsConfig() {
|
|
84
|
+
Object.keys(crudButtonsConfig.defaults).forEach((key) => {
|
|
85
|
+
delete crudButtonsConfig.defaults[key as keyof CrudButtonGlobalStyle];
|
|
86
|
+
});
|
|
87
|
+
Object.keys(crudButtonsConfig.buttons).forEach((key) => {
|
|
88
|
+
delete crudButtonsConfig.buttons[key as CrudButtonName];
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function getCrudButtonConfig(buttonName: CrudButtonName): CrudButtonStyle {
|
|
93
|
+
return {
|
|
94
|
+
...crudButtonDefaultStyles[buttonName],
|
|
95
|
+
...crudButtonsConfig.defaults,
|
|
96
|
+
...(crudButtonsConfig.buttons[buttonName] || {}),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function useCrudButtonConfig(buttonName: CrudButtonName) {
|
|
101
|
+
return computed(() => getCrudButtonConfig(buttonName));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export {crudButtonDefaultStyles, crudButtonsConfig};
|
package/src/cruds/EntityCrud.ts
CHANGED
|
@@ -287,24 +287,24 @@ class EntityCrud implements IEntityCrud {
|
|
|
287
287
|
return false
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
get cardDensity(): 'default' | 'comfortable' | 'compact' {
|
|
291
|
-
return
|
|
290
|
+
get cardDensity(): 'default' | 'comfortable' | 'compact' | undefined {
|
|
291
|
+
return undefined
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
get cardClass(): string {
|
|
295
|
-
return '
|
|
295
|
+
return ''
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
-
get toolbarDensity(): 'default' | 'comfortable' | 'compact' {
|
|
299
|
-
return
|
|
298
|
+
get toolbarDensity(): 'default' | 'comfortable' | 'compact' | undefined {
|
|
299
|
+
return undefined
|
|
300
300
|
}
|
|
301
301
|
|
|
302
302
|
get toolbarClass(): string {
|
|
303
303
|
return 'bg-primary'
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
get tableDensity(): 'default' | 'comfortable' | 'compact' {
|
|
307
|
-
return
|
|
306
|
+
get tableDensity(): 'default' | 'comfortable' | 'compact' | undefined {
|
|
307
|
+
return undefined
|
|
308
308
|
}
|
|
309
309
|
|
|
310
310
|
get headerProps() {
|
package/src/index.ts
CHANGED
|
@@ -16,6 +16,9 @@ import CrudNotify from "./components/CrudNotify.vue";
|
|
|
16
16
|
import CrudSearch from "./components/CrudSearch.vue";
|
|
17
17
|
import CrudAutocomplete from "./components/CrudAutocomplete.vue";
|
|
18
18
|
import CrudRefDisplay from "./components/CrudRefDisplay.vue";
|
|
19
|
+
import CrudDialogNextButton from "./components/buttons/CrudDialogNextButton.vue";
|
|
20
|
+
import CrudDialogPrevButton from "./components/buttons/CrudDialogPrevButton.vue";
|
|
21
|
+
import CrudOpenRouteFormButton from "./components/buttons/CrudOpenRouteFormButton.vue";
|
|
19
22
|
import CrudSavedQueriesButton from "./components/buttons/CrudSavedQueriesButton.vue";
|
|
20
23
|
import CrudRefreshButton from "./components/buttons/CrudRefreshButton.vue";
|
|
21
24
|
import EntityCombobox from "./components/combobox/EntityCombobox.vue";
|
|
@@ -28,6 +31,20 @@ import {useFilterIcon} from "./composables/UseFilterIcon";
|
|
|
28
31
|
import {useFormUtils} from "./composables/UseFormUtils";
|
|
29
32
|
import {useInputErrorI18n} from "./composables/UseInputErrorI18n";
|
|
30
33
|
import {EntityCrud} from "./cruds/EntityCrud";
|
|
34
|
+
import {
|
|
35
|
+
configureCrudButtons,
|
|
36
|
+
crudButtonDefaultStyles,
|
|
37
|
+
crudButtonsConfig,
|
|
38
|
+
getCrudButtonConfig,
|
|
39
|
+
resetCrudButtonsConfig,
|
|
40
|
+
useCrudButtonConfig,
|
|
41
|
+
type CrudButtonName,
|
|
42
|
+
type CrudButtonGlobalStyle,
|
|
43
|
+
type CrudButtonRounded,
|
|
44
|
+
type CrudButtonStyle,
|
|
45
|
+
type CrudButtonVariant,
|
|
46
|
+
type CrudButtonsConfig
|
|
47
|
+
} from "./config/CrudButtonConfig";
|
|
31
48
|
|
|
32
49
|
|
|
33
50
|
export {
|
|
@@ -46,6 +63,9 @@ export {
|
|
|
46
63
|
CrudSearch,
|
|
47
64
|
CrudAutocomplete,
|
|
48
65
|
CrudRefDisplay,
|
|
66
|
+
CrudDialogNextButton,
|
|
67
|
+
CrudDialogPrevButton,
|
|
68
|
+
CrudOpenRouteFormButton,
|
|
49
69
|
CrudSavedQueriesButton,
|
|
50
70
|
CrudRefreshButton,
|
|
51
71
|
CrudFilters,
|
|
@@ -58,8 +78,20 @@ export {
|
|
|
58
78
|
useInputErrorI18n,
|
|
59
79
|
useFilterIcon,
|
|
60
80
|
useCrudRefDisplay,
|
|
81
|
+
configureCrudButtons,
|
|
82
|
+
resetCrudButtonsConfig,
|
|
83
|
+
getCrudButtonConfig,
|
|
84
|
+
useCrudButtonConfig,
|
|
85
|
+
crudButtonDefaultStyles,
|
|
86
|
+
crudButtonsConfig,
|
|
61
87
|
EntityCrud,
|
|
62
88
|
useEntityStore,
|
|
63
|
-
EntityCombobox
|
|
89
|
+
EntityCombobox,
|
|
90
|
+
type CrudButtonName,
|
|
91
|
+
type CrudButtonGlobalStyle,
|
|
92
|
+
type CrudButtonRounded,
|
|
93
|
+
type CrudButtonStyle,
|
|
94
|
+
type CrudButtonVariant,
|
|
95
|
+
type CrudButtonsConfig
|
|
64
96
|
|
|
65
97
|
}
|