@drax/crud-vue 3.21.0 → 3.24.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 CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.21.0",
6
+ "version": "3.24.0",
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
9
9
  "module": "./src/index.ts",
@@ -27,7 +27,7 @@
27
27
  "@drax/common-front": "^3.19.0",
28
28
  "@drax/crud-front": "^3.21.0",
29
29
  "@drax/crud-share": "^3.21.0",
30
- "@drax/media-vue": "^3.21.0"
30
+ "@drax/media-vue": "^3.24.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": "9ceebbba20e7abf7337387e2a81d1475b9ba1bca"
53
+ "gitHead": "5e3a76b377ab284ce2b7dbda8364ec6b52e6763e"
54
54
  }
@@ -11,6 +11,7 @@ import CrudAi from "./CrudAi.vue";
11
11
  import {useCrud} from "../composables/UseCrud";
12
12
  import {useDisplay} from 'vuetify'
13
13
  import {useAuth} from "@drax/identity-vue";
14
+ import CrudRowValue from "./CrudRowValue.vue";
14
15
 
15
16
  const {entity} = defineProps({
16
17
  entity: {type: Object as PropType<IEntityCrud>, required: true},
@@ -111,7 +112,10 @@ watch(dialog, (value) => {
111
112
 
112
113
  <template v-for="header in entity.headers" :key="header.key" v-slot:[`item.${header.key}`]="{item, value}">
113
114
  <slot :name="`item.${header.key}`" v-bind="{item, value}">
114
- {{ (Array.isArray(value) && value.length > 0) || !Array.isArray(value) ? value : '' }}
115
+ <crud-row-value
116
+ :title="header.title || header.key"
117
+ :value="value"
118
+ />
115
119
  </slot>
116
120
  </template>
117
121
 
@@ -21,6 +21,7 @@ import CrudFiltersDynamic from "./CrudFiltersDynamic.vue";
21
21
  import CrudFiltersAction from "./CrudFiltersAction.vue";
22
22
  import CrudFilterButton from "./buttons/CrudFilterButton.vue";
23
23
  import CrudSavedQueriesButton from "./buttons/CrudSavedQueriesButton.vue";
24
+ import CrudRowValue from "./CrudRowValue.vue";
24
25
 
25
26
  const {t, te} = useI18n()
26
27
  const {hasPermission} = useAuth()
@@ -38,7 +39,6 @@ const {
38
39
  // Usar el composable de columnas
39
40
  const { filteredHeaders } = useCrudColumns(entity)
40
41
 
41
-
42
42
  defineExpose({
43
43
  doPaginate
44
44
  });
@@ -221,7 +221,10 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
221
221
 
222
222
  <template v-for="header in entity.headers" :key="header.key" v-slot:[`item.${header.key}`]="{item, value}">
223
223
  <slot v-if="$slots[`item.${header.key}`]" :name="`item.${header.key}`" v-bind="{item, value}">
224
- {{ value }}
224
+ <crud-row-value
225
+ :title="header.title || header.key"
226
+ :value="value"
227
+ />
225
228
  </slot>
226
229
  </template>
227
230
 
@@ -247,10 +250,5 @@ defineEmits(['import', 'export', 'create', 'update', 'delete', 'view', 'edit'])
247
250
  />
248
251
 
249
252
  </template>
250
-
251
253
  </v-data-table-server>
252
254
  </template>
253
-
254
- <style scoped>
255
-
256
- </style>
@@ -0,0 +1,71 @@
1
+ <script setup lang="ts">
2
+ import {computed, ref} from 'vue'
3
+ import {useI18n} from "vue-i18n";
4
+
5
+ const LONG_TEXT_THRESHOLD = 67
6
+
7
+ const {value} = defineProps({
8
+ title: {type: String, default: ''},
9
+ value: {type: null, required: true},
10
+ })
11
+
12
+ const {t, te} = useI18n()
13
+
14
+ const fullTextDialog = ref(false)
15
+
16
+ const isLongString = computed(() => {
17
+ return typeof value === 'string' && value.length > LONG_TEXT_THRESHOLD
18
+ })
19
+
20
+ const displayValue = computed(() => {
21
+ return (Array.isArray(value) && value.length > 0) || !Array.isArray(value) ? value : ''
22
+ })
23
+
24
+ const openFullTextDialog = () => {
25
+ if (!isLongString.value) {
26
+ return
27
+ }
28
+
29
+ fullTextDialog.value = true
30
+ }
31
+ </script>
32
+
33
+ <template>
34
+ <span
35
+ v-if="isLongString"
36
+ class="d-inline-block text-truncate crud-row-value__truncated"
37
+ @click="openFullTextDialog"
38
+ >
39
+ {{ displayValue }}
40
+ </span>
41
+ <span v-else>{{ displayValue }}</span>
42
+
43
+ <v-dialog v-model="fullTextDialog" max-width="720">
44
+ <v-card>
45
+ <v-card-title class="text-wrap">
46
+ {{ title }}
47
+ </v-card-title>
48
+ <v-card-text class="crud-row-value__dialog-text">
49
+ {{ displayValue }}
50
+ </v-card-text>
51
+ <v-card-actions>
52
+ <v-spacer />
53
+ <v-btn variant="text" @click="fullTextDialog = false">
54
+ {{ te('action.close') ? t('action.close') : 'Close' }}
55
+ </v-btn>
56
+ </v-card-actions>
57
+ </v-card>
58
+ </v-dialog>
59
+ </template>
60
+
61
+ <style scoped>
62
+ .crud-row-value__truncated {
63
+ cursor: pointer;
64
+ max-width: 230px;
65
+ }
66
+
67
+ .crud-row-value__dialog-text {
68
+ white-space: pre-wrap;
69
+ word-break: break-word;
70
+ }
71
+ </style>
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ import CrudFormList from "./components/CrudFormList.vue";
7
7
  import CrudList from "./components/CrudList.vue";
8
8
  import CrudListTable from "./components/CrudListTable.vue";
9
9
  import CrudListGallery from "./components/CrudListGallery.vue";
10
+ import CrudRowValue from "./components/CrudRowValue.vue";
10
11
  import CrudFilters from "./components/CrudFilters.vue";
11
12
  import CrudFiltersAction from "./components/CrudFiltersAction.vue";
12
13
  import CrudNotify from "./components/CrudNotify.vue";
@@ -33,6 +34,7 @@ export {
33
34
  CrudList,
34
35
  CrudListTable,
35
36
  CrudListGallery,
37
+ CrudRowValue,
36
38
  CrudNotify,
37
39
  CrudSearch,
38
40
  CrudAutocomplete,