@antcde/component-library 0.1.1 → 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 +17133 -18175
- 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 -5
- package/dist/types/index.d.ts +3 -1
- package/lib/DocumentManager/DocumentDrop.vue +2 -6
- package/lib/DocumentManager/DocumentManager.vue +45 -43
- 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/TableViewer/TableViewer.vue +0 -79
- package/lib/TableViewer/composables/columns.ts +0 -51
- package/lib/TableViewer/composables/records.ts +0 -70
- package/lib/TableViewer/composables/relations.ts +0 -8
- package/lib/TableViewer/composables/useFile.ts +0 -20
- package/lib/TableViewer/core/Columns/ColumnForm.vue +0 -443
- package/lib/TableViewer/core/Columns/ColumnItem.vue +0 -225
- package/lib/TableViewer/core/Columns/ColumnsList.vue +0 -142
- package/lib/TableViewer/core/Columns/ForeignKeyColumnItem.vue +0 -165
- package/lib/TableViewer/core/Columns/ForeignKeyColumnsList.vue +0 -55
- package/lib/TableViewer/core/Dialog/DeleteConfirmationDialog.vue +0 -63
- package/lib/TableViewer/core/Filters/ConditionItem.vue +0 -133
- package/lib/TableViewer/core/Filters/ConditionsList.vue +0 -53
- package/lib/TableViewer/core/Filters/FiltersEditor.vue +0 -48
- package/lib/TableViewer/core/Filters/QueriesList.vue +0 -63
- package/lib/TableViewer/core/Filters/QueryItem.vue +0 -112
- package/lib/TableViewer/core/Records/RecordCell.vue +0 -108
- package/lib/TableViewer/core/Records/RecordForm.vue +0 -146
- package/lib/TableViewer/core/Records/RecordHeader.vue +0 -82
- package/lib/TableViewer/core/Records/RecordInput.vue +0 -234
- package/lib/TableViewer/core/Records/RecordValue.vue +0 -170
- package/lib/TableViewer/core/Records/RecordsTable.vue +0 -274
- package/lib/TableViewer/core/Records/RecordsTableToolbar.vue +0 -210
- 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 -156
- package/lib/TableViewer/core/Revisions/RevisionSelector.vue +0 -140
- package/lib/TableViewer/core/Tables/TableEditor.vue +0 -136
- package/lib/TableViewer/core/Tables/TableItem.vue +0 -162
- package/lib/TableViewer/core/Tables/TableViewer.vue +0 -28
- package/lib/TableViewer/core/Tables/TablesList.vue +0 -116
- 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/columnRelation.ts +0 -106
- package/lib/TableViewer/stores/columns.ts +0 -171
- package/lib/TableViewer/stores/conditions.ts +0 -86
- package/lib/TableViewer/stores/permissions.ts +0 -102
- package/lib/TableViewer/stores/queries.ts +0 -80
- package/lib/TableViewer/stores/records.ts +0 -325
- 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 -130
- 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/relations.d.ts +0 -7
- package/lib/TableViewer/types/tables.d.ts +0 -69
|
@@ -1,443 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { Column } from '@antcde/connect-ts'
|
|
3
|
-
import { computed, ref, watch } from 'vue'
|
|
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()
|
|
12
|
-
|
|
13
|
-
const props = defineProps<{
|
|
14
|
-
column: Column | null
|
|
15
|
-
}>()
|
|
16
|
-
|
|
17
|
-
const emit = defineEmits<{
|
|
18
|
-
(e: 'close'): void
|
|
19
|
-
}>()
|
|
20
|
-
|
|
21
|
-
const columnStore = useColumnStore()
|
|
22
|
-
const columnRelationStore = useColumnRelationStore()
|
|
23
|
-
const tablesStore = useTablesStore()
|
|
24
|
-
|
|
25
|
-
const { tables } = storeToRefs(tablesStore)
|
|
26
|
-
|
|
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
|
-
}
|
|
38
|
-
|
|
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
|
-
})
|
|
50
|
-
|
|
51
|
-
const isLoading = ref(false)
|
|
52
|
-
const displayLabelItems = ref<string[]>([])
|
|
53
|
-
|
|
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
|
-
})
|
|
58
|
-
|
|
59
|
-
async function updateColumn() {
|
|
60
|
-
if (!props.column?.id) {
|
|
61
|
-
return
|
|
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
|
-
}
|
|
81
|
-
|
|
82
|
-
function addNewOptionValue(value: string) {
|
|
83
|
-
if (!value.length || editableColumn.value.options_value?.includes(value)) {
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
if (!editableColumn.value.options_value) {
|
|
87
|
-
editableColumn.value.options_value = []
|
|
88
|
-
}
|
|
89
|
-
editableColumn.value.options_value.push(value)
|
|
90
|
-
}
|
|
91
|
-
|
|
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
|
-
})
|
|
111
|
-
}
|
|
112
|
-
|
|
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 }
|
|
149
|
-
)
|
|
150
|
-
</script>
|
|
151
|
-
|
|
152
|
-
<template>
|
|
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"
|
|
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"
|
|
206
|
-
color="primary"
|
|
207
|
-
hide-details
|
|
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"
|
|
277
|
-
variant="outlined"
|
|
278
|
-
color="primary"
|
|
279
|
-
hide-details
|
|
280
|
-
density="compact"
|
|
281
|
-
class="w-full"
|
|
282
|
-
:disabled="editableColumn.is_unique"
|
|
283
|
-
/>
|
|
284
|
-
<v-switch
|
|
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"
|
|
314
|
-
color="primary"
|
|
315
|
-
hide-details
|
|
316
|
-
density="compact"
|
|
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"
|
|
329
|
-
hide-details
|
|
330
|
-
density="compact"
|
|
331
|
-
variant="outlined"
|
|
332
|
-
class="w-full"
|
|
333
|
-
/>
|
|
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>
|
|
416
|
-
</template>
|
|
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>
|
|
441
|
-
</template>
|
|
442
|
-
|
|
443
|
-
<style scoped></style>
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import type { Column } from '@antcde/connect-ts'
|
|
3
|
-
import { computed, ref, watch } from 'vue'
|
|
4
|
-
import { getColumnTypesOptions } from '../../composables/columns'
|
|
5
|
-
import { useColumnStore } from '../../stores/columns'
|
|
6
|
-
import { storeToRefs } from 'pinia'
|
|
7
|
-
|
|
8
|
-
const props = defineProps<{
|
|
9
|
-
column: Partial<Column>
|
|
10
|
-
}>()
|
|
11
|
-
|
|
12
|
-
const emit = defineEmits<{
|
|
13
|
-
(e: 'column:save', column: Partial<Column>): void
|
|
14
|
-
(e: 'column:remove'): void
|
|
15
|
-
}>()
|
|
16
|
-
|
|
17
|
-
const column = ref<Partial<Column>>({})
|
|
18
|
-
|
|
19
|
-
const columnStore = useColumnStore()
|
|
20
|
-
const { isUpdating, isCreating } = storeToRefs(columnStore)
|
|
21
|
-
|
|
22
|
-
const inEditMode = computed(() => !!column.value.id)
|
|
23
|
-
|
|
24
|
-
const isValid = computed(() => {
|
|
25
|
-
return (
|
|
26
|
-
column.value.name &&
|
|
27
|
-
column.value.type &&
|
|
28
|
-
(column.value.type !== 'dropdown' || column.value.options_value?.length)
|
|
29
|
-
)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
function addOptionValue(value: string) {
|
|
33
|
-
if (!value.length || column.value.options_value?.includes(value)) {
|
|
34
|
-
return
|
|
35
|
-
}
|
|
36
|
-
if (!column.value.options_value) {
|
|
37
|
-
column.value.options_value = []
|
|
38
|
-
}
|
|
39
|
-
if (value && !column.value.options_value.includes(value)) {
|
|
40
|
-
column.value.options_value.push(value)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
watch(
|
|
45
|
-
() => props.column,
|
|
46
|
-
(c) => (column.value = c ? { ...c } : {}),
|
|
47
|
-
{ immediate: true, deep: true },
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
watch(
|
|
51
|
-
() => column.value,
|
|
52
|
-
(c) => {
|
|
53
|
-
if (c?.is_unique) {
|
|
54
|
-
column.value.default_value = null
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
{ deep: true }
|
|
58
|
-
)
|
|
59
|
-
</script>
|
|
60
|
-
|
|
61
|
-
<template>
|
|
62
|
-
<tr>
|
|
63
|
-
<td class="pr-2 pl-0">
|
|
64
|
-
<v-text-field
|
|
65
|
-
v-model="column.name"
|
|
66
|
-
variant="outlined"
|
|
67
|
-
color="primary"
|
|
68
|
-
hide-details
|
|
69
|
-
density="compact"
|
|
70
|
-
class="w-full"
|
|
71
|
-
/>
|
|
72
|
-
</td>
|
|
73
|
-
|
|
74
|
-
<td class="pr-2 pl-0">
|
|
75
|
-
<v-select
|
|
76
|
-
v-model="column.type"
|
|
77
|
-
:items="getColumnTypesOptions()"
|
|
78
|
-
variant="outlined"
|
|
79
|
-
color="primary"
|
|
80
|
-
hide-details
|
|
81
|
-
density="compact"
|
|
82
|
-
:disabled="inEditMode"
|
|
83
|
-
item-value="value"
|
|
84
|
-
item-title="label"
|
|
85
|
-
/>
|
|
86
|
-
</td>
|
|
87
|
-
|
|
88
|
-
<td class="pr-2 pl-0">
|
|
89
|
-
<v-menu v-if="column.type === 'dropdown'" :close-on-content-click="false">
|
|
90
|
-
<template #activator="{ props: activatorProps }">
|
|
91
|
-
<v-text-field
|
|
92
|
-
v-bind="activatorProps"
|
|
93
|
-
:model-value="`${column.options_value?.length ?? 0} added`"
|
|
94
|
-
density="compact"
|
|
95
|
-
color="primary"
|
|
96
|
-
variant="outlined"
|
|
97
|
-
readonly
|
|
98
|
-
hide-details
|
|
99
|
-
:disabled="inEditMode"
|
|
100
|
-
append-inner-icon="mdi-chevron-down"
|
|
101
|
-
/>
|
|
102
|
-
</template>
|
|
103
|
-
<v-card class="d-flex flex-column" width="400">
|
|
104
|
-
<v-card-item>
|
|
105
|
-
<v-text-field
|
|
106
|
-
variant="outlined"
|
|
107
|
-
color="primary"
|
|
108
|
-
density="compact"
|
|
109
|
-
class="w-full"
|
|
110
|
-
hint="Press Enter to add value"
|
|
111
|
-
persistent-hint
|
|
112
|
-
@keydown.enter="addOptionValue($event.target.value)"
|
|
113
|
-
/>
|
|
114
|
-
</v-card-item>
|
|
115
|
-
<v-divider />
|
|
116
|
-
<v-card-item class="d-flex flex-row flex-wrap">
|
|
117
|
-
<v-chip
|
|
118
|
-
v-for="(item, optionIndex) in (column.options_value ?? [])"
|
|
119
|
-
:key="optionIndex"
|
|
120
|
-
class="ma-1"
|
|
121
|
-
small
|
|
122
|
-
closable
|
|
123
|
-
@click:close="() => column.options_value?.splice(optionIndex, 1)"
|
|
124
|
-
>
|
|
125
|
-
{{ item }}
|
|
126
|
-
</v-chip>
|
|
127
|
-
</v-card-item>
|
|
128
|
-
</v-card>
|
|
129
|
-
</v-menu>
|
|
130
|
-
</td>
|
|
131
|
-
|
|
132
|
-
<td class="pr-2 pl-0">
|
|
133
|
-
<v-select
|
|
134
|
-
v-if="column.type === 'dropdown'"
|
|
135
|
-
v-model="(column.default_value as string)"
|
|
136
|
-
:items="column.options_value ?? []"
|
|
137
|
-
variant="outlined"
|
|
138
|
-
color="primary"
|
|
139
|
-
hide-details
|
|
140
|
-
density="compact"
|
|
141
|
-
:disabled="Boolean(column.is_unique)"
|
|
142
|
-
/>
|
|
143
|
-
<v-switch
|
|
144
|
-
v-else-if="column.type === 'boolean'"
|
|
145
|
-
v-model="column.default_value"
|
|
146
|
-
color="primary"
|
|
147
|
-
hide-details
|
|
148
|
-
density="compact"
|
|
149
|
-
variant="outlined"
|
|
150
|
-
type="switch"
|
|
151
|
-
base-color="grey-lighten-2"
|
|
152
|
-
true-value="1"
|
|
153
|
-
false-value="0"
|
|
154
|
-
:disabled="Boolean(column.is_unique)"
|
|
155
|
-
/>
|
|
156
|
-
<v-text-field
|
|
157
|
-
v-else
|
|
158
|
-
v-model="column.default_value"
|
|
159
|
-
variant="outlined"
|
|
160
|
-
color="primary"
|
|
161
|
-
hide-details
|
|
162
|
-
density="compact"
|
|
163
|
-
class="w-full"
|
|
164
|
-
:disabled="
|
|
165
|
-
Boolean(column.is_unique) || ['document', 'uuid', 'date'].includes(column.type ?? '')
|
|
166
|
-
"
|
|
167
|
-
/>
|
|
168
|
-
</td>
|
|
169
|
-
|
|
170
|
-
<td class="text-center">
|
|
171
|
-
<v-checkbox
|
|
172
|
-
v-model="column.is_unique"
|
|
173
|
-
color="primary"
|
|
174
|
-
hide-details
|
|
175
|
-
density="compact"
|
|
176
|
-
variant="outlined"
|
|
177
|
-
type="switch"
|
|
178
|
-
:disabled="inEditMode || ['document', 'date', 'boolean'].includes(column.type ?? '')"
|
|
179
|
-
/>
|
|
180
|
-
</td>
|
|
181
|
-
|
|
182
|
-
<td class="text-center">
|
|
183
|
-
<v-checkbox
|
|
184
|
-
v-model="column.required"
|
|
185
|
-
color="primary"
|
|
186
|
-
hide-details
|
|
187
|
-
density="compact"
|
|
188
|
-
variant="outlined"
|
|
189
|
-
type="switch"
|
|
190
|
-
/>
|
|
191
|
-
</td>
|
|
192
|
-
|
|
193
|
-
<td class="text-center">
|
|
194
|
-
<div class="d-flex gap-4">
|
|
195
|
-
<v-btn
|
|
196
|
-
v-tooltip="'Save'"
|
|
197
|
-
size="small"
|
|
198
|
-
density="compact"
|
|
199
|
-
variant="text"
|
|
200
|
-
icon
|
|
201
|
-
color="primary"
|
|
202
|
-
:disabled="!isValid || isUpdating || isCreating"
|
|
203
|
-
@click="() => emit('column:save', column)"
|
|
204
|
-
>
|
|
205
|
-
<v-icon>
|
|
206
|
-
{{ inEditMode ? 'mdi-content-save-edit-outline' : 'mdi-content-save-plus-outline' }}
|
|
207
|
-
</v-icon>
|
|
208
|
-
</v-btn>
|
|
209
|
-
<v-btn
|
|
210
|
-
size="small"
|
|
211
|
-
density="compact"
|
|
212
|
-
variant="text"
|
|
213
|
-
icon
|
|
214
|
-
color="red-lighten-1"
|
|
215
|
-
:disabled="isUpdating || isCreating"
|
|
216
|
-
@click="() => emit('column:remove')"
|
|
217
|
-
>
|
|
218
|
-
<v-icon>mdi-delete</v-icon>
|
|
219
|
-
</v-btn>
|
|
220
|
-
</div>
|
|
221
|
-
</td>
|
|
222
|
-
</tr>
|
|
223
|
-
</template>
|
|
224
|
-
|
|
225
|
-
<style scoped></style>
|