@drax/dashboard-vue 0.38.0 → 0.40.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": "0.38.0",
6
+ "version": "0.40.0",
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
9
9
  "module": "./src/index.ts",
@@ -24,8 +24,8 @@
24
24
  "format": "prettier --write src/"
25
25
  },
26
26
  "dependencies": {
27
- "@drax/crud-front": "^0.38.0",
28
- "@drax/crud-share": "^0.38.0"
27
+ "@drax/crud-front": "^0.40.0",
28
+ "@drax/crud-share": "^0.40.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "pinia": "^2.2.2",
@@ -62,5 +62,5 @@
62
62
  "vue-tsc": "^2.0.11",
63
63
  "vuetify": "^3.7.1"
64
64
  },
65
- "gitHead": "43c90f3c12165e7527edefbc80dd327a59236dd5"
65
+ "gitHead": "269ec7921d83364dfba091cd74bd3f45a8135c26"
66
66
  }
@@ -1,11 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import type {PropType} from "vue";
3
- import type {IDashboard} from "@drax/dashboard-share";
3
+ import type {IDashboardBase} from "@drax/dashboard-share";
4
4
  import GroupByCard from "../GroupByCard/GroupByCard.vue";
5
5
  import PaginateCard from "../PaginateCard/PaginateCard.vue";
6
6
 
7
7
  const {dashboard} = defineProps({
8
- dashboard: {type: Object as PropType<IDashboard>, required: true},
8
+ dashboard: {type: Object as PropType<IDashboardBase>, required: true},
9
9
  })
10
10
 
11
11
  </script>
@@ -13,7 +13,6 @@ const {dashboard} = defineProps({
13
13
  <template>
14
14
  <v-card v-if="dashboard" class="mt-3" >
15
15
  <v-card-title>{{dashboard.title}}</v-card-title>
16
- <v-card-subtitle>{{dashboard.identifier}}</v-card-subtitle>
17
16
  <v-card-text>
18
17
  <v-row>
19
18
  <v-col v-for="(card,i) in dashboard.cards" :key="i"
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import type {PropType} from "vue";
2
+ import {type PropType, watch} from "vue";
3
3
  import type {IDashboardCard} from "@drax/dashboard-share";
4
4
  import {useDashboardCard} from "../../composables/UseDashboardCard";
5
5
  import GroupByTableRender from "./renders/GroupByTableRender.vue";
@@ -17,10 +17,20 @@ const {fetchGroupByData, groupByHeaders, cardEntityFields} = useDashboardCard(ca
17
17
 
18
18
  const data = ref<any[]>()
19
19
 
20
- onMounted(async ()=> {
20
+ const loadData = async () => {
21
21
  data.value = await fetchGroupByData()
22
+ }
23
+
24
+ onMounted(async ()=> {
25
+ await loadData()
22
26
  })
23
27
 
28
+ watch(() => card, async () => {
29
+ await loadData()
30
+ }, { deep: true })
31
+
32
+
33
+
24
34
  </script>
25
35
 
26
36
  <template>
@@ -58,7 +58,7 @@ const chartData = computed(() => {
58
58
 
59
59
  let formattedValue = ''
60
60
 
61
- if (field.type === 'ref' && field.refDisplay && value) {
61
+ if (['ref','object'].includes(field.type) && field.refDisplay && value) {
62
62
  formattedValue = value[field.refDisplay]
63
63
  } else if (field.type === 'date' && value) {
64
64
  formattedValue = formatDateByUnit(value, dateFormat)
@@ -49,7 +49,7 @@ const cardData = computed(() => {
49
49
 
50
50
  let formattedValue = ''
51
51
 
52
- if (field.type === 'ref' && field.refDisplay && value) {
52
+ if (['ref','object'].includes(field.type) && field.refDisplay && value) {
53
53
  formattedValue = value[field.refDisplay]
54
54
  } else if (field.type === 'date' && value) {
55
55
  formattedValue = formatDateByUnit(value, dateFormat)
@@ -51,7 +51,7 @@ const chartData = computed(() => {
51
51
 
52
52
  let formattedValue = ''
53
53
 
54
- if (field.type === 'ref' && field.refDisplay && value) {
54
+ if (['ref','object'].includes(field.type) && field.refDisplay && value) {
55
55
  formattedValue = value[field.refDisplay]
56
56
  } else if (field.type === 'date' && value) {
57
57
  formattedValue = formatDateByUnit(value, dateFormat)
@@ -45,7 +45,7 @@ const getPercentage = (count: number) => {
45
45
  :key="field.name"
46
46
  v-slot:[`item.${field.name}`]="{ value }"
47
47
  >
48
- <template v-if="field.type === 'ref' && field.refDisplay">
48
+ <template v-if="['ref','object'].includes(field.type) && field.refDisplay">
49
49
  {{value[field.refDisplay]}}
50
50
  </template>
51
51
  <template v-else-if="field.type === 'date'">
@@ -12,7 +12,14 @@ export function useDashboardCard(card: IDashboardCard) {
12
12
  const {t, te} = useI18n()
13
13
 
14
14
  const cardEntity = computed<IEntityCrud>(() => {
15
- return store.getEntities.find((entity: IEntityCrud) => entity.name === card.entity)
15
+ if(card.entityInstance){
16
+ return card.entityInstance
17
+ }
18
+ const entityInstance = store.getEntities.find((entity: IEntityCrud) => entity.name === card.entity)
19
+ if(!entityInstance){
20
+ throw new Error(`Entity "${card.entity}" not found in entities DashboardStore`)
21
+ }
22
+ return entityInstance
16
23
  })
17
24
 
18
25
  const cardEntityFields = computed<IEntityCrudField[]>(() => {
package/src/index.ts CHANGED
@@ -2,12 +2,15 @@ import {DashboardCrudRoute} from './routes/DashboardCrudRoute'
2
2
  import DashboardCrudPage from './pages/crud/DashboardCrudPage.vue'
3
3
  import DashboardViewPage from './pages/DashboardViewPage.vue'
4
4
  import DashboardView from './components/DashboardView/DashboardView.vue'
5
+ import GroupByCard from './components/GroupByCard/GroupByCard.vue'
6
+ import PaginateCard from './components/PaginateCard/PaginateCard.vue'
5
7
  import DashboardCombobox from './combobox/DashboardCombobox.vue'
6
8
  import {useDashboardCard} from './composables/UseDashboardCard'
7
9
  import {useDashboardStore} from './stores/UseDashboardStore'
8
10
  import DashboardCrud from './cruds/DashboardCrud'
9
11
 
10
12
 
13
+
11
14
  export {
12
15
  //ROUTES
13
16
  DashboardCrudRoute,
@@ -17,6 +20,8 @@ export {
17
20
  //COMPONENTS
18
21
  DashboardView,
19
22
  DashboardCombobox,
23
+ GroupByCard,
24
+ PaginateCard,
20
25
  //CRUD
21
26
  DashboardCrud,
22
27
  //STORES