@antcde/component-library 0.1.0 → 0.1.2
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/README.md +6 -0
- package/dist/component-library.css +1 -1
- package/dist/index.js +16719 -17759
- package/dist/types/components/BaseAppCard.vue.d.ts +18 -4
- package/dist/types/components/BaseAppCardSkeleton.vue.d.ts +2 -0
- package/dist/types/components/BaseDeleteDialog.vue.d.ts +20 -7
- package/dist/types/components/RBAC/Permissions/PermissionCard.vue.d.ts +1 -1
- package/dist/types/components/TasksFlow/useTaskFlow.d.ts +7 -6
- package/dist/types/index.d.ts +3 -1
- package/lib/DocumentManager/DocumentDrop.vue +2 -6
- package/lib/DocumentManager/DocumentManager.vue +48 -41
- package/lib/DocumentManager/hooks/useDms.ts +1 -3
- package/lib/DocumentManager/index.ts +1 -1
- package/lib/DocumentManager/lang/translations/de.json +36 -0
- package/lib/DocumentManager/lang/translations/en.json +38 -0
- package/lib/DocumentManager/lang/translations/nl.json +36 -0
- package/lib/DocumentManager/utils.ts +1 -1
- package/lib/ForgeViewer/ForgeViewer.vue +6 -5
- package/lib/ForgeViewer/lang/translations/de.json +6 -0
- package/lib/ForgeViewer/lang/translations/en.json +6 -0
- package/lib/ForgeViewer/lang/translations/nl.json +6 -0
- package/lib/ForgeViewer/useForgeViewer.ts +0 -1
- package/lib/GisViewer/GisViewer.vue +14 -8
- package/lib/GisViewer/useGisViewer.ts +3 -3
- package/package.json +4 -3
- package/lib/DocumentManager/hooks/useDarkMode.ts +0 -17
- package/lib/TableViewer/TableView.vue +0 -39
- package/lib/TableViewer/TableViewer.vue +0 -205
- package/lib/TableViewer/composables/records.ts +0 -53
- package/lib/TableViewer/composables/useFile.ts +0 -20
- package/lib/TableViewer/core/Columns/ColumnForm.vue +0 -230
- package/lib/TableViewer/core/Columns/ColumnsConfiguration.vue +0 -99
- package/lib/TableViewer/core/Columns/ColumnsConfigurationTable.vue +0 -186
- package/lib/TableViewer/core/Columns/ColumnsTable.vue +0 -165
- package/lib/TableViewer/core/Permissions/PermissionDialog.vue +0 -149
- package/lib/TableViewer/core/Permissions/PermissionForm.vue +0 -117
- package/lib/TableViewer/core/Permissions/PermissionsConfiguration.vue +0 -55
- package/lib/TableViewer/core/Permissions/PermissionsConfigurationTable.vue +0 -185
- package/lib/TableViewer/core/Permissions/PermissionsTable.vue +0 -207
- package/lib/TableViewer/core/Queries/QueriesMenu.vue +0 -75
- package/lib/TableViewer/core/Queries/QueryItem.vue +0 -112
- package/lib/TableViewer/core/Records/RecordCell.vue +0 -118
- package/lib/TableViewer/core/Records/RecordDialog.vue +0 -128
- package/lib/TableViewer/core/Records/RecordHeader.vue +0 -175
- package/lib/TableViewer/core/Records/RecordInput.vue +0 -183
- package/lib/TableViewer/core/Records/RecordValue.vue +0 -123
- package/lib/TableViewer/core/Records/RecordsTable.vue +0 -233
- package/lib/TableViewer/core/Records/RecordsTableToolbar.vue +0 -310
- package/lib/TableViewer/core/Relations/RelationForm.vue +0 -154
- package/lib/TableViewer/core/Relations/RelationsConfiguration.vue +0 -32
- package/lib/TableViewer/core/Relations/RelationsConfigurationTable.vue +0 -146
- package/lib/TableViewer/core/Relations/RelationsTable.vue +0 -129
- package/lib/TableViewer/core/Revisions/RevisionComparisonCell.vue +0 -50
- package/lib/TableViewer/core/Revisions/RevisionComparisonTable.vue +0 -98
- package/lib/TableViewer/core/Revisions/RevisionHistory.vue +0 -138
- package/lib/TableViewer/core/Revisions/RevisionSelector.vue +0 -140
- package/lib/TableViewer/index.ts +0 -4
- package/lib/TableViewer/services/file-handler.ts +0 -84
- package/lib/TableViewer/stores/client.ts +0 -18
- package/lib/TableViewer/stores/columns.ts +0 -152
- package/lib/TableViewer/stores/conditions.ts +0 -88
- package/lib/TableViewer/stores/permissions.ts +0 -102
- package/lib/TableViewer/stores/queries.ts +0 -80
- package/lib/TableViewer/stores/records.ts +0 -256
- package/lib/TableViewer/stores/relations.ts +0 -89
- package/lib/TableViewer/stores/revisions.ts +0 -194
- package/lib/TableViewer/stores/roles.ts +0 -109
- package/lib/TableViewer/stores/table.ts +0 -134
- package/lib/TableViewer/stores/tables.ts +0 -65
- package/lib/TableViewer/types/app.d.ts +0 -5
- package/lib/TableViewer/types/column.d.ts +0 -28
- package/lib/TableViewer/types/permission.d.ts +0 -12
- package/lib/TableViewer/types/project.d.ts +0 -37
- package/lib/TableViewer/types/tables.d.ts +0 -69
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { Column } from '@antcde/connect-ts/services/ColumnService'
|
|
3
|
-
// import { useProjectStore } from '../../stores/projects'
|
|
4
|
-
import { useColumnStore } from '../../stores/columns'
|
|
5
|
-
import { useRelationStore } from '../../stores/relations'
|
|
6
|
-
import { useTableStore } from '../../stores/table'
|
|
7
|
-
import { useI18n } from 'vue-i18n'
|
|
8
|
-
|
|
9
|
-
const { t } = useI18n()
|
|
10
|
-
|
|
11
|
-
const props = defineProps<{
|
|
12
|
-
column?: Column
|
|
13
|
-
}>()
|
|
14
|
-
|
|
15
|
-
const emit = defineEmits(['close'])
|
|
16
|
-
|
|
17
|
-
const relationStore = useRelationStore()
|
|
18
|
-
const columnStore = useColumnStore()
|
|
19
|
-
const tableStore = useTableStore()
|
|
20
|
-
const projectStore = useProjectStore()
|
|
21
|
-
|
|
22
|
-
const { isCreating, isFetchingColumns } = storeToRefs(relationStore)
|
|
23
|
-
const { columns } = storeToRefs(columnStore)
|
|
24
|
-
const { table, tables } = storeToRefs(tableStore)
|
|
25
|
-
|
|
26
|
-
const relationForm = ref()
|
|
27
|
-
|
|
28
|
-
const relation = reactive({
|
|
29
|
-
column: '',
|
|
30
|
-
related_table: '',
|
|
31
|
-
related_column: '',
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const isValid = computed(() => relation.column && relation.related_table && relation.related_column)
|
|
35
|
-
|
|
36
|
-
const columnsWithoutRelations = computed(() => columns.value.filter(column => !column.has_relation))
|
|
37
|
-
|
|
38
|
-
const relatableTables = computed(() => tables.value.filter(t => t.id !== table.value?.id))
|
|
39
|
-
|
|
40
|
-
const title = computed(() =>
|
|
41
|
-
props.column
|
|
42
|
-
? t('project.tableConfig.relations.updateRelation', { column: props.column.name })
|
|
43
|
-
: t('project.tableConfig.relations.newRelation'),
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
async function saveRelation() {
|
|
47
|
-
if (!isValid.value) {
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const body = {
|
|
52
|
-
...relation,
|
|
53
|
-
table: tableStore.table?.id as string,
|
|
54
|
-
project: projectStore.project?.id as string,
|
|
55
|
-
related_project: projectStore.project?.id as string,
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
await relationStore.createRelation(body)
|
|
59
|
-
await columnStore.fetchColumns()
|
|
60
|
-
closeDialog()
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function fetchTableColumns() {
|
|
64
|
-
if (relation.related_table) {
|
|
65
|
-
relationStore.fetchTableColumns(relation.related_table)
|
|
66
|
-
}
|
|
67
|
-
relation.related_column = ''
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function closeDialog() {
|
|
71
|
-
relationForm.value.reset()
|
|
72
|
-
emit('close')
|
|
73
|
-
}
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<template>
|
|
77
|
-
<v-card class="h-full w-full d-flex flex-col">
|
|
78
|
-
<v-toolbar class="px-0" density="compact" color="primary">
|
|
79
|
-
<v-toolbar-items>
|
|
80
|
-
<v-btn
|
|
81
|
-
icon="mdi-arrow-left"
|
|
82
|
-
@click="closeDialog"
|
|
83
|
-
/>
|
|
84
|
-
</v-toolbar-items>
|
|
85
|
-
|
|
86
|
-
<v-toolbar-title> {{ title }} </v-toolbar-title>
|
|
87
|
-
</v-toolbar>
|
|
88
|
-
|
|
89
|
-
<v-card-text class="flex-1">
|
|
90
|
-
<v-form ref="relationForm">
|
|
91
|
-
<v-label class="mb-2">
|
|
92
|
-
{{ t('project.tableConfig.relations.column') }}
|
|
93
|
-
</v-label>
|
|
94
|
-
<v-select
|
|
95
|
-
v-model="relation.column"
|
|
96
|
-
:items="columnsWithoutRelations"
|
|
97
|
-
:label="t('project.tableConfig.relations.column')"
|
|
98
|
-
:placeholder="t('project.tableConfig.relations.column')"
|
|
99
|
-
color="primary"
|
|
100
|
-
density="compact"
|
|
101
|
-
variant="outlined"
|
|
102
|
-
item-title="name"
|
|
103
|
-
item-value="id"
|
|
104
|
-
/>
|
|
105
|
-
|
|
106
|
-
<v-label class="mb-2">
|
|
107
|
-
{{ t('project.tableConfig.relations.relatedTable') }}
|
|
108
|
-
</v-label>
|
|
109
|
-
<v-select
|
|
110
|
-
v-model="relation.related_table"
|
|
111
|
-
:disabled="isFetchingColumns"
|
|
112
|
-
:items="relatableTables"
|
|
113
|
-
:label="t('project.tableConfig.relations.relatedTable')"
|
|
114
|
-
:placeholder="t('project.tableConfig.relations.relatedTable')"
|
|
115
|
-
color="primary"
|
|
116
|
-
density="compact"
|
|
117
|
-
variant="outlined"
|
|
118
|
-
item-title="name"
|
|
119
|
-
item-value="id"
|
|
120
|
-
@update:model-value="fetchTableColumns"
|
|
121
|
-
/>
|
|
122
|
-
|
|
123
|
-
<v-label class="mb-2">
|
|
124
|
-
{{ t('project.tableConfig.relations.relatedColumn') }}
|
|
125
|
-
</v-label>
|
|
126
|
-
<v-select
|
|
127
|
-
v-model="relation.related_column"
|
|
128
|
-
:disabled="isFetchingColumns || !relation.related_table"
|
|
129
|
-
:items="relationStore.columns"
|
|
130
|
-
:label="t('project.tableConfig.relations.relatedColumn')"
|
|
131
|
-
:placeholder="t('project.tableConfig.relations.relatedColumn')"
|
|
132
|
-
color="primary"
|
|
133
|
-
variant="outlined"
|
|
134
|
-
density="compact"
|
|
135
|
-
item-title="name"
|
|
136
|
-
item-value="id"
|
|
137
|
-
/>
|
|
138
|
-
</v-form>
|
|
139
|
-
</v-card-text>
|
|
140
|
-
|
|
141
|
-
<v-divider />
|
|
142
|
-
<v-card-actions>
|
|
143
|
-
<v-spacer />
|
|
144
|
-
<v-btn variant="text" color="primary" @click="closeDialog">
|
|
145
|
-
{{ t('system.buttons.cancel') }}
|
|
146
|
-
</v-btn>
|
|
147
|
-
<v-btn variant="tonal" color="primary" :disabled="!isValid || isCreating" :loading="isCreating" @click="saveRelation">
|
|
148
|
-
{{ t('system.buttons.save') }}
|
|
149
|
-
</v-btn>
|
|
150
|
-
</v-card-actions>
|
|
151
|
-
</v-card>
|
|
152
|
-
</template>
|
|
153
|
-
|
|
154
|
-
<style lang="scss" scoped></style>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { ref, watch } from 'vue'
|
|
3
|
-
import RelationForm from './RelationForm.vue'
|
|
4
|
-
import RelationsTable from './RelationsTable.vue'
|
|
5
|
-
|
|
6
|
-
const props = defineProps<{
|
|
7
|
-
displayed: boolean
|
|
8
|
-
}>()
|
|
9
|
-
|
|
10
|
-
const emit = defineEmits(['close'])
|
|
11
|
-
|
|
12
|
-
const isRelationFormShown = ref(false)
|
|
13
|
-
|
|
14
|
-
watch(() => props.displayed, () => isRelationFormShown.value = false)
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<template>
|
|
18
|
-
<v-dialog width="1200" height="600" :model-value="displayed" @update:model-value="emit('close')">
|
|
19
|
-
<v-card class="h-full overflow-auto">
|
|
20
|
-
<relation-form
|
|
21
|
-
v-if="isRelationFormShown"
|
|
22
|
-
@close="isRelationFormShown = false"
|
|
23
|
-
/>
|
|
24
|
-
|
|
25
|
-
<relations-table
|
|
26
|
-
v-if="!isRelationFormShown"
|
|
27
|
-
@open-relation-create="isRelationFormShown = true"
|
|
28
|
-
@close="emit('close')"
|
|
29
|
-
/>
|
|
30
|
-
</v-card>
|
|
31
|
-
</v-dialog>
|
|
32
|
-
</template>
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { TableRelation } from 'node_modules/@antcde/connect-ts/src/services/TableService'
|
|
3
|
-
|
|
4
|
-
import BaseClickableIcon from '@/components/BaseClickableIcon.vue'
|
|
5
|
-
import { storeToRefs } from 'pinia'
|
|
6
|
-
import { ref } from 'vue'
|
|
7
|
-
import { useI18n } from 'vue-i18n'
|
|
8
|
-
import { useColumnStore } from '../../stores/columns'
|
|
9
|
-
import { useRelationStore } from '../../stores/relations'
|
|
10
|
-
import { useTableStore } from '../../stores/table'
|
|
11
|
-
|
|
12
|
-
const { t } = useI18n()
|
|
13
|
-
|
|
14
|
-
interface ColumnHeader {
|
|
15
|
-
title: string
|
|
16
|
-
key: string
|
|
17
|
-
align?: 'start' | 'center' | 'end'
|
|
18
|
-
sortable?: boolean
|
|
19
|
-
hasSlot?: boolean
|
|
20
|
-
checkbox?: boolean
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type RelationHeader = ColumnHeader & {
|
|
24
|
-
title: 'column' | 'related table' | 'related column' | 'Actions'
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const relationStore = useRelationStore()
|
|
28
|
-
const tableStore = useTableStore()
|
|
29
|
-
const columnStore = useColumnStore()
|
|
30
|
-
|
|
31
|
-
const relationDialog = ref(false)
|
|
32
|
-
const relationDeleteDialog = ref(false)
|
|
33
|
-
const relationToDelete = ref<TableRelation | null>(null)
|
|
34
|
-
|
|
35
|
-
const { table } = storeToRefs(tableStore)
|
|
36
|
-
const { relations, isLoading } = storeToRefs(relationStore)
|
|
37
|
-
|
|
38
|
-
const relationHeaders: RelationHeader[] = [
|
|
39
|
-
{
|
|
40
|
-
title: 'column',
|
|
41
|
-
key: 'column',
|
|
42
|
-
sortable: false,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
title: 'related table',
|
|
46
|
-
key: 'related_table',
|
|
47
|
-
sortable: false,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
title: 'related column',
|
|
51
|
-
key: 'related_column',
|
|
52
|
-
sortable: false,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
title: 'Actions',
|
|
56
|
-
key: 'actions',
|
|
57
|
-
align: 'end',
|
|
58
|
-
sortable: false,
|
|
59
|
-
},
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
function setupRelationDelete(relation: TableRelation) {
|
|
63
|
-
relationToDelete.value = relation
|
|
64
|
-
relationDeleteDialog.value = true
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function closeRelationDeleteDialog() {
|
|
68
|
-
relationToDelete.value = null
|
|
69
|
-
relationDeleteDialog.value = false
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function deleteRelation() {
|
|
73
|
-
try {
|
|
74
|
-
if (relationToDelete.value?.id) {
|
|
75
|
-
relationStore.deleteRelation(relationToDelete.value.id)
|
|
76
|
-
closeRelationDeleteDialog()
|
|
77
|
-
columnStore.fetchColumns()
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
/* empty */
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
onMounted(() => {
|
|
86
|
-
if (table.value) {
|
|
87
|
-
relationStore.fetchRelations(table.value.id as string)
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<template>
|
|
93
|
-
<v-data-table
|
|
94
|
-
:headers="relationHeaders"
|
|
95
|
-
:items="relations"
|
|
96
|
-
:loading="isLoading"
|
|
97
|
-
:sort-by="[{ key: 'column', order: 'asc' }]"
|
|
98
|
-
color="primary"
|
|
99
|
-
density="compact"
|
|
100
|
-
>
|
|
101
|
-
<template #loading>
|
|
102
|
-
<v-skeleton-loader type="table-row@5" />
|
|
103
|
-
</template>
|
|
104
|
-
|
|
105
|
-
<template #top>
|
|
106
|
-
<v-toolbar density="compact">
|
|
107
|
-
<v-toolbar-title>{{ t('project.tableConfig.relations.title') }}</v-toolbar-title>
|
|
108
|
-
<v-spacer />
|
|
109
|
-
<BaseClickableIcon
|
|
110
|
-
id="ant-tour-create-relation"
|
|
111
|
-
:tooltip-text="t('project.tableConfig.relations.newRelation')"
|
|
112
|
-
icon="mdi-plus"
|
|
113
|
-
tooltip-location="start"
|
|
114
|
-
@click="relationDialog = true"
|
|
115
|
-
/>
|
|
116
|
-
</v-toolbar>
|
|
117
|
-
</template>
|
|
118
|
-
<template #item.column="{ item }">
|
|
119
|
-
{{ item.column.name }}
|
|
120
|
-
</template>
|
|
121
|
-
<template #item.related_table="{ item }">
|
|
122
|
-
{{ item.related_table.name }}
|
|
123
|
-
</template>
|
|
124
|
-
<template #item.related_column="{ item }">
|
|
125
|
-
{{ item.related_column?.name ?? 'id' }}
|
|
126
|
-
</template>
|
|
127
|
-
|
|
128
|
-
<template #[`item.actions`]="{ item }">
|
|
129
|
-
<BaseClickableIcon
|
|
130
|
-
:tooltip-text="t('system.buttons.delete')"
|
|
131
|
-
icon="mdi-delete"
|
|
132
|
-
size="x-small"
|
|
133
|
-
tooltip-location="start"
|
|
134
|
-
@click="setupRelationDelete(item)"
|
|
135
|
-
/>
|
|
136
|
-
</template>
|
|
137
|
-
</v-data-table>
|
|
138
|
-
<RelationDialog :display-dialog="relationDialog" @close="relationDialog = false" />
|
|
139
|
-
<base-delete-dialog
|
|
140
|
-
:delete-action="deleteRelation"
|
|
141
|
-
:displayed="relationDeleteDialog"
|
|
142
|
-
:is-loading="relationStore.isLoading"
|
|
143
|
-
:title="t('project.tableConfig.relations.deleteTitle')"
|
|
144
|
-
@close="closeRelationDeleteDialog"
|
|
145
|
-
/>
|
|
146
|
-
</template>
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { TableRelation } from 'node_modules/@antcde/connect-ts/src/services/TableService'
|
|
3
|
-
import { useI18n } from 'vue-i18n'
|
|
4
|
-
import { useColumnStore } from '../../stores/columns'
|
|
5
|
-
import { useRelationStore } from '../../stores/relations'
|
|
6
|
-
|
|
7
|
-
const { t } = useI18n()
|
|
8
|
-
|
|
9
|
-
const emit = defineEmits(['openRelationCreate', 'close'])
|
|
10
|
-
|
|
11
|
-
interface RelationHeader {
|
|
12
|
-
key: string
|
|
13
|
-
title: string
|
|
14
|
-
align?: 'start' | 'center' | 'end'
|
|
15
|
-
sortable?: boolean
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const relationStore = useRelationStore()
|
|
19
|
-
const columnStore = useColumnStore()
|
|
20
|
-
|
|
21
|
-
const relationDeleteDialog = ref(false)
|
|
22
|
-
const relationToDelete = ref<TableRelation | null>(null)
|
|
23
|
-
|
|
24
|
-
const { relations, isFetching } = storeToRefs(relationStore)
|
|
25
|
-
|
|
26
|
-
const relationHeaders: RelationHeader[] = [
|
|
27
|
-
{
|
|
28
|
-
title: t('project.tableConfig.relations.column'),
|
|
29
|
-
key: 'column',
|
|
30
|
-
sortable: false,
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
title: t('project.tableConfig.relations.relatedTable'),
|
|
34
|
-
key: 'related_table',
|
|
35
|
-
sortable: false,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
title: t('project.tableConfig.relations.relatedColumn'),
|
|
39
|
-
key: 'related_column',
|
|
40
|
-
sortable: false,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
title: t('system.actions'),
|
|
44
|
-
key: 'actions',
|
|
45
|
-
align: 'end',
|
|
46
|
-
sortable: false,
|
|
47
|
-
},
|
|
48
|
-
]
|
|
49
|
-
|
|
50
|
-
function setupRelationDelete(relation: TableRelation) {
|
|
51
|
-
relationToDelete.value = relation
|
|
52
|
-
relationDeleteDialog.value = true
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function closeRelationDeleteDialog() {
|
|
56
|
-
relationToDelete.value = null
|
|
57
|
-
relationDeleteDialog.value = false
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function deleteRelation() {
|
|
61
|
-
if (relationToDelete.value?.id) {
|
|
62
|
-
relationStore.deleteRelation(relationToDelete.value.id)
|
|
63
|
-
closeRelationDeleteDialog()
|
|
64
|
-
columnStore.fetchColumns()
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
</script>
|
|
68
|
-
|
|
69
|
-
<template>
|
|
70
|
-
<v-toolbar color="primary" class="px-0" density="compact">
|
|
71
|
-
<v-toolbar-title>{{ t('project.tableConfig.relations.title') }}</v-toolbar-title>
|
|
72
|
-
<v-spacer />
|
|
73
|
-
|
|
74
|
-
<v-toolbar-items>
|
|
75
|
-
<v-btn
|
|
76
|
-
v-tooltip="t('project.tableConfig.relations.newRelation')"
|
|
77
|
-
icon="mdi-plus"
|
|
78
|
-
@click="emit('openRelationCreate')"
|
|
79
|
-
/>
|
|
80
|
-
<v-btn
|
|
81
|
-
v-tooltip="t('system.buttons.close')"
|
|
82
|
-
icon="mdi-close"
|
|
83
|
-
@click="emit('close')"
|
|
84
|
-
/>
|
|
85
|
-
</v-toolbar-items>
|
|
86
|
-
</v-toolbar>
|
|
87
|
-
<v-data-table
|
|
88
|
-
:headers="relationHeaders"
|
|
89
|
-
:items="relations"
|
|
90
|
-
:loading="isFetching"
|
|
91
|
-
:sort-by="[{ key: 'column', order: 'asc' }]"
|
|
92
|
-
hide-default-footer
|
|
93
|
-
:items-per-page="relations.length"
|
|
94
|
-
density="compact"
|
|
95
|
-
>
|
|
96
|
-
<template #item.column="{ item }">
|
|
97
|
-
{{ item.column?.name }}
|
|
98
|
-
</template>
|
|
99
|
-
<template #item.related_table="{ item }">
|
|
100
|
-
{{ item.related_table?.name }}
|
|
101
|
-
</template>
|
|
102
|
-
<template #item.related_column="{ item }">
|
|
103
|
-
{{ item.related_column?.name ?? 'id' }}
|
|
104
|
-
</template>
|
|
105
|
-
|
|
106
|
-
<template #[`item.actions`]="{ item }">
|
|
107
|
-
<v-btn
|
|
108
|
-
v-tooltip="t('system.buttons.delete')"
|
|
109
|
-
size="small"
|
|
110
|
-
variant="text"
|
|
111
|
-
color="grey-darken-1"
|
|
112
|
-
icon="mdi-delete"
|
|
113
|
-
@click="setupRelationDelete(item as TableRelation)"
|
|
114
|
-
/>
|
|
115
|
-
</template>
|
|
116
|
-
</v-data-table>
|
|
117
|
-
|
|
118
|
-
<base-delete-dialog
|
|
119
|
-
:delete-action="deleteRelation"
|
|
120
|
-
:displayed="relationDeleteDialog"
|
|
121
|
-
:is-loading="relationStore.isDeleting"
|
|
122
|
-
:title="t('project.tableConfig.relations.deleteTitle')"
|
|
123
|
-
@close="closeRelationDeleteDialog"
|
|
124
|
-
/>
|
|
125
|
-
</template>
|
|
126
|
-
|
|
127
|
-
<style scoped>
|
|
128
|
-
|
|
129
|
-
</style>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import RecordValue from '../Records/RecordValue.vue'
|
|
3
|
-
|
|
4
|
-
const props = defineProps<{
|
|
5
|
-
newRecord: any
|
|
6
|
-
oldRecord: any
|
|
7
|
-
column: any
|
|
8
|
-
}>()
|
|
9
|
-
|
|
10
|
-
const oldValue = computed(() => {
|
|
11
|
-
const { column, oldRecord } = props
|
|
12
|
-
const isDocument = column.type === 'document'
|
|
13
|
-
|
|
14
|
-
return isDocument && oldRecord
|
|
15
|
-
? oldRecord?.[props.column.name]?.name
|
|
16
|
-
: oldRecord?.[props.column.name]
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const newValue = computed(() => {
|
|
20
|
-
const { column, newRecord } = props
|
|
21
|
-
const isDocument = column.type === 'document'
|
|
22
|
-
|
|
23
|
-
return isDocument && newRecord
|
|
24
|
-
? newRecord[column.name]?.name
|
|
25
|
-
: newRecord?.[props.column.name]
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const added = computed(() => props.newRecord && !props.oldRecord)
|
|
29
|
-
const deleted = computed(() => !props.newRecord && props.oldRecord)
|
|
30
|
-
const changed = computed(() => oldValue.value !== newValue.value)
|
|
31
|
-
|
|
32
|
-
const backgroundColor = computed(() => {
|
|
33
|
-
if (added.value)
|
|
34
|
-
return '#ecfdf0'
|
|
35
|
-
|
|
36
|
-
if (deleted.value)
|
|
37
|
-
return '#fbe9eb'
|
|
38
|
-
|
|
39
|
-
if (changed.value)
|
|
40
|
-
return '#FAFAD2'
|
|
41
|
-
|
|
42
|
-
return ''
|
|
43
|
-
})
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<template>
|
|
47
|
-
<span class="d-flex h-full w-full items-center px-4" :style="{ backgroundColor }">
|
|
48
|
-
<record-value :value="newRecord?.[column.name] ?? oldRecord?.[column.name] ?? null" :column="column" :record-id="newRecord?.id ?? oldRecord?.id" />
|
|
49
|
-
</span>
|
|
50
|
-
</template>
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import { storeToRefs } from 'pinia'
|
|
3
|
-
import { computed } from 'vue'
|
|
4
|
-
import { useColumnStore } from '../../stores/columns'
|
|
5
|
-
import { useRevisionStore } from '../../stores/revisions'
|
|
6
|
-
import RevisionComparisonCell from '../Revisions/RevisionComparisonCell.vue'
|
|
7
|
-
import RevisionSelector from '../Revisions/RevisionSelector.vue'
|
|
8
|
-
|
|
9
|
-
const revisionStore = useRevisionStore()
|
|
10
|
-
const columnStore = useColumnStore()
|
|
11
|
-
|
|
12
|
-
const { comparisonRecords, firstRevision, secondRevision, isLoadingComparisonData }
|
|
13
|
-
= storeToRefs(revisionStore)
|
|
14
|
-
|
|
15
|
-
const { columns } = storeToRefs(columnStore)
|
|
16
|
-
|
|
17
|
-
const headers = computed(() =>
|
|
18
|
-
columns.value.map(column => ({
|
|
19
|
-
title: column.name,
|
|
20
|
-
key: column.name,
|
|
21
|
-
sortable: false,
|
|
22
|
-
})),
|
|
23
|
-
)
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<template>
|
|
27
|
-
<v-data-table
|
|
28
|
-
:fixed-header="true"
|
|
29
|
-
:headers="headers"
|
|
30
|
-
density="compact"
|
|
31
|
-
:items="comparisonRecords"
|
|
32
|
-
:items-length="comparisonRecords.length"
|
|
33
|
-
:loading="isLoadingComparisonData"
|
|
34
|
-
class="comparison-table h-full"
|
|
35
|
-
>
|
|
36
|
-
<template #loading>
|
|
37
|
-
<v-skeleton-loader type="table-row@5" />
|
|
38
|
-
</template>
|
|
39
|
-
|
|
40
|
-
<template #top>
|
|
41
|
-
<v-toolbar color="primary" density="compact" class="pl-4 pr-8 items-center">
|
|
42
|
-
<v-btn
|
|
43
|
-
size="small"
|
|
44
|
-
icon="mdi-arrow-left"
|
|
45
|
-
@click="() => (revisionStore.inComparisonMode = false)"
|
|
46
|
-
/>
|
|
47
|
-
|
|
48
|
-
<v-toolbar-title class="flex-0-0">
|
|
49
|
-
{{ $t('project.records.tableMenu.revisions') }}
|
|
50
|
-
</v-toolbar-title>
|
|
51
|
-
<v-spacer />
|
|
52
|
-
|
|
53
|
-
<div class="d-flex items-center">
|
|
54
|
-
<revision-selector
|
|
55
|
-
:hide-current="false"
|
|
56
|
-
:selected="firstRevision"
|
|
57
|
-
:show-add-revision="false"
|
|
58
|
-
@select="revisionStore.setFirstRevision"
|
|
59
|
-
/>
|
|
60
|
-
|
|
61
|
-
<v-btn
|
|
62
|
-
v-tooltip="$t('project.records.tableMenu.swap')"
|
|
63
|
-
size="small"
|
|
64
|
-
icon="mdi-compare-horizontal"
|
|
65
|
-
@click="() => revisionStore.swapRevisions()"
|
|
66
|
-
/>
|
|
67
|
-
|
|
68
|
-
<revision-selector
|
|
69
|
-
:hide-current="false"
|
|
70
|
-
:show-add-revision="false"
|
|
71
|
-
:selected="secondRevision"
|
|
72
|
-
@select="revisionStore.setSecondRevision"
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
</v-toolbar>
|
|
76
|
-
</template>
|
|
77
|
-
|
|
78
|
-
<template v-for="header in headers" :key="header.key" #[`header.${header.key}`]="{ column }">
|
|
79
|
-
<span class="text-capitalize px-4 font-bold">{{ column.title }}</span>
|
|
80
|
-
</template>
|
|
81
|
-
|
|
82
|
-
<template v-for="header in headers" :key="header.key" #[`item.${header.key}`]="{ item }">
|
|
83
|
-
<revision-comparison-cell
|
|
84
|
-
:new-record="item.new"
|
|
85
|
-
:old-record="item.old"
|
|
86
|
-
:column="columns.find(column => column.name === header.title)"
|
|
87
|
-
/>
|
|
88
|
-
</template>
|
|
89
|
-
</v-data-table>
|
|
90
|
-
</template>
|
|
91
|
-
|
|
92
|
-
<style lang="scss">
|
|
93
|
-
.comparison-table {
|
|
94
|
-
.v-data-table__td {
|
|
95
|
-
padding: 0 !important;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
</style>
|