@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.
Files changed (55) hide show
  1. package/dist/index.js +1660 -1658
  2. package/dist/types/components/TasksFlow/useTaskFlow.d.ts +0 -1
  3. package/lib/DocumentManager/DocumentManager.vue +10 -5
  4. package/lib/TableViewer/TableViewer.vue +51 -177
  5. package/lib/TableViewer/composables/columns.ts +51 -0
  6. package/lib/TableViewer/composables/records.ts +18 -1
  7. package/lib/TableViewer/composables/relations.ts +8 -0
  8. package/lib/TableViewer/core/Columns/ColumnForm.vue +403 -190
  9. package/lib/TableViewer/core/Columns/ColumnItem.vue +225 -0
  10. package/lib/TableViewer/core/Columns/ColumnsList.vue +142 -0
  11. package/lib/TableViewer/core/Columns/ForeignKeyColumnItem.vue +165 -0
  12. package/lib/TableViewer/core/Columns/ForeignKeyColumnsList.vue +55 -0
  13. package/lib/TableViewer/core/Dialog/DeleteConfirmationDialog.vue +63 -0
  14. package/lib/TableViewer/core/Filters/ConditionItem.vue +133 -0
  15. package/lib/TableViewer/core/Filters/ConditionsList.vue +53 -0
  16. package/lib/TableViewer/core/Filters/FiltersEditor.vue +48 -0
  17. package/lib/TableViewer/core/Filters/QueriesList.vue +63 -0
  18. package/lib/TableViewer/core/{Queries → Filters}/QueryItem.vue +3 -3
  19. package/lib/TableViewer/core/Records/RecordCell.vue +32 -42
  20. package/lib/TableViewer/core/Records/RecordForm.vue +146 -0
  21. package/lib/TableViewer/core/Records/RecordHeader.vue +60 -153
  22. package/lib/TableViewer/core/Records/RecordInput.vue +65 -14
  23. package/lib/TableViewer/core/Records/RecordValue.vue +67 -20
  24. package/lib/TableViewer/core/Records/RecordsTable.vue +97 -56
  25. package/lib/TableViewer/core/Records/RecordsTableToolbar.vue +42 -142
  26. package/lib/TableViewer/core/Revisions/RevisionHistory.vue +25 -7
  27. package/lib/TableViewer/core/Tables/TableEditor.vue +136 -0
  28. package/lib/TableViewer/core/Tables/TableItem.vue +162 -0
  29. package/lib/TableViewer/core/Tables/TableViewer.vue +28 -0
  30. package/lib/TableViewer/core/Tables/TablesList.vue +116 -0
  31. package/lib/TableViewer/stores/columnRelation.ts +106 -0
  32. package/lib/TableViewer/stores/columns.ts +56 -37
  33. package/lib/TableViewer/stores/conditions.ts +44 -46
  34. package/lib/TableViewer/stores/records.ts +73 -4
  35. package/lib/TableViewer/stores/table.ts +48 -52
  36. package/lib/TableViewer/stores/tables.ts +1 -1
  37. package/lib/TableViewer/types/column.d.ts +2 -2
  38. package/lib/TableViewer/types/relations.d.ts +7 -0
  39. package/package.json +2 -2
  40. package/lib/DocumentManager/hooks/useDarkMode.ts +0 -17
  41. package/lib/TableViewer/TableView.vue +0 -39
  42. package/lib/TableViewer/core/Columns/ColumnsConfiguration.vue +0 -99
  43. package/lib/TableViewer/core/Columns/ColumnsConfigurationTable.vue +0 -186
  44. package/lib/TableViewer/core/Columns/ColumnsTable.vue +0 -165
  45. package/lib/TableViewer/core/Permissions/PermissionDialog.vue +0 -149
  46. package/lib/TableViewer/core/Permissions/PermissionForm.vue +0 -117
  47. package/lib/TableViewer/core/Permissions/PermissionsConfiguration.vue +0 -55
  48. package/lib/TableViewer/core/Permissions/PermissionsConfigurationTable.vue +0 -185
  49. package/lib/TableViewer/core/Permissions/PermissionsTable.vue +0 -207
  50. package/lib/TableViewer/core/Queries/QueriesMenu.vue +0 -75
  51. package/lib/TableViewer/core/Records/RecordDialog.vue +0 -128
  52. package/lib/TableViewer/core/Relations/RelationForm.vue +0 -154
  53. package/lib/TableViewer/core/Relations/RelationsConfiguration.vue +0 -32
  54. package/lib/TableViewer/core/Relations/RelationsConfigurationTable.vue +0 -146
  55. package/lib/TableViewer/core/Relations/RelationsTable.vue +0 -129
@@ -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>