@antcde/component-library 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/dist/component-library.css +1 -1
- package/dist/index.js +16719 -17759
- package/dist/types/components/BaseAppCard.vue.d.ts +18 -4
- package/dist/types/components/BaseAppCardSkeleton.vue.d.ts +2 -0
- package/dist/types/components/BaseDeleteDialog.vue.d.ts +20 -7
- package/dist/types/components/RBAC/Permissions/PermissionCard.vue.d.ts +1 -1
- package/dist/types/components/TasksFlow/useTaskFlow.d.ts +7 -6
- package/dist/types/index.d.ts +3 -1
- package/lib/DocumentManager/DocumentDrop.vue +2 -6
- package/lib/DocumentManager/DocumentManager.vue +48 -41
- package/lib/DocumentManager/hooks/useDms.ts +1 -3
- package/lib/DocumentManager/index.ts +1 -1
- package/lib/DocumentManager/lang/translations/de.json +36 -0
- package/lib/DocumentManager/lang/translations/en.json +38 -0
- package/lib/DocumentManager/lang/translations/nl.json +36 -0
- package/lib/DocumentManager/utils.ts +1 -1
- package/lib/ForgeViewer/ForgeViewer.vue +6 -5
- package/lib/ForgeViewer/lang/translations/de.json +6 -0
- package/lib/ForgeViewer/lang/translations/en.json +6 -0
- package/lib/ForgeViewer/lang/translations/nl.json +6 -0
- package/lib/ForgeViewer/useForgeViewer.ts +0 -1
- package/lib/GisViewer/GisViewer.vue +14 -8
- package/lib/GisViewer/useGisViewer.ts +3 -3
- package/package.json +4 -3
- package/lib/DocumentManager/hooks/useDarkMode.ts +0 -17
- package/lib/TableViewer/TableView.vue +0 -39
- package/lib/TableViewer/TableViewer.vue +0 -205
- package/lib/TableViewer/composables/records.ts +0 -53
- package/lib/TableViewer/composables/useFile.ts +0 -20
- package/lib/TableViewer/core/Columns/ColumnForm.vue +0 -230
- package/lib/TableViewer/core/Columns/ColumnsConfiguration.vue +0 -99
- package/lib/TableViewer/core/Columns/ColumnsConfigurationTable.vue +0 -186
- package/lib/TableViewer/core/Columns/ColumnsTable.vue +0 -165
- package/lib/TableViewer/core/Permissions/PermissionDialog.vue +0 -149
- package/lib/TableViewer/core/Permissions/PermissionForm.vue +0 -117
- package/lib/TableViewer/core/Permissions/PermissionsConfiguration.vue +0 -55
- package/lib/TableViewer/core/Permissions/PermissionsConfigurationTable.vue +0 -185
- package/lib/TableViewer/core/Permissions/PermissionsTable.vue +0 -207
- package/lib/TableViewer/core/Queries/QueriesMenu.vue +0 -75
- package/lib/TableViewer/core/Queries/QueryItem.vue +0 -112
- package/lib/TableViewer/core/Records/RecordCell.vue +0 -118
- package/lib/TableViewer/core/Records/RecordDialog.vue +0 -128
- package/lib/TableViewer/core/Records/RecordHeader.vue +0 -175
- package/lib/TableViewer/core/Records/RecordInput.vue +0 -183
- package/lib/TableViewer/core/Records/RecordValue.vue +0 -123
- package/lib/TableViewer/core/Records/RecordsTable.vue +0 -233
- package/lib/TableViewer/core/Records/RecordsTableToolbar.vue +0 -310
- package/lib/TableViewer/core/Relations/RelationForm.vue +0 -154
- package/lib/TableViewer/core/Relations/RelationsConfiguration.vue +0 -32
- package/lib/TableViewer/core/Relations/RelationsConfigurationTable.vue +0 -146
- package/lib/TableViewer/core/Relations/RelationsTable.vue +0 -129
- package/lib/TableViewer/core/Revisions/RevisionComparisonCell.vue +0 -50
- package/lib/TableViewer/core/Revisions/RevisionComparisonTable.vue +0 -98
- package/lib/TableViewer/core/Revisions/RevisionHistory.vue +0 -138
- package/lib/TableViewer/core/Revisions/RevisionSelector.vue +0 -140
- package/lib/TableViewer/index.ts +0 -4
- package/lib/TableViewer/services/file-handler.ts +0 -84
- package/lib/TableViewer/stores/client.ts +0 -18
- package/lib/TableViewer/stores/columns.ts +0 -152
- package/lib/TableViewer/stores/conditions.ts +0 -88
- package/lib/TableViewer/stores/permissions.ts +0 -102
- package/lib/TableViewer/stores/queries.ts +0 -80
- package/lib/TableViewer/stores/records.ts +0 -256
- package/lib/TableViewer/stores/relations.ts +0 -89
- package/lib/TableViewer/stores/revisions.ts +0 -194
- package/lib/TableViewer/stores/roles.ts +0 -109
- package/lib/TableViewer/stores/table.ts +0 -134
- package/lib/TableViewer/stores/tables.ts +0 -65
- package/lib/TableViewer/types/app.d.ts +0 -5
- package/lib/TableViewer/types/column.d.ts +0 -28
- package/lib/TableViewer/types/permission.d.ts +0 -12
- package/lib/TableViewer/types/project.d.ts +0 -37
- package/lib/TableViewer/types/tables.d.ts +0 -69
|
@@ -4,15 +4,21 @@ import GisViewerAppBar from './GisViewerAppBar.vue'
|
|
|
4
4
|
import { type ApplicationProps, useGisViewer } from './useGisViewer'
|
|
5
5
|
|
|
6
6
|
const { client, widgets, drawings, toolbar = true } = defineProps<ApplicationProps & { toolbar?: boolean }>()
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const {
|
|
8
|
+
clearSketch,
|
|
9
|
+
drawDrawings,
|
|
10
|
+
getSketch,
|
|
11
|
+
loadSketchGraphics,
|
|
12
|
+
setSketchColor,
|
|
13
|
+
toggleWidget,
|
|
14
|
+
} = useGisViewer({ client, widgets }, 'gisViewer')
|
|
9
15
|
|
|
10
16
|
defineExpose({
|
|
11
|
-
getSketch
|
|
12
|
-
clearSketch
|
|
13
|
-
setSketchColor
|
|
14
|
-
toggleWidget
|
|
15
|
-
loadSketchGraphics
|
|
17
|
+
getSketch,
|
|
18
|
+
clearSketch,
|
|
19
|
+
setSketchColor,
|
|
20
|
+
toggleWidget,
|
|
21
|
+
loadSketchGraphics,
|
|
16
22
|
})
|
|
17
23
|
|
|
18
24
|
watch(() => drawings, (newDrawings) => {
|
|
@@ -21,7 +27,7 @@ watch(() => drawings, (newDrawings) => {
|
|
|
21
27
|
Object.entries(newDrawings).forEach(([sbscode, drawingsArray]) => {
|
|
22
28
|
if (Array.isArray(drawingsArray)) {
|
|
23
29
|
// Call drawDrawings for each sbscode and its corresponding array of drawings
|
|
24
|
-
|
|
30
|
+
drawDrawings(sbscode, drawingsArray)
|
|
25
31
|
}
|
|
26
32
|
})
|
|
27
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { TableRecords } from '@antcde/connect-ts'
|
|
1
2
|
import type { UseCommsClient } from '@antcde/vue-utils'
|
|
2
|
-
import type { TableRecords } from '@antcde/connect-ts/services/TableService'
|
|
3
3
|
import Graphic from '@arcgis/core/Graphic'
|
|
4
4
|
import GraphicsLayer from '@arcgis/core/layers/GraphicsLayer'
|
|
5
5
|
import Map from '@arcgis/core/Map'
|
|
@@ -46,8 +46,8 @@ export const GIS_VIEWER_WIDGETS = {
|
|
|
46
46
|
|
|
47
47
|
type WidgetType = typeof GIS_VIEWER_WIDGETS[keyof typeof GIS_VIEWER_WIDGETS]
|
|
48
48
|
|
|
49
|
-
export function useGisViewer({ client, widgets = {} }: ApplicationProps) {
|
|
50
|
-
const container = ref
|
|
49
|
+
export function useGisViewer({ client, widgets = {} }: ApplicationProps, containerValue: string) {
|
|
50
|
+
const container = ref(containerValue)
|
|
51
51
|
const gisViewer = shallowRef<GisComposable>({
|
|
52
52
|
map: null,
|
|
53
53
|
view: null,
|
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.2",
|
|
5
5
|
"description": "Helper to use ant components in Vue 3",
|
|
6
6
|
"author": "CollaborAll",
|
|
7
7
|
"repository": {
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"vue-i18n": "^10.0.1",
|
|
68
68
|
"vue-router": "^4.4.4",
|
|
69
69
|
"vuetify": "^3.7.4",
|
|
70
|
-
"@antcde/
|
|
71
|
-
"@antcde/
|
|
70
|
+
"@antcde/vue-utils": "0.2.0",
|
|
71
|
+
"@antcde/connect-ts": "0.4.1"
|
|
72
72
|
},
|
|
73
73
|
"bundleDependencies": [
|
|
74
74
|
"vue",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
],
|
|
77
77
|
"devDependencies": {
|
|
78
78
|
"@arcgis/core": "^4.30.9",
|
|
79
|
+
"@intlify/unplugin-vue-i18n": "^6.0.1",
|
|
79
80
|
"@mdi/font": "^7.2.96",
|
|
80
81
|
"@tsconfig/node20": "^20.1.4",
|
|
81
82
|
"@types/node": "^22.9.3",
|
|
@@ -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,205 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { ApplicationProps } from './types/app'
|
|
3
|
-
import type { TableList } from './types/tables'
|
|
4
|
-
|
|
5
|
-
import { storeToRefs } from 'pinia'
|
|
6
|
-
import { computed, ref, watch } from 'vue'
|
|
7
|
-
import BaseClickableIcon from '../../src/components/BaseClickableIcon.vue'
|
|
8
|
-
import BaseResizePanel from '../../src/components/BaseResizePanel.vue'
|
|
9
|
-
import { useClientStore } from './stores/client'
|
|
10
|
-
|
|
11
|
-
import { useTableStore } from './stores/table'
|
|
12
|
-
import { useTablesStore } from './stores/tables'
|
|
13
|
-
import TableView from './TableView.vue'
|
|
14
|
-
|
|
15
|
-
const { client } = defineProps<ApplicationProps>()
|
|
16
|
-
// init stores
|
|
17
|
-
const clientStore = useClientStore()
|
|
18
|
-
clientStore.setClient(client)
|
|
19
|
-
|
|
20
|
-
const tablesStore = useTablesStore()
|
|
21
|
-
const tableStore = useTableStore()
|
|
22
|
-
|
|
23
|
-
tableStore.setTableChangeCb(tablesStore.tableUpdateCallback)
|
|
24
|
-
|
|
25
|
-
const { isFetchingTables, tableType, selectedTable } = storeToRefs(tablesStore)
|
|
26
|
-
const { isCreating } = storeToRefs(tableStore)
|
|
27
|
-
const tableSearch = ref('')
|
|
28
|
-
const tableName = ref('')
|
|
29
|
-
|
|
30
|
-
const tables = computed(() => {
|
|
31
|
-
let tables: TableList[] = []
|
|
32
|
-
|
|
33
|
-
switch (tableType.value) {
|
|
34
|
-
case 'data':
|
|
35
|
-
tables = tablesStore.dataTables
|
|
36
|
-
break
|
|
37
|
-
case 'config':
|
|
38
|
-
tables = tablesStore.configTables
|
|
39
|
-
break
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (tableSearch.value) {
|
|
43
|
-
return tables.filter(table =>
|
|
44
|
-
table.name.toLocaleLowerCase().includes(tableSearch.value.toLocaleLowerCase()),
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return tables
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
async function createTable() {
|
|
52
|
-
if (!tableName.value) {
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
const table = await tableStore.createTable(tableName.value) as unknown as TableList
|
|
56
|
-
tableName.value = ''
|
|
57
|
-
await selectTable(table)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function selectTable(table?: TableList) {
|
|
61
|
-
if (!table) {
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
selectedTable.value = table
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
watch(
|
|
68
|
-
() => client.context.value.project,
|
|
69
|
-
async project => project && tablesStore.fetchTables(),
|
|
70
|
-
{ immediate: true },
|
|
71
|
-
)
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<template>
|
|
75
|
-
<div class="d-flex flex-grow-1 overflow-hidden full-height full-width">
|
|
76
|
-
<BaseResizePanel class="h-100" :collapsible="false" :default-width="400" :min-width="50" side="left">
|
|
77
|
-
<v-text-field
|
|
78
|
-
id="ant-tour-search-tables"
|
|
79
|
-
v-model="tableSearch"
|
|
80
|
-
:clearable="true"
|
|
81
|
-
placeholder="Search"
|
|
82
|
-
class="flex-grow-0"
|
|
83
|
-
color="primary"
|
|
84
|
-
density="compact"
|
|
85
|
-
hide-details
|
|
86
|
-
prepend-inner-icon="mdi-magnify"
|
|
87
|
-
type="search"
|
|
88
|
-
variant="filled"
|
|
89
|
-
@click:clear="tableSearch = ''"
|
|
90
|
-
/>
|
|
91
|
-
|
|
92
|
-
<v-list class="overflow-y-auto flex-grow-1" density="compact">
|
|
93
|
-
<div class="d-flex">
|
|
94
|
-
<v-list-subheader>Title</v-list-subheader>
|
|
95
|
-
<v-spacer />
|
|
96
|
-
<v-menu
|
|
97
|
-
v-if="tableType === 'data'"
|
|
98
|
-
:close-on-content-click="false"
|
|
99
|
-
location="end"
|
|
100
|
-
>
|
|
101
|
-
<template #activator="{ props: activatorProps }">
|
|
102
|
-
<v-btn
|
|
103
|
-
size="small"
|
|
104
|
-
variant="plain"
|
|
105
|
-
icon="mdi-plus"
|
|
106
|
-
v-bind="activatorProps"
|
|
107
|
-
/>
|
|
108
|
-
</template>
|
|
109
|
-
<v-card
|
|
110
|
-
class="w-[300px]"
|
|
111
|
-
title="Table name"
|
|
112
|
-
>
|
|
113
|
-
<v-card-text>
|
|
114
|
-
<v-text-field
|
|
115
|
-
v-model="tableName"
|
|
116
|
-
placeholder="Table Name"
|
|
117
|
-
variant="outlined"
|
|
118
|
-
color="primary"
|
|
119
|
-
density="compact"
|
|
120
|
-
hide-details
|
|
121
|
-
>
|
|
122
|
-
<template #append-inner>
|
|
123
|
-
<v-progress-circular
|
|
124
|
-
v-if="isCreating"
|
|
125
|
-
size="small"
|
|
126
|
-
color="grey-darken-2"
|
|
127
|
-
indeterminate
|
|
128
|
-
/>
|
|
129
|
-
<v-btn
|
|
130
|
-
v-else
|
|
131
|
-
variant="text"
|
|
132
|
-
size="small"
|
|
133
|
-
icon="mdi-content-save-check-outline"
|
|
134
|
-
color="grey-darken-2"
|
|
135
|
-
@click="createTable"
|
|
136
|
-
/>
|
|
137
|
-
</template>
|
|
138
|
-
</v-text-field>
|
|
139
|
-
</v-card-text>
|
|
140
|
-
<v-divider />
|
|
141
|
-
<v-card-actions>
|
|
142
|
-
<v-spacer />
|
|
143
|
-
<v-btn
|
|
144
|
-
variant="tonal"
|
|
145
|
-
:disabled="!tableName.length || isCreating"
|
|
146
|
-
:loading="isCreating"
|
|
147
|
-
class="px-4"
|
|
148
|
-
size="small"
|
|
149
|
-
color="primary"
|
|
150
|
-
@click="createTable"
|
|
151
|
-
>
|
|
152
|
-
Create
|
|
153
|
-
</v-btn>
|
|
154
|
-
</v-card-actions>
|
|
155
|
-
</v-card>
|
|
156
|
-
</v-menu>
|
|
157
|
-
<base-clickable-icon
|
|
158
|
-
:icon="tableType === 'data' ? 'mdi-table-multiple' : 'mdi-table-cog'"
|
|
159
|
-
size="large"
|
|
160
|
-
@click="tablesStore.toggleTableType"
|
|
161
|
-
/>
|
|
162
|
-
</div>
|
|
163
|
-
|
|
164
|
-
<v-skeleton-loader v-if="isFetchingTables" type="list-item@5" />
|
|
165
|
-
<div v-else appear class="d-flex flex-column flex-1" name="left-to-right" tag="div">
|
|
166
|
-
<v-list-item
|
|
167
|
-
v-for="(table, index) in tables"
|
|
168
|
-
:id="index === 0 ? 'ant-tour-table' : null"
|
|
169
|
-
:key="table.id"
|
|
170
|
-
:active="selectedTable?.id === table?.id"
|
|
171
|
-
:data-index="index"
|
|
172
|
-
:style="`--index: ${index}`"
|
|
173
|
-
:value="table"
|
|
174
|
-
color="primary"
|
|
175
|
-
@click="selectTable(table)"
|
|
176
|
-
>
|
|
177
|
-
<v-list-item-title>{{ table.name }}</v-list-item-title>
|
|
178
|
-
</v-list-item>
|
|
179
|
-
</div>
|
|
180
|
-
</v-list>
|
|
181
|
-
</BaseResizePanel>
|
|
182
|
-
|
|
183
|
-
<div class="full-height full-width flex-grow-1 d-flex overflow-y-auto">
|
|
184
|
-
<v-empty-state
|
|
185
|
-
v-if="!selectedTable"
|
|
186
|
-
class="flex-grow-1"
|
|
187
|
-
title="No table selected!"
|
|
188
|
-
text="Select a table from to view its data."
|
|
189
|
-
>
|
|
190
|
-
<template #media>
|
|
191
|
-
<v-icon icon="mdi-table" color="grey-darken-2" size="120" />
|
|
192
|
-
</template>
|
|
193
|
-
</v-empty-state>
|
|
194
|
-
|
|
195
|
-
<TableView v-else :client="client" :table-id="selectedTable.id" />
|
|
196
|
-
</div>
|
|
197
|
-
</div>
|
|
198
|
-
</template>
|
|
199
|
-
|
|
200
|
-
<style lang="scss" scoped>
|
|
201
|
-
.vh-100 {
|
|
202
|
-
height: 100vh;
|
|
203
|
-
overflow-y: auto;
|
|
204
|
-
}
|
|
205
|
-
</style>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { Column } from '@antcde/connect-ts/services/ColumnService'
|
|
2
|
-
import FileHandler from '../services/file-handler'
|
|
3
|
-
|
|
4
|
-
export const ANT_DELIMITER = `$%ANT%$`
|
|
5
|
-
|
|
6
|
-
export function validateEmail(value: any) {
|
|
7
|
-
const pattern = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/
|
|
8
|
-
return pattern.test(value)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export async function parseRecordBody(columns: Column[], data: any) {
|
|
12
|
-
const body: any = {
|
|
13
|
-
record: {},
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (data.session) {
|
|
17
|
-
body.session = {
|
|
18
|
-
id: data.session,
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
for (const column of columns) {
|
|
23
|
-
console.log(data[column.name] instanceof File, column.name, data[column.name])
|
|
24
|
-
if (column.type === 'document') {
|
|
25
|
-
if (data[column.name] instanceof File) {
|
|
26
|
-
body.record[column.name] = await FileHandler.handleFile(data[column.name])
|
|
27
|
-
}
|
|
28
|
-
continue
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
body.record[column.name] = parseData(column.type, data[column.name])
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return body
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function parseData(type: string, value: any) {
|
|
39
|
-
if (!value)
|
|
40
|
-
return null
|
|
41
|
-
switch (type) {
|
|
42
|
-
case 'integer':
|
|
43
|
-
return Number.parseInt(value)
|
|
44
|
-
case 'float':
|
|
45
|
-
return Number.parseFloat(value)
|
|
46
|
-
case 'boolean':
|
|
47
|
-
return !!value
|
|
48
|
-
case 'sbscode':
|
|
49
|
-
return value?.code ?? value ?? null
|
|
50
|
-
default:
|
|
51
|
-
return value
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Base64Container } from '@antcde/connect-ts/services/RecordService'
|
|
2
|
-
|
|
3
|
-
import FileHandler from '../services/file-handler'
|
|
4
|
-
|
|
5
|
-
export async function useDownloadDocument(doc: Base64Container) {
|
|
6
|
-
const byteArray = await FileHandler.b64toUint8Array(doc.file)
|
|
7
|
-
await FileHandler.downloadFile(byteArray, doc.name, doc.extension)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function useFormatFilename(filename?: string, ext?: string, maxLength: number = 10) {
|
|
11
|
-
if (!filename || !ext)
|
|
12
|
-
return ''
|
|
13
|
-
if (filename.length > maxLength) {
|
|
14
|
-
const name = filename.slice(0, maxLength - 3)
|
|
15
|
-
return `${name}...${ext}`
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
return `${filename}.${ext}`
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import type { Column } from '@antcde/connect-ts/services/ColumnService'
|
|
3
|
-
import { computed, ref, watchEffect } from 'vue'
|
|
4
|
-
import { useI18n } from 'vue-i18n'
|
|
5
|
-
import { useColumnStore } from '../../stores/columns'
|
|
6
|
-
|
|
7
|
-
const props = defineProps<{
|
|
8
|
-
column?: Column | null
|
|
9
|
-
}>()
|
|
10
|
-
|
|
11
|
-
const emit = defineEmits(['close'])
|
|
12
|
-
|
|
13
|
-
const { t } = useI18n()
|
|
14
|
-
|
|
15
|
-
const columnStore = useColumnStore()
|
|
16
|
-
|
|
17
|
-
const booleanDefaultActive = ref(false)
|
|
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)
|
|
38
|
-
|
|
39
|
-
const columnItem = ref({} as Partial<Column>)
|
|
40
|
-
|
|
41
|
-
watchEffect(() => (columnItem.value = props.column ? { ...props.column } : {}))
|
|
42
|
-
|
|
43
|
-
function closeDialog() {
|
|
44
|
-
booleanDefaultActive.value = false
|
|
45
|
-
columnForm.value?.reset()
|
|
46
|
-
emit('close')
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function saveColumn() {
|
|
50
|
-
const { valid } = await columnForm.value?.validate()
|
|
51
|
-
|
|
52
|
-
if (!valid) {
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (props.column) {
|
|
57
|
-
await columnStore.updateColumn(columnItem.value as Column)
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
await columnStore.addColumn(columnItem.value as Column)
|
|
61
|
-
}
|
|
62
|
-
closeDialog()
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function isRequired(value: any) {
|
|
66
|
-
return !!value || t('system.required')
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const title = computed(() =>
|
|
70
|
-
inEditMode.value
|
|
71
|
-
? t('project.tableConfig.columns.updateColumn', { column: props.column?.name })
|
|
72
|
-
: t('project.tableConfig.columns.newColumn'),
|
|
73
|
-
)
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<template>
|
|
77
|
-
<v-card class="h-full w-full d-flex flex-col">
|
|
78
|
-
<v-toolbar
|
|
79
|
-
class="px-0" density="compact"
|
|
80
|
-
variant="outlined" color="primary"
|
|
81
|
-
>
|
|
82
|
-
<v-toolbar-items>
|
|
83
|
-
<v-btn icon="mdi-arrow-left" @click="closeDialog" />
|
|
84
|
-
</v-toolbar-items>
|
|
85
|
-
|
|
86
|
-
<v-toolbar-title> {{ title }} </v-toolbar-title>
|
|
87
|
-
</v-toolbar>
|
|
88
|
-
<v-card-text class="flex-1">
|
|
89
|
-
<v-form ref="columnForm" class="d-flex flex-col gap-4">
|
|
90
|
-
<v-text-field
|
|
91
|
-
v-model="columnItem.name"
|
|
92
|
-
:label="t('project.tableConfig.columns.dialog.name')"
|
|
93
|
-
:placeholder="t('project.tableConfig.columns.dialog.name')"
|
|
94
|
-
:rules="[isRequired]"
|
|
95
|
-
color="primary"
|
|
96
|
-
density="compact"
|
|
97
|
-
variant="outlined"
|
|
98
|
-
type="text"
|
|
99
|
-
/>
|
|
100
|
-
|
|
101
|
-
<div class="d-flex gap-4">
|
|
102
|
-
<v-text-field
|
|
103
|
-
v-model="columnItem.order"
|
|
104
|
-
:label="t('project.tableConfig.columns.dialog.order')"
|
|
105
|
-
:placeholder="t('project.tableConfig.columns.dialog.order')"
|
|
106
|
-
:required="false"
|
|
107
|
-
class="!w-[100px]"
|
|
108
|
-
color="primary"
|
|
109
|
-
density="compact"
|
|
110
|
-
variant="outlined"
|
|
111
|
-
type="number"
|
|
112
|
-
/>
|
|
113
|
-
|
|
114
|
-
<v-select
|
|
115
|
-
v-model="columnItem.type"
|
|
116
|
-
:disabled="inEditMode"
|
|
117
|
-
:items="types"
|
|
118
|
-
:label="t('project.tableConfig.columns.dialog.type')"
|
|
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"
|
|
181
|
-
hide-details
|
|
182
|
-
color="primary"
|
|
183
|
-
class="flex-0-0 mr-2"
|
|
184
|
-
:label="t('project.tableConfig.columns.dialog.default')"
|
|
185
|
-
density="compact"
|
|
186
|
-
variant="outlined"
|
|
187
|
-
@change="
|
|
188
|
-
booleanDefaultActive
|
|
189
|
-
? (columnItem.default_value = false)
|
|
190
|
-
: (columnItem.default_value = null)
|
|
191
|
-
"
|
|
192
|
-
/>
|
|
193
|
-
<v-switch
|
|
194
|
-
v-model="columnItem.default_value"
|
|
195
|
-
color="primary"
|
|
196
|
-
:disabled="!booleanDefaultActive"
|
|
197
|
-
:label="columnItem.default_value?.toString()"
|
|
198
|
-
density="compact"
|
|
199
|
-
variant="outlined"
|
|
200
|
-
hide-details
|
|
201
|
-
/>
|
|
202
|
-
</div>
|
|
203
|
-
<v-text-field
|
|
204
|
-
v-else
|
|
205
|
-
v-model="columnItem.default_value"
|
|
206
|
-
:disabled="columnStore.isCreating || columnStore.isUpdating"
|
|
207
|
-
:placeholder="t('project.tableConfig.columns.dialog.value')"
|
|
208
|
-
:label="t('project.tableConfig.columns.dialog.default')"
|
|
209
|
-
color="primary"
|
|
210
|
-
density="compact"
|
|
211
|
-
variant="outlined"
|
|
212
|
-
/>
|
|
213
|
-
</template>
|
|
214
|
-
</v-form>
|
|
215
|
-
</v-card-text>
|
|
216
|
-
|
|
217
|
-
<v-divider />
|
|
218
|
-
<v-card-actions>
|
|
219
|
-
<v-spacer />
|
|
220
|
-
<v-btn variant="text" color="primary" @click="closeDialog">
|
|
221
|
-
{{ t('system.buttons.cancel') }}
|
|
222
|
-
</v-btn>
|
|
223
|
-
<v-btn variant="tonal" color="primary" @click="saveColumn">
|
|
224
|
-
{{ t('system.buttons.save') }}
|
|
225
|
-
</v-btn>
|
|
226
|
-
</v-card-actions>
|
|
227
|
-
</v-card>
|
|
228
|
-
</template>
|
|
229
|
-
|
|
230
|
-
<style lang="scss" scoped></style>
|