@antcde/component-library 0.1.0 → 0.1.1
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/dist/index.js +1660 -1658
- package/dist/types/components/TasksFlow/useTaskFlow.d.ts +0 -1
- package/lib/DocumentManager/DocumentManager.vue +10 -5
- package/lib/TableViewer/TableViewer.vue +51 -177
- package/lib/TableViewer/composables/columns.ts +51 -0
- package/lib/TableViewer/composables/records.ts +18 -1
- package/lib/TableViewer/composables/relations.ts +8 -0
- package/lib/TableViewer/core/Columns/ColumnForm.vue +403 -190
- package/lib/TableViewer/core/Columns/ColumnItem.vue +225 -0
- package/lib/TableViewer/core/Columns/ColumnsList.vue +142 -0
- package/lib/TableViewer/core/Columns/ForeignKeyColumnItem.vue +165 -0
- package/lib/TableViewer/core/Columns/ForeignKeyColumnsList.vue +55 -0
- package/lib/TableViewer/core/Dialog/DeleteConfirmationDialog.vue +63 -0
- package/lib/TableViewer/core/Filters/ConditionItem.vue +133 -0
- package/lib/TableViewer/core/Filters/ConditionsList.vue +53 -0
- package/lib/TableViewer/core/Filters/FiltersEditor.vue +48 -0
- package/lib/TableViewer/core/Filters/QueriesList.vue +63 -0
- package/lib/TableViewer/core/{Queries → Filters}/QueryItem.vue +3 -3
- package/lib/TableViewer/core/Records/RecordCell.vue +32 -42
- package/lib/TableViewer/core/Records/RecordForm.vue +146 -0
- package/lib/TableViewer/core/Records/RecordHeader.vue +60 -153
- package/lib/TableViewer/core/Records/RecordInput.vue +65 -14
- package/lib/TableViewer/core/Records/RecordValue.vue +67 -20
- package/lib/TableViewer/core/Records/RecordsTable.vue +97 -56
- package/lib/TableViewer/core/Records/RecordsTableToolbar.vue +42 -142
- package/lib/TableViewer/core/Revisions/RevisionHistory.vue +25 -7
- package/lib/TableViewer/core/Tables/TableEditor.vue +136 -0
- package/lib/TableViewer/core/Tables/TableItem.vue +162 -0
- package/lib/TableViewer/core/Tables/TableViewer.vue +28 -0
- package/lib/TableViewer/core/Tables/TablesList.vue +116 -0
- package/lib/TableViewer/stores/columnRelation.ts +106 -0
- package/lib/TableViewer/stores/columns.ts +56 -37
- package/lib/TableViewer/stores/conditions.ts +44 -46
- package/lib/TableViewer/stores/records.ts +73 -4
- package/lib/TableViewer/stores/table.ts +48 -52
- package/lib/TableViewer/stores/tables.ts +1 -1
- package/lib/TableViewer/types/column.d.ts +2 -2
- package/lib/TableViewer/types/relations.d.ts +7 -0
- package/package.json +2 -2
- package/lib/DocumentManager/hooks/useDarkMode.ts +0 -17
- package/lib/TableViewer/TableView.vue +0 -39
- 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/Records/RecordDialog.vue +0 -128
- 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
|
@@ -1,230 +1,443 @@
|
|
|
1
|
-
<script lang="ts"
|
|
2
|
-
import type { Column } from '@antcde/connect-ts
|
|
3
|
-
import { computed, ref,
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Column } from '@antcde/connect-ts'
|
|
3
|
+
import { computed, ref, watch } from 'vue'
|
|
5
4
|
import { useColumnStore } from '../../stores/columns'
|
|
5
|
+
import { useColumnRelationStore } from '../../stores/columnRelation'
|
|
6
|
+
import { useTablesStore } from '../../stores/tables'
|
|
7
|
+
import { storeToRefs } from 'pinia'
|
|
8
|
+
import type { RelatedEntity } from '@antcde/connect-ts/services/Table/ColumnRelationService'
|
|
9
|
+
import { relationTypes } from '../../composables/relations'
|
|
10
|
+
import { useI18n } from 'vue-i18n'
|
|
11
|
+
const { t } = useI18n()
|
|
6
12
|
|
|
7
13
|
const props = defineProps<{
|
|
8
|
-
column
|
|
14
|
+
column: Column | null
|
|
9
15
|
}>()
|
|
10
16
|
|
|
11
|
-
const emit = defineEmits
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
const emit = defineEmits<{
|
|
18
|
+
(e: 'close'): void
|
|
19
|
+
}>()
|
|
14
20
|
|
|
15
21
|
const columnStore = useColumnStore()
|
|
22
|
+
const columnRelationStore = useColumnRelationStore()
|
|
23
|
+
const tablesStore = useTablesStore()
|
|
16
24
|
|
|
17
|
-
const
|
|
18
|
-
const columnForm = ref()
|
|
19
|
-
|
|
20
|
-
const types = computed(() => {
|
|
21
|
-
return [
|
|
22
|
-
'text',
|
|
23
|
-
'text-field',
|
|
24
|
-
'integer',
|
|
25
|
-
'boolean',
|
|
26
|
-
'date',
|
|
27
|
-
'link',
|
|
28
|
-
'email',
|
|
29
|
-
'dropdown',
|
|
30
|
-
'document',
|
|
31
|
-
'table',
|
|
32
|
-
'float',
|
|
33
|
-
'sbscode',
|
|
34
|
-
].sort((a, b) => a.localeCompare(b))
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const inEditMode = computed(() => !!props.column)
|
|
25
|
+
const { tables } = storeToRefs(tablesStore)
|
|
38
26
|
|
|
39
|
-
|
|
27
|
+
type EditableColumn = {
|
|
28
|
+
name: string
|
|
29
|
+
type: string
|
|
30
|
+
options_value: string[]
|
|
31
|
+
default_value: string | null
|
|
32
|
+
is_unique: boolean
|
|
33
|
+
required: boolean
|
|
34
|
+
related_entity: RelatedEntity | null
|
|
35
|
+
related_table_id: string | null
|
|
36
|
+
display_label: string | null
|
|
37
|
+
}
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
const editableColumn = ref<EditableColumn>({
|
|
40
|
+
name: '',
|
|
41
|
+
type: '',
|
|
42
|
+
options_value: [] as string[],
|
|
43
|
+
default_value: '',
|
|
44
|
+
is_unique: false,
|
|
45
|
+
required: false,
|
|
46
|
+
related_entity: null as RelatedEntity | null,
|
|
47
|
+
related_table_id: null as string | null,
|
|
48
|
+
display_label: null as string | null
|
|
49
|
+
})
|
|
42
50
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
columnForm.value?.reset()
|
|
46
|
-
emit('close')
|
|
47
|
-
}
|
|
51
|
+
const isLoading = ref(false)
|
|
52
|
+
const displayLabelItems = ref<string[]>([])
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
const
|
|
54
|
+
const columnRelationLabel = computed(() => {
|
|
55
|
+
const table = tables.value.find((table) => table.id === editableColumn.value.related_table_id)
|
|
56
|
+
return table ? table.name : editableColumn.value.related_entity
|
|
57
|
+
})
|
|
51
58
|
|
|
52
|
-
|
|
59
|
+
async function updateColumn() {
|
|
60
|
+
if (!props.column?.id) {
|
|
53
61
|
return
|
|
54
62
|
}
|
|
63
|
+
isLoading.value = true
|
|
64
|
+
await columnStore.updateColumn(props.column.id, {
|
|
65
|
+
name: editableColumn.value.name,
|
|
66
|
+
required: editableColumn.value.required,
|
|
67
|
+
options_value: editableColumn.value.options_value ?? [],
|
|
68
|
+
default_value: editableColumn.value.default_value ?? ''
|
|
69
|
+
})
|
|
70
|
+
if (editableColumn.value.related_entity) {
|
|
71
|
+
columnRelationStore.addColumnRelation(props.column.id, {
|
|
72
|
+
related_entity: editableColumn.value.related_entity,
|
|
73
|
+
related_table_id: editableColumn.value.related_table_id ?? null,
|
|
74
|
+
display_label:
|
|
75
|
+
editableColumn.value.display_label === 'id' ? null : editableColumn.value.display_label
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
isLoading.value = false
|
|
79
|
+
close()
|
|
80
|
+
}
|
|
55
81
|
|
|
56
|
-
|
|
57
|
-
|
|
82
|
+
function addNewOptionValue(value: string) {
|
|
83
|
+
if (!value.length || editableColumn.value.options_value?.includes(value)) {
|
|
84
|
+
return
|
|
58
85
|
}
|
|
59
|
-
|
|
60
|
-
|
|
86
|
+
if (!editableColumn.value.options_value) {
|
|
87
|
+
editableColumn.value.options_value = []
|
|
61
88
|
}
|
|
62
|
-
|
|
89
|
+
editableColumn.value.options_value.push(value)
|
|
63
90
|
}
|
|
64
91
|
|
|
65
|
-
function
|
|
66
|
-
|
|
92
|
+
async function createColumnRelation(columnId: string, entity: RelatedEntity, tableId?: string) {
|
|
93
|
+
if (entity === 'table_record' && !tableId) {
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
columnRelationStore.addColumnRelation(columnId, {
|
|
98
|
+
related_entity: entity,
|
|
99
|
+
related_table_id: tableId ?? null
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async function updateColumnRelation(
|
|
104
|
+
columnId: string,
|
|
105
|
+
columnRelationId: string,
|
|
106
|
+
displayLabel: string
|
|
107
|
+
) {
|
|
108
|
+
columnRelationStore.updateColumnRelation(columnId, columnRelationId, {
|
|
109
|
+
display_label: displayLabel
|
|
110
|
+
})
|
|
67
111
|
}
|
|
68
112
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
113
|
+
function close() {
|
|
114
|
+
emit('close')
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
watch(
|
|
118
|
+
() => props.column,
|
|
119
|
+
async (newColumn) => {
|
|
120
|
+
editableColumn.value = {
|
|
121
|
+
name: newColumn?.name ?? '',
|
|
122
|
+
type: newColumn?.type ?? '',
|
|
123
|
+
options_value: newColumn?.options_value ?? [],
|
|
124
|
+
default_value: newColumn?.default_value?.toString() ?? null,
|
|
125
|
+
is_unique: newColumn?.is_unique ?? false,
|
|
126
|
+
required: newColumn?.required ?? false,
|
|
127
|
+
related_entity: newColumn?.column_relation?.related_entity ?? null,
|
|
128
|
+
related_table_id: newColumn?.column_relation?.related_table_id ?? null,
|
|
129
|
+
display_label: newColumn?.column_relation?.display_label ?? 'id'
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{ immediate: true, deep: true }
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
watch(
|
|
136
|
+
() => editableColumn.value,
|
|
137
|
+
async (newColumn) => {
|
|
138
|
+
if (newColumn.related_entity === 'table_record') {
|
|
139
|
+
if (!newColumn.related_table_id) {
|
|
140
|
+
return
|
|
141
|
+
}
|
|
142
|
+
const columns = await columnStore.fetchTableColumns(newColumn.related_table_id ?? '')
|
|
143
|
+
displayLabelItems.value = columns
|
|
144
|
+
?.filter((column) => ['text', 'text-field', 'email', 'link'].includes(column.type))
|
|
145
|
+
.map((column) => column.name)
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
{ immediate: true, deep: true }
|
|
73
149
|
)
|
|
74
150
|
</script>
|
|
75
151
|
|
|
76
152
|
<template>
|
|
77
|
-
<v-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
:placeholder="t('project.tableConfig.columns.dialog.type')"
|
|
120
|
-
:rules="[isRequired]"
|
|
121
|
-
color="primary"
|
|
122
|
-
density="compact"
|
|
123
|
-
variant="outlined"
|
|
124
|
-
/>
|
|
125
|
-
</div>
|
|
126
|
-
|
|
127
|
-
<v-combobox
|
|
128
|
-
v-if="columnItem.type === 'dropdown'"
|
|
129
|
-
v-model="columnItem.options_value"
|
|
130
|
-
:chips="true"
|
|
131
|
-
:label="t('project.tableConfig.columns.dialog.options')"
|
|
132
|
-
:closable-chips="true"
|
|
133
|
-
:disabled="inEditMode"
|
|
134
|
-
:multiple="true"
|
|
135
|
-
:placeholder="t('project.tableConfig.columns.dialog.values')"
|
|
136
|
-
:rules="[isRequired]"
|
|
137
|
-
color="primary"
|
|
138
|
-
density="compact"
|
|
139
|
-
variant="outlined"
|
|
140
|
-
/>
|
|
141
|
-
|
|
142
|
-
<div class="d-flex gap-4">
|
|
143
|
-
<v-checkbox
|
|
144
|
-
v-model="columnItem.required"
|
|
145
|
-
:label="t('project.tableConfig.columns.dialog.required')"
|
|
146
|
-
class="flex-1"
|
|
147
|
-
color="primary"
|
|
148
|
-
density="compact"
|
|
149
|
-
variant="outlined"
|
|
150
|
-
type="switch"
|
|
151
|
-
/>
|
|
152
|
-
|
|
153
|
-
<v-checkbox
|
|
154
|
-
v-model="columnItem.is_unique"
|
|
155
|
-
:disabled="inEditMode"
|
|
156
|
-
:label="t('project.tableConfig.columns.dialog.unique')"
|
|
157
|
-
class="flex-1 justify-end"
|
|
158
|
-
color="primary"
|
|
159
|
-
density="compact"
|
|
160
|
-
variant="outlined"
|
|
161
|
-
type="switch"
|
|
162
|
-
/>
|
|
163
|
-
</div>
|
|
164
|
-
|
|
165
|
-
<template v-if="columnItem.type && columnItem.type !== 'document' && !columnItem.is_unique">
|
|
166
|
-
<v-text-field
|
|
167
|
-
v-if="['integer', 'float'].includes(columnItem.type)"
|
|
168
|
-
v-model="columnItem.default_value"
|
|
169
|
-
:disabled="columnStore.isCreating || columnStore.isUpdating"
|
|
170
|
-
:label="t('project.tableConfig.columns.dialog.default')"
|
|
171
|
-
:placeholder="t('project.tableConfig.columns.dialog.value')"
|
|
172
|
-
color="primary"
|
|
173
|
-
density="compact"
|
|
174
|
-
variant="outlined"
|
|
175
|
-
type="number"
|
|
176
|
-
/>
|
|
177
|
-
|
|
178
|
-
<div v-else-if="columnItem.type === 'boolean'" class="d-flex items-center gap-4">
|
|
179
|
-
<v-checkbox
|
|
180
|
-
v-model="booleanDefaultActive"
|
|
153
|
+
<v-navigation-drawer
|
|
154
|
+
:model-value="!!column?.id"
|
|
155
|
+
:width="800"
|
|
156
|
+
:elevation="1"
|
|
157
|
+
location="right"
|
|
158
|
+
:border="0"
|
|
159
|
+
temporary
|
|
160
|
+
persistent
|
|
161
|
+
scrim
|
|
162
|
+
absolute
|
|
163
|
+
z-index="1000"
|
|
164
|
+
fixed
|
|
165
|
+
app
|
|
166
|
+
>
|
|
167
|
+
<v-sheet class="d-flex flex-col h-full">
|
|
168
|
+
<v-toolbar
|
|
169
|
+
class="d-flex flex-row justify-between align-center pe-4"
|
|
170
|
+
color="grey-lighten-3"
|
|
171
|
+
variant="tonal"
|
|
172
|
+
density="compact"
|
|
173
|
+
>
|
|
174
|
+
<v-toolbar-title class="text-h6 font-semibold"> Edit Column </v-toolbar-title>
|
|
175
|
+
<v-spacer />
|
|
176
|
+
<v-btn icon @click="close">
|
|
177
|
+
<v-icon>mdi-close</v-icon>
|
|
178
|
+
</v-btn>
|
|
179
|
+
</v-toolbar>
|
|
180
|
+
<v-divider />
|
|
181
|
+
<v-card
|
|
182
|
+
v-if="editableColumn"
|
|
183
|
+
class="d-flex flex-column h-full overflow-auto"
|
|
184
|
+
rounded="lg"
|
|
185
|
+
:elevation="0"
|
|
186
|
+
>
|
|
187
|
+
<v-sheet class="px-8 py-4 d-flex flex-column gap-4">
|
|
188
|
+
<v-sheet class="d-flex flex-row w-full">
|
|
189
|
+
<v-label class="mr-2 font-semibold w-[250px]"> Name </v-label>
|
|
190
|
+
<v-text-field
|
|
191
|
+
v-model="editableColumn.name"
|
|
192
|
+
variant="outlined"
|
|
193
|
+
color="primary"
|
|
194
|
+
density="compact"
|
|
181
195
|
hide-details
|
|
196
|
+
class="w-full"
|
|
197
|
+
/>
|
|
198
|
+
</v-sheet>
|
|
199
|
+
|
|
200
|
+
<v-sheet class="d-flex flex-row">
|
|
201
|
+
<v-label class="mr-2 font-semibold w-[250px]"> Type </v-label>
|
|
202
|
+
<v-select
|
|
203
|
+
:model-value="editableColumn.type"
|
|
204
|
+
:items="[editableColumn.type]"
|
|
205
|
+
variant="outlined"
|
|
182
206
|
color="primary"
|
|
183
|
-
|
|
184
|
-
:label="t('project.tableConfig.columns.dialog.default')"
|
|
207
|
+
hide-details
|
|
185
208
|
density="compact"
|
|
209
|
+
:menu-props="{ maxHeight: '400', width: '400' }"
|
|
210
|
+
disabled
|
|
211
|
+
class="w-full"
|
|
212
|
+
/>
|
|
213
|
+
</v-sheet>
|
|
214
|
+
</v-sheet>
|
|
215
|
+
|
|
216
|
+
<v-divider />
|
|
217
|
+
|
|
218
|
+
<v-sheet class="px-8 py-4 d-flex flex-column gap-4">
|
|
219
|
+
<v-sheet v-if="editableColumn.type === 'dropdown'" class="d-flex flex-row">
|
|
220
|
+
<v-label class="mr-2 font-semibold w-[250px]"> Options </v-label>
|
|
221
|
+
<v-menu :close-on-content-click="false">
|
|
222
|
+
<template #activator="{ props: activatorProps }">
|
|
223
|
+
<v-text-field
|
|
224
|
+
v-bind="activatorProps"
|
|
225
|
+
:model-value="`${editableColumn.options_value?.length ?? 0} added`"
|
|
226
|
+
density="compact"
|
|
227
|
+
color="primary"
|
|
228
|
+
variant="outlined"
|
|
229
|
+
readonly
|
|
230
|
+
hide-details
|
|
231
|
+
class="w-full"
|
|
232
|
+
append-inner-icon="mdi-chevron-down"
|
|
233
|
+
disabled
|
|
234
|
+
/>
|
|
235
|
+
</template>
|
|
236
|
+
<v-card class="d-flex flex-column" width="400">
|
|
237
|
+
<v-card-item>
|
|
238
|
+
<v-text-field
|
|
239
|
+
variant="outlined"
|
|
240
|
+
color="primary"
|
|
241
|
+
density="compact"
|
|
242
|
+
class="w-full"
|
|
243
|
+
hint="Press Enter to add value"
|
|
244
|
+
persistent-hint
|
|
245
|
+
@keydown.enter="addNewOptionValue($event.target.value)"
|
|
246
|
+
/>
|
|
247
|
+
</v-card-item>
|
|
248
|
+
<v-divider />
|
|
249
|
+
<v-card-item class="d-flex flex-row flex-wrap">
|
|
250
|
+
<v-chip
|
|
251
|
+
v-for="(item, optionIndex) in editableColumn.options_value"
|
|
252
|
+
:key="optionIndex"
|
|
253
|
+
class="ma-1"
|
|
254
|
+
small
|
|
255
|
+
closable
|
|
256
|
+
@click:close="() => editableColumn.options_value?.splice(optionIndex, 1)"
|
|
257
|
+
>
|
|
258
|
+
{{ item }}
|
|
259
|
+
</v-chip>
|
|
260
|
+
</v-card-item>
|
|
261
|
+
</v-card>
|
|
262
|
+
</v-menu>
|
|
263
|
+
</v-sheet>
|
|
264
|
+
|
|
265
|
+
<v-sheet
|
|
266
|
+
v-if="
|
|
267
|
+
!['uuid', 'document'].includes(editableColumn.type ?? '') && !editableColumn.is_unique
|
|
268
|
+
"
|
|
269
|
+
class="d-flex flex-row w-full"
|
|
270
|
+
>
|
|
271
|
+
<v-label class="mr-2 font-semibold w-[250px]"> Default Value </v-label>
|
|
272
|
+
|
|
273
|
+
<v-select
|
|
274
|
+
v-if="editableColumn.type === 'dropdown'"
|
|
275
|
+
v-model="(editableColumn.default_value as string)"
|
|
276
|
+
:items="editableColumn.options_value"
|
|
186
277
|
variant="outlined"
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
"
|
|
278
|
+
color="primary"
|
|
279
|
+
hide-details
|
|
280
|
+
density="compact"
|
|
281
|
+
class="w-full"
|
|
282
|
+
:disabled="editableColumn.is_unique"
|
|
192
283
|
/>
|
|
193
284
|
<v-switch
|
|
194
|
-
v-
|
|
285
|
+
v-else-if="editableColumn.type === 'boolean'"
|
|
286
|
+
v-model="editableColumn.default_value"
|
|
287
|
+
color="primary"
|
|
288
|
+
hide-details
|
|
289
|
+
density="compact"
|
|
290
|
+
variant="outlined"
|
|
291
|
+
type="switch"
|
|
292
|
+
base-color="grey-lighten-2"
|
|
293
|
+
true-value="1"
|
|
294
|
+
false-value="0"
|
|
295
|
+
:disabled="editableColumn.is_unique"
|
|
296
|
+
class="w-full"
|
|
297
|
+
/>
|
|
298
|
+
<v-text-field
|
|
299
|
+
v-else
|
|
300
|
+
v-model="editableColumn.default_value"
|
|
301
|
+
variant="outlined"
|
|
302
|
+
color="primary"
|
|
303
|
+
hide-details
|
|
304
|
+
density="compact"
|
|
305
|
+
class="w-full"
|
|
306
|
+
:disabled="editableColumn.is_unique"
|
|
307
|
+
/>
|
|
308
|
+
</v-sheet>
|
|
309
|
+
|
|
310
|
+
<v-sheet class="d-flex flex-row w-full">
|
|
311
|
+
<v-label class="mr-2 font-semibold w-[250px]"> Unique </v-label>
|
|
312
|
+
<v-checkbox
|
|
313
|
+
v-model="editableColumn.is_unique"
|
|
195
314
|
color="primary"
|
|
196
|
-
|
|
197
|
-
:label="columnItem.default_value?.toString()"
|
|
315
|
+
hide-details
|
|
198
316
|
density="compact"
|
|
199
317
|
variant="outlined"
|
|
318
|
+
type="switch"
|
|
319
|
+
disabled
|
|
320
|
+
class="w-full"
|
|
321
|
+
/>
|
|
322
|
+
</v-sheet>
|
|
323
|
+
|
|
324
|
+
<v-sheet class="d-flex flex-row w-full">
|
|
325
|
+
<v-label class="mr-2 font-semibold w-[250px]"> Required </v-label>
|
|
326
|
+
<v-checkbox
|
|
327
|
+
v-model="editableColumn.required"
|
|
328
|
+
color="primary"
|
|
200
329
|
hide-details
|
|
330
|
+
density="compact"
|
|
331
|
+
variant="outlined"
|
|
332
|
+
class="w-full"
|
|
201
333
|
/>
|
|
202
|
-
</
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
334
|
+
</v-sheet>
|
|
335
|
+
</v-sheet>
|
|
336
|
+
|
|
337
|
+
<template v-if="column?.type === 'uuid'">
|
|
338
|
+
<v-divider />
|
|
339
|
+
|
|
340
|
+
<v-sheet class="px-8 py-4 d-flex flex-column gap-4">
|
|
341
|
+
<v-sheet class="d-flex flex-row w-full">
|
|
342
|
+
<v-label class="mr-2 font-semibold w-[250px]"> Relation </v-label>
|
|
343
|
+
<v-menu>
|
|
344
|
+
<template #activator="{ props: activatorProps }">
|
|
345
|
+
<v-text-field
|
|
346
|
+
v-bind="activatorProps"
|
|
347
|
+
:model-value="columnRelationLabel ?? 'Select'"
|
|
348
|
+
variant="outlined"
|
|
349
|
+
hide-details
|
|
350
|
+
density="compact"
|
|
351
|
+
class="w-full"
|
|
352
|
+
color="primary"
|
|
353
|
+
append-inner-icon="mdi-chevron-down"
|
|
354
|
+
clearable
|
|
355
|
+
/>
|
|
356
|
+
</template>
|
|
357
|
+
<v-card>
|
|
358
|
+
<v-list color="primary" max-height="400" class="overflow-auto">
|
|
359
|
+
<v-list-subheader> System </v-list-subheader>
|
|
360
|
+
|
|
361
|
+
<v-list-item
|
|
362
|
+
v-for="relationType in relationTypes"
|
|
363
|
+
:key="relationType.value"
|
|
364
|
+
:title="relationType.title"
|
|
365
|
+
:value="relationType.value"
|
|
366
|
+
:active="editableColumn.related_entity === relationType.value"
|
|
367
|
+
@click="
|
|
368
|
+
() => {
|
|
369
|
+
editableColumn.related_entity = relationType.value
|
|
370
|
+
editableColumn.display_label = 'id'
|
|
371
|
+
editableColumn.related_table_id = null
|
|
372
|
+
}
|
|
373
|
+
"
|
|
374
|
+
/>
|
|
375
|
+
<v-divider />
|
|
376
|
+
<v-list-subheader> Table Records </v-list-subheader>
|
|
377
|
+
|
|
378
|
+
<v-list-item
|
|
379
|
+
v-for="table in tables"
|
|
380
|
+
:key="table.id"
|
|
381
|
+
:title="table.name"
|
|
382
|
+
:value="table.id"
|
|
383
|
+
:active="editableColumn.related_table_id === table.id"
|
|
384
|
+
density="compact"
|
|
385
|
+
@click="
|
|
386
|
+
() => {
|
|
387
|
+
editableColumn.related_entity = 'table_record'
|
|
388
|
+
editableColumn.display_label = 'id'
|
|
389
|
+
editableColumn.related_table_id = table.id
|
|
390
|
+
}
|
|
391
|
+
"
|
|
392
|
+
/>
|
|
393
|
+
</v-list>
|
|
394
|
+
</v-card>
|
|
395
|
+
</v-menu>
|
|
396
|
+
</v-sheet>
|
|
397
|
+
<v-sheet class="d-flex flex-row w-full">
|
|
398
|
+
<v-label class="mr-2 font-semibold w-[250px]"> Display Label </v-label>
|
|
399
|
+
<v-select
|
|
400
|
+
v-model="editableColumn.display_label"
|
|
401
|
+
:items="
|
|
402
|
+
editableColumn.related_entity === 'table_record'
|
|
403
|
+
? displayLabelItems
|
|
404
|
+
: [editableColumn.display_label]
|
|
405
|
+
"
|
|
406
|
+
variant="outlined"
|
|
407
|
+
color="primary"
|
|
408
|
+
hide-details
|
|
409
|
+
density="compact"
|
|
410
|
+
:menu-props="{ maxHeight: '400', width: '400' }"
|
|
411
|
+
:disabled="editableColumn.related_entity !== 'table_record'"
|
|
412
|
+
class="w-full"
|
|
413
|
+
/>
|
|
414
|
+
</v-sheet>
|
|
415
|
+
</v-sheet>
|
|
213
416
|
</template>
|
|
214
|
-
</v-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
417
|
+
</v-card>
|
|
418
|
+
<v-divider />
|
|
419
|
+
<v-sheet class="d-flex flex-row gap-4 justify-end align-center px-8 py-2">
|
|
420
|
+
<v-btn
|
|
421
|
+
:disabled="isLoading"
|
|
422
|
+
variant="text"
|
|
423
|
+
color="primary"
|
|
424
|
+
@click="close"
|
|
425
|
+
>
|
|
426
|
+
{{ t('system.buttons.cancel') }}
|
|
427
|
+
</v-btn>
|
|
428
|
+
<v-btn
|
|
429
|
+
:disabled="isLoading"
|
|
430
|
+
:loading="isLoading"
|
|
431
|
+
color="primary"
|
|
432
|
+
variant="flat"
|
|
433
|
+
@click="updateColumn"
|
|
434
|
+
>
|
|
435
|
+
{{ t('system.buttons.save') }}
|
|
436
|
+
</v-btn>
|
|
437
|
+
</v-sheet>
|
|
438
|
+
|
|
439
|
+
</v-sheet>
|
|
440
|
+
</v-navigation-drawer>
|
|
228
441
|
</template>
|
|
229
442
|
|
|
230
|
-
<style
|
|
443
|
+
<style scoped></style>
|