@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,11 +1,11 @@
|
|
|
1
1
|
import type { Column } from '../types/column'
|
|
2
2
|
import { defineStore } from 'pinia'
|
|
3
|
-
import { ref } from 'vue'
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
4
4
|
import { useRecordStore } from './records'
|
|
5
5
|
|
|
6
6
|
export interface Condition {
|
|
7
7
|
id: string
|
|
8
|
-
column
|
|
8
|
+
column?: string
|
|
9
9
|
applied?: boolean
|
|
10
10
|
operator?: string
|
|
11
11
|
boolean?: string
|
|
@@ -17,58 +17,55 @@ export const useConditionStore = defineStore('ant.apps.table.viewer.conditions',
|
|
|
17
17
|
|
|
18
18
|
const recordStore = useRecordStore()
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const appliedAndValidConditions = computed(() => {
|
|
21
|
+
return conditions.value.filter((condition) => {
|
|
22
|
+
return !!condition.column && !!condition.applied && !!condition.value && !!condition.operator
|
|
23
|
+
})
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
function addCondition() {
|
|
27
|
+
conditions.value.push({
|
|
28
|
+
id: Math.random().toString(36)
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function updateCondition(id: string, condition: Partial<Condition>) {
|
|
33
|
+
const index = conditions.value.findIndex((c) => c.id === id)
|
|
34
|
+
if (index !== -1) {
|
|
35
|
+
conditions.value[index] = { ...conditions.value[index], ...condition }
|
|
24
36
|
}
|
|
25
|
-
conditions.value.push(newColumn)
|
|
26
|
-
return newColumn
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
function removeCondition(id: string) {
|
|
30
|
-
conditions.value = conditions.value.filter(c => c.id !== id)
|
|
40
|
+
conditions.value = conditions.value.filter((c) => c.id !== id)
|
|
31
41
|
}
|
|
32
42
|
|
|
33
|
-
function
|
|
34
|
-
conditions.value.forEach((c) =>
|
|
35
|
-
if (c.column === column.id) {
|
|
36
|
-
c.applied = true
|
|
37
|
-
}
|
|
38
|
-
})
|
|
43
|
+
function applyConditions() {
|
|
44
|
+
conditions.value.forEach((c) => (c.applied = true))
|
|
39
45
|
recordStore.fetchRecords()
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function getColumnConditions(column: Column) {
|
|
49
|
-
const columnConditions = conditions.value.filter(
|
|
50
|
-
(condition: Condition) => condition.column === column.id,
|
|
51
|
-
)
|
|
52
|
-
if (columnConditions.length === 0) {
|
|
53
|
-
columnConditions.push(addCondition(column))
|
|
54
|
-
}
|
|
55
|
-
return columnConditions
|
|
48
|
+
function clearConditions() {
|
|
49
|
+
reset()
|
|
50
|
+
recordStore.fetchRecords()
|
|
56
51
|
}
|
|
57
52
|
|
|
58
53
|
function getApplicableConditions(column: Column) {
|
|
59
|
-
return conditions.value
|
|
60
|
-
(
|
|
61
|
-
condition
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
54
|
+
return conditions.value
|
|
55
|
+
.filter(
|
|
56
|
+
(condition: Condition) =>
|
|
57
|
+
condition.column === column.id &&
|
|
58
|
+
!!condition.applied &&
|
|
59
|
+
!!condition.value &&
|
|
60
|
+
!!condition.operator
|
|
61
|
+
)
|
|
62
|
+
.map((condition) => {
|
|
63
|
+
return {
|
|
64
|
+
operator: condition.operator,
|
|
65
|
+
value: condition.value,
|
|
66
|
+
column: column.id
|
|
67
|
+
}
|
|
68
|
+
})
|
|
72
69
|
}
|
|
73
70
|
|
|
74
71
|
function reset() {
|
|
@@ -80,9 +77,10 @@ export const useConditionStore = defineStore('ant.apps.table.viewer.conditions',
|
|
|
80
77
|
reset,
|
|
81
78
|
addCondition,
|
|
82
79
|
removeCondition,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
updateCondition,
|
|
81
|
+
appliedAndValidConditions,
|
|
82
|
+
clearConditions,
|
|
83
|
+
applyConditions,
|
|
84
|
+
getApplicableConditions
|
|
87
85
|
}
|
|
88
86
|
})
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type { RecordRequest } from '@antcde/connect-ts
|
|
1
|
+
import type { RecordRequest, RecordsFile } from '@antcde/connect-ts'
|
|
2
|
+
|
|
2
3
|
import type { Stats, TableRecord } from '@antcde/connect-ts/services/TableService'
|
|
3
4
|
import { defineStore } from 'pinia'
|
|
4
5
|
import { computed, ref } from 'vue'
|
|
5
6
|
import { useClientStore } from './client'
|
|
6
7
|
import { useColumnStore } from './columns'
|
|
7
8
|
import { useTableStore } from './table'
|
|
9
|
+
import { convertFileToBase64 } from '../composables/records'
|
|
8
10
|
|
|
9
11
|
interface Pagination {
|
|
10
12
|
page?: number
|
|
@@ -15,6 +17,7 @@ export const useRecordStore = defineStore('ant.apps.table.viewer.records', () =>
|
|
|
15
17
|
const currentPage = ref(1)
|
|
16
18
|
const recordsPerPage = ref(10)
|
|
17
19
|
const records = ref<TableRecord[]>([])
|
|
20
|
+
const selectedRecords = ref<string[]>([])
|
|
18
21
|
const metadata = ref<Stats>({
|
|
19
22
|
count: 0,
|
|
20
23
|
offset: 0,
|
|
@@ -22,6 +25,7 @@ export const useRecordStore = defineStore('ant.apps.table.viewer.records', () =>
|
|
|
22
25
|
})
|
|
23
26
|
|
|
24
27
|
const isFetching = ref(false)
|
|
28
|
+
const isImporting = ref(false)
|
|
25
29
|
const isUpdating = ref(false)
|
|
26
30
|
const isCreating = ref(false)
|
|
27
31
|
const isDeleting = ref(false)
|
|
@@ -39,12 +43,12 @@ export const useRecordStore = defineStore('ant.apps.table.viewer.records', () =>
|
|
|
39
43
|
const queryPayload = computed(() => {
|
|
40
44
|
return {
|
|
41
45
|
offset: (currentPage.value - 1) * recordsPerPage.value,
|
|
42
|
-
limit:
|
|
46
|
+
limit: recordsPerPage.value,
|
|
43
47
|
tables: [
|
|
44
48
|
{
|
|
45
49
|
id: tableStore.table?.id,
|
|
46
50
|
as: tableStore.table?.id,
|
|
47
|
-
columns: columnStore.
|
|
51
|
+
columns: columnStore.columnsConfiguration,
|
|
48
52
|
},
|
|
49
53
|
],
|
|
50
54
|
}
|
|
@@ -68,6 +72,38 @@ export const useRecordStore = defineStore('ant.apps.table.viewer.records', () =>
|
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
|
|
75
|
+
async function exportTableRecords() {
|
|
76
|
+
try {
|
|
77
|
+
if (!tableStore.table?.id || !connect) {
|
|
78
|
+
return
|
|
79
|
+
}
|
|
80
|
+
await connect.tables.queryTablesExport(queryPayload.value)
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
isFetching.value = false
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function importRecords(file: File) {
|
|
88
|
+
try {
|
|
89
|
+
if (!tableStore.table?.id || !connect) {
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
// Convert file to Base64 and strip prefix
|
|
93
|
+
const base64String = await convertFileToBase64(file)
|
|
94
|
+
|
|
95
|
+
const body = {
|
|
96
|
+
records: base64String, // Base64 encoded CSV content (no prefix)
|
|
97
|
+
}
|
|
98
|
+
isImporting.value = true
|
|
99
|
+
await connect.records.importRecords(tableStore.table.id, body as RecordsFile)
|
|
100
|
+
await fetchRecords()
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
isImporting.value = false
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
71
107
|
async function updateRecord(recordId: string, data: Record<string, any>) {
|
|
72
108
|
try {
|
|
73
109
|
if (!tableStore.table?.id || !connect) {
|
|
@@ -121,6 +157,34 @@ export const useRecordStore = defineStore('ant.apps.table.viewer.records', () =>
|
|
|
121
157
|
}
|
|
122
158
|
}
|
|
123
159
|
|
|
160
|
+
async function deleteSelectedRecords() {
|
|
161
|
+
try {
|
|
162
|
+
if (!tableStore.table?.id || !connect) {
|
|
163
|
+
return
|
|
164
|
+
}
|
|
165
|
+
isDeleting.value = true
|
|
166
|
+
await deleteRecords(selectedRecords.value)
|
|
167
|
+
selectedRecords.value = []
|
|
168
|
+
}
|
|
169
|
+
finally {
|
|
170
|
+
isDeleting.value = false
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function deleteAllRecords() {
|
|
175
|
+
try {
|
|
176
|
+
if (!tableStore.table?.id || !connect) {
|
|
177
|
+
return
|
|
178
|
+
}
|
|
179
|
+
isDeleting.value = true
|
|
180
|
+
await deleteRecords(records.value.map((record: { id: string }) => record.id))
|
|
181
|
+
records.value = []
|
|
182
|
+
}
|
|
183
|
+
finally {
|
|
184
|
+
isDeleting.value = false
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
124
188
|
async function fetchRecordHistory(record: TableRecord) {
|
|
125
189
|
if (!tableStore.table?.id || !connect) {
|
|
126
190
|
return
|
|
@@ -229,6 +293,7 @@ export const useRecordStore = defineStore('ant.apps.table.viewer.records', () =>
|
|
|
229
293
|
return {
|
|
230
294
|
metadata,
|
|
231
295
|
records,
|
|
296
|
+
isImporting,
|
|
232
297
|
isFetching,
|
|
233
298
|
isCreating,
|
|
234
299
|
isUpdating,
|
|
@@ -239,13 +304,17 @@ export const useRecordStore = defineStore('ant.apps.table.viewer.records', () =>
|
|
|
239
304
|
selectedColumnIndex,
|
|
240
305
|
editModeIsActive,
|
|
241
306
|
queryPayload,
|
|
307
|
+
selectedRecords,
|
|
242
308
|
reset,
|
|
243
309
|
fetchRecords,
|
|
244
310
|
updateRecord,
|
|
245
311
|
createRecord,
|
|
246
312
|
deleteRecords,
|
|
313
|
+
deleteAllRecords,
|
|
314
|
+
deleteSelectedRecords,
|
|
315
|
+
importRecords,
|
|
316
|
+
exportTableRecords,
|
|
247
317
|
fetchRecordHistory,
|
|
248
|
-
|
|
249
318
|
selectCell,
|
|
250
319
|
selectNextCell,
|
|
251
320
|
isCellSelected,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type { Table } from '@antcde/connect-ts/services/TableService'
|
|
2
|
-
import type { TableCbAction } from '@lib/TableViewer/types/tables'
|
|
3
2
|
import { defineStore } from 'pinia'
|
|
4
|
-
import { ref } from 'vue'
|
|
3
|
+
import { computed, ref } from 'vue'
|
|
5
4
|
import { useClientStore } from './client'
|
|
6
5
|
import { useColumnStore } from './columns'
|
|
7
6
|
import { useConditionStore } from './conditions'
|
|
8
|
-
import { usePermissionStore } from './permissions'
|
|
9
7
|
import { useQueryStore } from './queries'
|
|
10
8
|
import { useRecordStore } from './records'
|
|
11
|
-
import { useRelationStore } from './relations'
|
|
12
9
|
import { useRevisionStore } from './revisions'
|
|
10
|
+
import { useTablesStore } from './tables'
|
|
13
11
|
|
|
14
12
|
export const useTableStore = defineStore('ant.apps.table.viewer.table', () => {
|
|
15
13
|
const table = ref<Table | null>(null)
|
|
@@ -17,7 +15,8 @@ export const useTableStore = defineStore('ant.apps.table.viewer.table', () => {
|
|
|
17
15
|
const isCreating = ref(false)
|
|
18
16
|
const isUpdating = ref(false)
|
|
19
17
|
const isDeleting = ref(false)
|
|
20
|
-
|
|
18
|
+
|
|
19
|
+
const tablesStore = useTablesStore()
|
|
21
20
|
|
|
22
21
|
const clientStore = useClientStore()
|
|
23
22
|
const { client } = clientStore
|
|
@@ -26,66 +25,66 @@ export const useTableStore = defineStore('ant.apps.table.viewer.table', () => {
|
|
|
26
25
|
const recordStore = useRecordStore()
|
|
27
26
|
const columnStore = useColumnStore()
|
|
28
27
|
const revisionStore = useRevisionStore()
|
|
29
|
-
const relationStore = useRelationStore()
|
|
30
28
|
const conditionStore = useConditionStore()
|
|
31
|
-
const permissionStore = usePermissionStore()
|
|
32
29
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const permissions = computed(() => {
|
|
31
|
+
return {
|
|
32
|
+
canRead: table.value?.permissions?.read ?? false,
|
|
33
|
+
canCreate: table.value?.permissions?.create ?? false,
|
|
34
|
+
canUpdate: table.value?.permissions?.update ?? false,
|
|
35
|
+
canDelete: table.value?.permissions?.delete ?? false,
|
|
36
|
+
canConfigure: table.value?.permissions?.configure ?? false
|
|
37
|
+
}
|
|
38
|
+
})
|
|
36
39
|
|
|
37
40
|
async function fetchTable(tableId: string) {
|
|
38
|
-
if (!
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
finally {
|
|
53
|
-
isFetching.value = false
|
|
41
|
+
if (!connect) return
|
|
42
|
+
resetTable()
|
|
43
|
+
table.value = {
|
|
44
|
+
id: tableId,
|
|
45
|
+
name: '',
|
|
46
|
+
permissions: {
|
|
47
|
+
read: false,
|
|
48
|
+
create: false,
|
|
49
|
+
update: false,
|
|
50
|
+
delete: false,
|
|
51
|
+
configure: false
|
|
52
|
+
},
|
|
53
|
+
project: '',
|
|
54
54
|
}
|
|
55
|
+
isFetching.value = true
|
|
56
|
+
table.value = await connect.tables.getTable(tableId)
|
|
57
|
+
await columnStore.fetchColumns()
|
|
58
|
+
await recordStore.fetchRecords()
|
|
59
|
+
isFetching.value = false
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
async function updateTable(name: string) {
|
|
58
|
-
if (!name || !connect)
|
|
59
|
-
return
|
|
63
|
+
if (!name || !connect) return
|
|
60
64
|
try {
|
|
61
|
-
isUpdating.value = true
|
|
62
65
|
if (table.value) {
|
|
66
|
+
isUpdating.value = true
|
|
63
67
|
const { id } = table.value
|
|
64
|
-
|
|
65
68
|
const updatedTable = await connect.tables.updateTable(id, { name })
|
|
66
69
|
table.value = { ...table.value, ...updatedTable }
|
|
67
|
-
|
|
70
|
+
tablesStore.tables = tablesStore.tables.map((t) => (t.id === id ? updatedTable : t))
|
|
68
71
|
}
|
|
69
|
-
}
|
|
70
|
-
finally {
|
|
72
|
+
} finally {
|
|
71
73
|
isUpdating.value = false
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
async function deleteTable() {
|
|
76
|
-
if (!connect)
|
|
77
|
-
return
|
|
78
|
+
if (!connect) return
|
|
78
79
|
try {
|
|
79
80
|
isDeleting.value = true
|
|
80
81
|
if (table.value) {
|
|
81
82
|
const tableId = table.value.id
|
|
82
|
-
|
|
83
83
|
await connect.tables.deleteTable(tableId)
|
|
84
|
-
|
|
84
|
+
tablesStore.tables = tablesStore.tables.filter((t) => t.id !== tableId)
|
|
85
85
|
resetTable()
|
|
86
86
|
}
|
|
87
|
-
}
|
|
88
|
-
finally {
|
|
87
|
+
} finally {
|
|
89
88
|
isDeleting.value = false
|
|
90
89
|
}
|
|
91
90
|
}
|
|
@@ -93,28 +92,26 @@ export const useTableStore = defineStore('ant.apps.table.viewer.table', () => {
|
|
|
93
92
|
async function createTable(name: string) {
|
|
94
93
|
const context = client?.context
|
|
95
94
|
const projectId = context?.project?.id
|
|
96
|
-
if (!name || !connect || !projectId)
|
|
97
|
-
return
|
|
95
|
+
if (!name || !connect || !projectId) return
|
|
98
96
|
try {
|
|
99
97
|
isCreating.value = true
|
|
100
|
-
await connect.tables.createTable({ project: projectId, name })
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
finally {
|
|
98
|
+
const createdTable = await connect.tables.createTable({ project: projectId, name })
|
|
99
|
+
fetchTable(createdTable.id)
|
|
100
|
+
} finally {
|
|
104
101
|
isCreating.value = false
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
104
|
|
|
108
105
|
function resetTable() {
|
|
106
|
+
recordStore.reset()
|
|
107
|
+
columnStore.reset()
|
|
108
|
+
conditionStore.reset()
|
|
109
|
+
revisionStore.reset()
|
|
109
110
|
table.value = null
|
|
110
111
|
isFetching.value = false
|
|
111
112
|
isCreating.value = false
|
|
112
113
|
isUpdating.value = false
|
|
113
114
|
isDeleting.value = false
|
|
114
|
-
columnStore.reset()
|
|
115
|
-
conditionStore.reset()
|
|
116
|
-
recordStore.reset()
|
|
117
|
-
revisionStore.reset()
|
|
118
115
|
}
|
|
119
116
|
|
|
120
117
|
return {
|
|
@@ -123,12 +120,11 @@ export const useTableStore = defineStore('ant.apps.table.viewer.table', () => {
|
|
|
123
120
|
isCreating,
|
|
124
121
|
isDeleting,
|
|
125
122
|
isUpdating,
|
|
126
|
-
|
|
127
|
-
setTableChangeCb,
|
|
123
|
+
permissions,
|
|
128
124
|
fetchTable,
|
|
129
125
|
resetTable,
|
|
130
126
|
createTable,
|
|
131
127
|
updateTable,
|
|
132
|
-
deleteTable
|
|
128
|
+
deleteTable
|
|
133
129
|
}
|
|
134
130
|
})
|
|
@@ -21,7 +21,7 @@ export const useTablesStore = defineStore('ant.apps.table.viewer.tables', () =>
|
|
|
21
21
|
return
|
|
22
22
|
try {
|
|
23
23
|
isFetchingTables.value = true
|
|
24
|
-
tables.value = await connect.tables.getTables(projectId)
|
|
24
|
+
tables.value = (await connect.tables.getTables(projectId)).sort((a, b) => a.name.localeCompare(b.name))
|
|
25
25
|
}
|
|
26
26
|
finally {
|
|
27
27
|
isFetchingTables.value = false
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antcde/component-library",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.1",
|
|
5
5
|
"description": "Helper to use ant components in Vue 3",
|
|
6
6
|
"author": "CollaborAll",
|
|
7
7
|
"repository": {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"vue-i18n": "^10.0.1",
|
|
68
68
|
"vue-router": "^4.4.4",
|
|
69
69
|
"vuetify": "^3.7.4",
|
|
70
|
-
"@antcde/connect-ts": "0.1.
|
|
70
|
+
"@antcde/connect-ts": "0.1.6",
|
|
71
71
|
"@antcde/vue-utils": "0.1.0"
|
|
72
72
|
},
|
|
73
73
|
"bundleDependencies": [
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { UseCommsClient } from '@antcde/vue-utils'
|
|
2
|
-
import { useAntColorMode } from '@antcde/vue-utils'
|
|
3
|
-
import { watch } from 'vue'
|
|
4
|
-
import { useTheme } from 'vuetify'
|
|
5
|
-
|
|
6
|
-
export function useDarkMode(client: UseCommsClient) {
|
|
7
|
-
const theme = useTheme()
|
|
8
|
-
const colorMode = useAntColorMode(client)
|
|
9
|
-
|
|
10
|
-
watch(
|
|
11
|
-
() => colorMode.isDark,
|
|
12
|
-
isDark => theme.global.name.value = isDark ? 'dark' : 'light',
|
|
13
|
-
{ immediate: true },
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
return colorMode
|
|
17
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { ApplicationProps } from './types/app'
|
|
3
|
-
import { storeToRefs } from 'pinia'
|
|
4
|
-
import { watch } from 'vue'
|
|
5
|
-
import RecordsTable from './core/Records/RecordsTable.vue'
|
|
6
|
-
import RevisionComparisonTable from './core/Revisions/RevisionComparisonTable.vue'
|
|
7
|
-
import { useClientStore } from './stores/client'
|
|
8
|
-
import { useRevisionStore } from './stores/revisions'
|
|
9
|
-
import { useTableStore } from './stores/table'
|
|
10
|
-
|
|
11
|
-
const { client, tableId } = defineProps<ApplicationProps & { tableId: string }>()
|
|
12
|
-
|
|
13
|
-
const clientStore = useClientStore()
|
|
14
|
-
clientStore.setClient(client)
|
|
15
|
-
|
|
16
|
-
const tableStore = useTableStore()
|
|
17
|
-
|
|
18
|
-
const revisionStore = useRevisionStore()
|
|
19
|
-
const { inComparisonMode } = storeToRefs(revisionStore)
|
|
20
|
-
|
|
21
|
-
watch(
|
|
22
|
-
() => tableId,
|
|
23
|
-
async (id, prevId) => {
|
|
24
|
-
if (id && id !== prevId) {
|
|
25
|
-
await tableStore.fetchTable(tableId)
|
|
26
|
-
inComparisonMode.value = false
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{ immediate: true },
|
|
30
|
-
)
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<template>
|
|
34
|
-
<v-skeleton-loader v-if="tableStore.isFetching" type="table" />
|
|
35
|
-
<template v-else>
|
|
36
|
-
<RevisionComparisonTable v-if="inComparisonMode" />
|
|
37
|
-
<RecordsTable v-else />
|
|
38
|
-
</template>
|
|
39
|
-
</template>
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { Column } from '@antcde/connect-ts/services/ColumnService'
|
|
3
|
-
import { storeToRefs } from 'pinia'
|
|
4
|
-
import { ref, watch } from 'vue'
|
|
5
|
-
import { useColumnStore } from '../../stores/columns'
|
|
6
|
-
import ColumnForm from './ColumnForm.vue'
|
|
7
|
-
import ColumnsTable from './ColumnsTable.vue'
|
|
8
|
-
import { useI18n } from 'vue-i18n'
|
|
9
|
-
|
|
10
|
-
const { t } = useI18n()
|
|
11
|
-
|
|
12
|
-
const props = defineProps<{
|
|
13
|
-
displayed: boolean
|
|
14
|
-
}>()
|
|
15
|
-
|
|
16
|
-
const emit = defineEmits(['close'])
|
|
17
|
-
|
|
18
|
-
const columnStore = useColumnStore()
|
|
19
|
-
const { columns, isFetching, isDeleting } = storeToRefs(columnStore)
|
|
20
|
-
|
|
21
|
-
const isColumnDeleteShown = ref(false)
|
|
22
|
-
const isColumnFormShown = ref(false)
|
|
23
|
-
const selectedColumn = ref<Column | null>(null)
|
|
24
|
-
|
|
25
|
-
function setupColumnDelete(column: Column) {
|
|
26
|
-
selectedColumn.value = column
|
|
27
|
-
isColumnDeleteShown.value = true
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function closeColumnDeleteDialog() {
|
|
31
|
-
selectedColumn.value = null
|
|
32
|
-
isColumnDeleteShown.value = false
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
async function deleteColumn() {
|
|
36
|
-
if (selectedColumn.value) {
|
|
37
|
-
await columnStore.deleteColumn(selectedColumn.value)
|
|
38
|
-
closeColumnDeleteDialog()
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function setupColumnUpdate(column: Column) {
|
|
43
|
-
selectedColumn.value = column
|
|
44
|
-
isColumnFormShown.value = true
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function setupColumnCreate() {
|
|
48
|
-
selectedColumn.value = null
|
|
49
|
-
isColumnFormShown.value = true
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function hideColumnForm() {
|
|
53
|
-
isColumnFormShown.value = false
|
|
54
|
-
selectedColumn.value = null
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function reset() {
|
|
58
|
-
selectedColumn.value = null
|
|
59
|
-
isColumnDeleteShown.value = false
|
|
60
|
-
isColumnFormShown.value = false
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
watch(() => props.displayed, reset)
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
<template>
|
|
67
|
-
<v-dialog
|
|
68
|
-
width="1200"
|
|
69
|
-
height="580"
|
|
70
|
-
:model-value="displayed"
|
|
71
|
-
@update:model-value="emit('close')"
|
|
72
|
-
>
|
|
73
|
-
<v-card class="h-full overflow-auto">
|
|
74
|
-
<column-form v-if="isColumnFormShown" :column="selectedColumn" @close="hideColumnForm" />
|
|
75
|
-
|
|
76
|
-
<columns-table
|
|
77
|
-
v-if="!isColumnFormShown"
|
|
78
|
-
:columns="columns"
|
|
79
|
-
:is-fetching="isFetching"
|
|
80
|
-
@open-column-update="setupColumnUpdate"
|
|
81
|
-
@open-column-delete="setupColumnDelete"
|
|
82
|
-
@open-column-create="setupColumnCreate"
|
|
83
|
-
@close="emit('close')"
|
|
84
|
-
/>
|
|
85
|
-
</v-card>
|
|
86
|
-
</v-dialog>
|
|
87
|
-
|
|
88
|
-
<base-delete-dialog
|
|
89
|
-
:delete-action="deleteColumn"
|
|
90
|
-
:displayed="isColumnDeleteShown"
|
|
91
|
-
:is-loading="isDeleting"
|
|
92
|
-
:title="
|
|
93
|
-
t('project.tableConfig.columns.deleteTitle', {
|
|
94
|
-
column: selectedColumn?.name,
|
|
95
|
-
})
|
|
96
|
-
"
|
|
97
|
-
@close="closeColumnDeleteDialog"
|
|
98
|
-
/>
|
|
99
|
-
</template>
|