@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.
Files changed (74) hide show
  1. package/README.md +6 -0
  2. package/dist/component-library.css +1 -1
  3. package/dist/index.js +16719 -17759
  4. package/dist/types/components/BaseAppCard.vue.d.ts +18 -4
  5. package/dist/types/components/BaseAppCardSkeleton.vue.d.ts +2 -0
  6. package/dist/types/components/BaseDeleteDialog.vue.d.ts +20 -7
  7. package/dist/types/components/RBAC/Permissions/PermissionCard.vue.d.ts +1 -1
  8. package/dist/types/components/TasksFlow/useTaskFlow.d.ts +7 -6
  9. package/dist/types/index.d.ts +3 -1
  10. package/lib/DocumentManager/DocumentDrop.vue +2 -6
  11. package/lib/DocumentManager/DocumentManager.vue +48 -41
  12. package/lib/DocumentManager/hooks/useDms.ts +1 -3
  13. package/lib/DocumentManager/index.ts +1 -1
  14. package/lib/DocumentManager/lang/translations/de.json +36 -0
  15. package/lib/DocumentManager/lang/translations/en.json +38 -0
  16. package/lib/DocumentManager/lang/translations/nl.json +36 -0
  17. package/lib/DocumentManager/utils.ts +1 -1
  18. package/lib/ForgeViewer/ForgeViewer.vue +6 -5
  19. package/lib/ForgeViewer/lang/translations/de.json +6 -0
  20. package/lib/ForgeViewer/lang/translations/en.json +6 -0
  21. package/lib/ForgeViewer/lang/translations/nl.json +6 -0
  22. package/lib/ForgeViewer/useForgeViewer.ts +0 -1
  23. package/lib/GisViewer/GisViewer.vue +14 -8
  24. package/lib/GisViewer/useGisViewer.ts +3 -3
  25. package/package.json +4 -3
  26. package/lib/DocumentManager/hooks/useDarkMode.ts +0 -17
  27. package/lib/TableViewer/TableView.vue +0 -39
  28. package/lib/TableViewer/TableViewer.vue +0 -205
  29. package/lib/TableViewer/composables/records.ts +0 -53
  30. package/lib/TableViewer/composables/useFile.ts +0 -20
  31. package/lib/TableViewer/core/Columns/ColumnForm.vue +0 -230
  32. package/lib/TableViewer/core/Columns/ColumnsConfiguration.vue +0 -99
  33. package/lib/TableViewer/core/Columns/ColumnsConfigurationTable.vue +0 -186
  34. package/lib/TableViewer/core/Columns/ColumnsTable.vue +0 -165
  35. package/lib/TableViewer/core/Permissions/PermissionDialog.vue +0 -149
  36. package/lib/TableViewer/core/Permissions/PermissionForm.vue +0 -117
  37. package/lib/TableViewer/core/Permissions/PermissionsConfiguration.vue +0 -55
  38. package/lib/TableViewer/core/Permissions/PermissionsConfigurationTable.vue +0 -185
  39. package/lib/TableViewer/core/Permissions/PermissionsTable.vue +0 -207
  40. package/lib/TableViewer/core/Queries/QueriesMenu.vue +0 -75
  41. package/lib/TableViewer/core/Queries/QueryItem.vue +0 -112
  42. package/lib/TableViewer/core/Records/RecordCell.vue +0 -118
  43. package/lib/TableViewer/core/Records/RecordDialog.vue +0 -128
  44. package/lib/TableViewer/core/Records/RecordHeader.vue +0 -175
  45. package/lib/TableViewer/core/Records/RecordInput.vue +0 -183
  46. package/lib/TableViewer/core/Records/RecordValue.vue +0 -123
  47. package/lib/TableViewer/core/Records/RecordsTable.vue +0 -233
  48. package/lib/TableViewer/core/Records/RecordsTableToolbar.vue +0 -310
  49. package/lib/TableViewer/core/Relations/RelationForm.vue +0 -154
  50. package/lib/TableViewer/core/Relations/RelationsConfiguration.vue +0 -32
  51. package/lib/TableViewer/core/Relations/RelationsConfigurationTable.vue +0 -146
  52. package/lib/TableViewer/core/Relations/RelationsTable.vue +0 -129
  53. package/lib/TableViewer/core/Revisions/RevisionComparisonCell.vue +0 -50
  54. package/lib/TableViewer/core/Revisions/RevisionComparisonTable.vue +0 -98
  55. package/lib/TableViewer/core/Revisions/RevisionHistory.vue +0 -138
  56. package/lib/TableViewer/core/Revisions/RevisionSelector.vue +0 -140
  57. package/lib/TableViewer/index.ts +0 -4
  58. package/lib/TableViewer/services/file-handler.ts +0 -84
  59. package/lib/TableViewer/stores/client.ts +0 -18
  60. package/lib/TableViewer/stores/columns.ts +0 -152
  61. package/lib/TableViewer/stores/conditions.ts +0 -88
  62. package/lib/TableViewer/stores/permissions.ts +0 -102
  63. package/lib/TableViewer/stores/queries.ts +0 -80
  64. package/lib/TableViewer/stores/records.ts +0 -256
  65. package/lib/TableViewer/stores/relations.ts +0 -89
  66. package/lib/TableViewer/stores/revisions.ts +0 -194
  67. package/lib/TableViewer/stores/roles.ts +0 -109
  68. package/lib/TableViewer/stores/table.ts +0 -134
  69. package/lib/TableViewer/stores/tables.ts +0 -65
  70. package/lib/TableViewer/types/app.d.ts +0 -5
  71. package/lib/TableViewer/types/column.d.ts +0 -28
  72. package/lib/TableViewer/types/permission.d.ts +0 -12
  73. package/lib/TableViewer/types/project.d.ts +0 -37
  74. package/lib/TableViewer/types/tables.d.ts +0 -69
@@ -1,118 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { Column } from '@antcde/connect-ts/services/ColumnService'
3
- import { storeToRefs } from 'pinia'
4
- import { computed, ref, watch } from 'vue'
5
- import { parseRecordBody } from '../../composables/records'
6
- import { useRecordStore } from '../../stores/records'
7
- import { useTableStore } from '../../stores/table'
8
- import RecordInput from '../Records/RecordInput.vue'
9
- import RecordValue from '../Records/RecordValue.vue'
10
-
11
- const props = defineProps<{
12
- recordId: string
13
- value: any
14
- column: Column
15
- }>()
16
-
17
- const isUpdating = ref(false)
18
- const currentCellValue = ref(props.value)
19
-
20
- const recordStore = useRecordStore()
21
- const { table } = storeToRefs(useTableStore())
22
- const { update: canUpdate } = table.value?.permissions ?? {}
23
-
24
- const isSelected = computed(() => recordStore.isCellSelected(props.recordId, props.column.id))
25
-
26
- const updateOnChange = computed(() => ![
27
- 'text',
28
- 'integer',
29
- 'link',
30
- 'float',
31
- 'email',
32
- 'text-field',
33
- ].includes(props.column.type))
34
-
35
- async function updateRecord() {
36
- if (!canUpdate || (props.column.required && !currentCellValue.value) || isUpdating.value)
37
- return
38
-
39
- try {
40
- isUpdating.value = true
41
-
42
- const body = await parseRecordBody([props.column], {
43
- [props.column.name]: currentCellValue.value,
44
- })
45
-
46
- await recordStore.updateRecord(props.recordId, body)
47
-
48
- recordStore.selectNextCell()
49
- }
50
- finally {
51
- isUpdating.value = false
52
- }
53
- }
54
-
55
- function handleChange() {
56
- if (updateOnChange.value) {
57
- updateRecord()
58
- }
59
- }
60
-
61
- function handleEnter() {
62
- if (!updateOnChange.value) {
63
- updateRecord()
64
- }
65
- }
66
-
67
- function resetCell() {
68
- currentCellValue.value = props.value
69
- }
70
-
71
- watch(
72
- () => props.value,
73
- (value) => {
74
- currentCellValue.value = value
75
- },
76
- )
77
-
78
- watch(
79
- () => isSelected.value,
80
- (isSelected, wasSelected) => {
81
- if (wasSelected && !isSelected) {
82
- resetCell()
83
- }
84
- },
85
- )
86
- </script>
87
-
88
- <template>
89
- <record-input
90
- v-if="isSelected && canUpdate"
91
- v-model="currentCellValue"
92
- hide-label
93
- :column="column"
94
- :is-loading="isUpdating"
95
- :input-props="{
96
- hideDetails: true,
97
- variant: 'solo-filled',
98
- label: null,
99
- placeholder: null,
100
- singleLine: true,
101
- disabled: isUpdating,
102
- rows: 1,
103
- noResize: true,
104
- }"
105
- @keydown.esc="resetCell"
106
- @keydown.enter="handleEnter"
107
- @update:model-value="handleChange"
108
- />
109
-
110
- <record-value
111
- v-else
112
- :value="value"
113
- :column="column"
114
- :record-id="recordId"
115
- />
116
- </template>
117
-
118
- <style lang="scss" scoped></style>
@@ -1,128 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { Column } from '@antcde/connect-ts/services/ColumnService'
3
- import type { TableRecord } from '@antcde/connect-ts/services/TableService'
4
- import { storeToRefs } from 'pinia'
5
- import { computed, ref, watchEffect } from 'vue'
6
- import { useI18n } from 'vue-i18n'
7
- import { parseRecordBody, validateEmail } from '../../composables/records'
8
-
9
- import { useColumnStore } from '../../stores/columns'
10
- import { useRecordStore } from '../../stores/records'
11
- import RecordInput from '../Records/RecordInput.vue'
12
-
13
- const props = defineProps<{
14
- displayDialog: boolean
15
- record?: TableRecord | null
16
- }>()
17
-
18
- const emit = defineEmits(['close'])
19
-
20
- const { t } = useI18n()
21
-
22
- const recordStore = useRecordStore()
23
- const columnStore = useColumnStore()
24
-
25
- const { isUpdating, isCreating } = storeToRefs(recordStore)
26
-
27
- const { columns } = storeToRefs(columnStore)
28
-
29
- const recordItem = ref<TableRecord>({
30
- id: '-1',
31
- })
32
-
33
- const isLoading = computed(() => isUpdating.value || isCreating.value)
34
- const isValid = computed(() => columns.value.every(column => validateColumnValue(column, recordItem.value[column.name])))
35
-
36
- function validateColumnValue(column: Column, value: any) {
37
- if (column.required && !value) {
38
- return false
39
- }
40
- if (column.type === 'email') {
41
- return value ? validateEmail(value) : true
42
- }
43
- return true
44
- }
45
-
46
- async function saveRecord() {
47
- const body = await parseRecordBody(columns.value, recordItem.value)
48
- try {
49
- if (recordItem.value.id !== '-1') {
50
- await recordStore.updateRecord(recordItem.value.id, body)
51
- }
52
- else {
53
- await recordStore.createRecord(body)
54
- }
55
- closeDialog()
56
- }
57
- catch (e) {
58
- console.error(e)
59
- }
60
- }
61
-
62
- watchEffect(async () => recordItem.value = props.record ? { ...props.record } : { id: '-1' })
63
-
64
- function closeDialog() {
65
- recordItem.value = {
66
- id: '-1',
67
- }
68
- emit('close')
69
- }
70
- </script>
71
-
72
- <template>
73
- <v-dialog
74
- :model-value="displayDialog"
75
- width="800"
76
- height="600"
77
- @update:model-value="closeDialog"
78
- >
79
- <v-card class="d-flex">
80
- <v-toolbar color="primary" density="compact">
81
- <v-toolbar-title>{{ t(recordItem.id !== '-1' ? 'project.records.dialog.updateTitle' : 'project.records.dialog.createTitle') }}</v-toolbar-title>
82
-
83
- <v-spacer />
84
-
85
- <v-toolbar-items>
86
- <v-btn
87
- icon="mdi-close"
88
- @click="emit('close')"
89
- />
90
- </v-toolbar-items>
91
- </v-toolbar>
92
- <v-card-text class="flex-1 d-flex flex-col gap-1 overflow-auto">
93
- <record-input
94
- v-for="column in columns"
95
- :key="column.id"
96
- v-model="recordItem[column.name]"
97
- :column="column"
98
- :hide-label="false"
99
- />
100
- </v-card-text>
101
- <v-divider />
102
- <v-card-actions>
103
- <v-spacer />
104
- <v-btn
105
- :disabled="isLoading"
106
- size="small"
107
- variant="text"
108
- color="primary"
109
- @click="emit('close')"
110
- >
111
- {{ t('system.buttons.cancel') }}
112
- </v-btn>
113
- <v-btn
114
- :disabled="isLoading || !isValid"
115
- :loading="isLoading"
116
- color="primary"
117
- size="small"
118
- variant="flat"
119
- @click="saveRecord"
120
- >
121
- {{ t('system.buttons.save') }}
122
- </v-btn>
123
- </v-card-actions>
124
- </v-card>
125
- </v-dialog>
126
- </template>
127
-
128
- <style lang="scss" scoped></style>
@@ -1,175 +0,0 @@
1
- <script lang="ts" setup>
2
- import { storeToRefs } from 'pinia'
3
- import { computed, ref, watch } from 'vue'
4
- import { useI18n } from 'vue-i18n'
5
- import { useColumnStore } from '../../stores/columns'
6
- import { useConditionStore } from '../../stores/conditions'
7
-
8
- const props = defineProps<{
9
- header: any
10
- }>()
11
-
12
- const { t } = useI18n()
13
-
14
- const conditionStore = useConditionStore()
15
- const columnStore = useColumnStore()
16
-
17
- const { columnsAlias } = storeToRefs(columnStore)
18
- const alias = ref('')
19
- const showAlias = ref(false)
20
-
21
- const column = computed(() => props.header.column)
22
- const conditions = computed(() => column.value ? conditionStore.getColumnConditions(column.value) : [])
23
- const columnAlias = computed(() => columnsAlias.value[column.value.id] ?? '')
24
-
25
- const showFilterIcon = computed(() => ['text', 'integer', 'float', 'email', 'boolean'].includes(column.value.type))
26
-
27
- const appliedConditions = computed(() =>
28
- conditions.value.filter(
29
- condition => condition.operator && condition.value && condition.applied === true
30
- )
31
- )
32
-
33
- const hasAppliedConditions = computed(() => appliedConditions.value.length > 0)
34
-
35
- watch(columnAlias, (value: string) => alias.value = value, { immediate: true })
36
- </script>
37
-
38
- <template>
39
- <v-hover>
40
- <template #default="{ isHovering, props: hoverProps }">
41
- <v-card flat variant="text" elevated="0" v-bind="hoverProps"
42
- class="d-flex h-full w-full items-center justify-between">
43
- <span class="d-flex h-full w-full items-center me-4 font-bold">
44
- {{ columnAlias || header.name }}
45
- <v-icon
46
- v-if="column.required"
47
- v-tooltip="t('project.tableConfig.columns.is_required')"
48
- size="8"
49
- color="error"
50
- icon="mdi-asterisk"
51
- />
52
- </span>
53
-
54
- <div class="transition-all transition-duration-200" :class="[isHovering ? 'opacity-100' : 'opacity-0']">
55
- <v-menu v-if="showAlias" :close-on-content-click="false" @click.stop.prevent>
56
- <template #activator="{ props: activatorProps }">
57
- <v-btn
58
- size="small"
59
- variant="plain"
60
- icon="mdi-pencil"
61
- v-bind="activatorProps"
62
- @click.stop.prevent
63
- />
64
- </template>
65
- <v-card width="400">
66
- <v-card-title class="d-flex items-center justify-between">
67
- {{ t('project.tableConfig.columns.alias') }}
68
- </v-card-title>
69
- <v-divider class="my-0" />
70
- <v-card-text class="p-4">
71
- <v-text-field
72
- v-model="alias"
73
- :label="t('project.tableConfig.columns.alias')"
74
- variant="outlined"
75
- color="primary"
76
- density="compact"
77
- append-inner-icon="mdi-content-save-check"
78
- hide-details
79
- @click:append-inner="() => columnStore.setColumnAlias(column, alias)"
80
- />
81
- </v-card-text>
82
- </v-card>
83
- </v-menu>
84
-
85
- <v-menu v-if="showFilterIcon" :close-on-content-click="false" @click.stop.prevent>
86
- <template #activator="{ props: activatorProps }">
87
- <v-btn
88
- size="small"
89
- variant="plain"
90
- :color="hasAppliedConditions ? 'primary' : ''"
91
- :active="hasAppliedConditions"
92
- :icon="hasAppliedConditions ? 'mdi-filter' : 'mdi-filter-outline'"
93
- v-bind="activatorProps"
94
- @click.stop.prevent
95
- />
96
- </template>
97
- <v-card width="400">
98
- <v-card-title class="d-flex items-center justify-between">
99
- {{ t('project.tableConfig.conditions.title') }}
100
- <v-btn
101
- v-tooltip="t('project.tableConfig.conditions.addCondition')"
102
- size="small"
103
- variant="plain"
104
- icon="mdi-filter-plus-outline"
105
- @click="() => conditionStore.addCondition(column)"
106
- />
107
- </v-card-title>
108
- <v-divider class="my-0" />
109
- <v-card-text class="max-h-[275px] overflow-auto p-0">
110
- <v-list class="pt-0">
111
- <template v-for="(condition, index) in conditions" :key="condition.id">
112
- <v-list-item>
113
- <div class="d-flex items-center gap-4 py-2">
114
- <v-select
115
- v-model="condition.operator"
116
- :items="['=', '>', '<', '>=', '<=', '<>']"
117
- :label="t('project.tableConfig.conditions.operator')"
118
- variant="outlined"
119
- color="primary"
120
- density="compact"
121
- class="flex-1"
122
- hide-details
123
- />
124
- <v-btn
125
- variant="plain"
126
- :disabled="conditions.length === 1"
127
- icon="mdi-trash-can-outline"
128
- @click="() => conditionStore.removeCondition(condition.id)"
129
- />
130
- </div>
131
- <v-text-field
132
- v-model="condition.value"
133
- :label="t('project.tableConfig.conditions.value')"
134
- variant="outlined"
135
- color="primary"
136
- density="compact"
137
- class="mt-2"
138
- hide-details
139
- />
140
- </v-list-item>
141
- <v-divider v-if="index < conditions.length - 1" class="my-3" />
142
- </template>
143
- </v-list>
144
- </v-card-text>
145
- <v-divider class="my-0" />
146
- <v-card-actions>
147
- <v-spacer />
148
- <v-btn
149
- variant="text"
150
- class="px-4"
151
- size="small"
152
- color="primary"
153
- @click="() => conditionStore.clearColumnConditions(column)"
154
- >
155
- {{ t('project.tableConfig.conditions.clear') }}
156
- </v-btn>
157
- <v-btn
158
- variant="tonal"
159
- class="px-4"
160
- size="small"
161
- color="primary"
162
- @click="() => conditionStore.applyColumnConditions(column)"
163
- >
164
- {{ t('project.tableConfig.conditions.apply') }}
165
- </v-btn>
166
- </v-card-actions>
167
- </v-card>
168
- </v-menu>
169
- </div>
170
- </v-card>
171
- </template>
172
- </v-hover>
173
- </template>
174
-
175
- <style lang="scss" scoped></style>
@@ -1,183 +0,0 @@
1
- <script lang="ts" setup>
2
- import type { Column, SbsRecord } from '@antcde/connect-ts'
3
- import { storeToRefs } from 'pinia'
4
- import { computed, ref } from 'vue'
5
- import { useI18n } from 'vue-i18n'
6
- import { useClientStore } from '../../stores/client'
7
- import { useTableStore } from '../../stores/table'
8
- import { useTablesStore } from '../../stores/tables'
9
-
10
- const props = defineProps<{
11
- column: Column
12
- isLoading?: boolean
13
- inputProps?: any
14
- events?: any
15
- hideLabel: boolean
16
- }>()
17
-
18
- const { t } = useI18n()
19
-
20
- const model = defineModel()
21
-
22
- const tableStore = useTableStore()
23
- const tablesStore = useTablesStore()
24
- const clientStore = useClientStore()
25
-
26
- const sbsRecords = ref<SbsRecord[]>([])
27
- const isLoadingSbs = ref(false)
28
-
29
- const { client } = storeToRefs(clientStore)
30
- const { table } = storeToRefs(tableStore)
31
- const { tables } = storeToRefs(tablesStore)
32
-
33
- const inputComponent = computed(() => {
34
- switch (props.column.type) {
35
- case 'text':
36
- case 'integer':
37
- case 'link':
38
- case 'float':
39
- case 'email':
40
- return 'v-text-field'
41
- case 'text-field':
42
- return 'v-textarea'
43
- case 'boolean':
44
- return 'v-checkbox'
45
- case 'dropdown':
46
- case 'table':
47
- case 'sbscode':
48
- return 'v-autocomplete'
49
- case 'document':
50
- return 'v-file-input'
51
- case 'date':
52
- return 'v-date-input'
53
- default:
54
- return 'v-text-field'
55
- }
56
- })
57
-
58
- const inputProps = computed(() => {
59
- let defaultProps: any = {
60
- variant: 'filled',
61
- color: 'primary',
62
- density: 'compact',
63
- placeholder: props.column.name,
64
- }
65
- switch (props.column.type) {
66
- case 'email':
67
- defaultProps = {
68
- ...defaultProps,
69
- type: 'email',
70
- }
71
- break
72
- case 'integer':
73
- case 'float':
74
- defaultProps = {
75
- ...defaultProps,
76
- type: 'number',
77
- }
78
- break
79
- case 'table':
80
- defaultProps = {
81
- ...defaultProps,
82
- items: tables.value,
83
- itemTitle: 'name',
84
- itemValue: 'id',
85
- }
86
- break
87
- case 'dropdown':
88
- defaultProps = {
89
- ...defaultProps,
90
- items: props.column.options_value ?? [],
91
- }
92
- break
93
- case 'sbscode':
94
- defaultProps = {
95
- ...defaultProps,
96
- noFilter: true,
97
- items: sbsRecords.value,
98
- loading: isLoadingSbs.value,
99
- itemTitle: 'code',
100
- itemValue: 'code',
101
- }
102
- break
103
- case 'date':
104
- defaultProps = {
105
- ...defaultProps,
106
- prependIcon: '',
107
- prependInnerIcon: '$calendar',
108
- }
109
- break
110
- }
111
-
112
- return {
113
- ...defaultProps,
114
- ...(props.inputProps ?? {}),
115
- }
116
- })
117
-
118
- const inputEvents = computed(() => {
119
- switch (props.column.type) {
120
- case 'sbscode':
121
- return {
122
- 'update:search': searchSearchSbs,
123
- }
124
- default:
125
- return {}
126
- }
127
- })
128
-
129
- function validateEmail(value: any) {
130
- const pattern = /^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/
131
- return pattern.test(value) || 'Invalid e-mail.'
132
- }
133
-
134
- function validateValue() {
135
- if (props.column.required && !model.value) {
136
- return 'This field is required'
137
- }
138
-
139
- if (props.column.type === 'email' && !validateEmail(model.value)) {
140
- return 'Invalid email'
141
- }
142
-
143
- return true
144
- }
145
-
146
- // This function should be debounced
147
- async function searchSearchSbs(searchTerm: string) {
148
- const connect = client?.value?.connect
149
- if (connect) {
150
- isLoadingSbs.value = true
151
- sbsRecords.value = table.value?.project
152
- ? await connect.sbs.searchSbs(table.value.project, searchTerm)
153
- : []
154
- isLoadingSbs.value = false
155
- }
156
- }
157
- </script>
158
-
159
- <template>
160
- <div>
161
- <v-label v-if="!hideLabel" class="mb-2">
162
- {{ column.name }}
163
- <v-icon
164
- v-if="column.required"
165
- v-tooltip="t('project.tableConfig.columns.is_required')"
166
- size="8"
167
- color="error"
168
- icon="mdi-asterisk"
169
- />
170
- </v-label>
171
- <component
172
- :is="inputComponent"
173
- v-model="model"
174
- :rules="[validateValue]"
175
- v-bind="inputProps"
176
- v-on="inputEvents"
177
- >
178
- <template v-if="isLoading" #append-inner>
179
- <v-progress-circular size="24" color="grey-darken-2" indeterminate />
180
- </template>
181
- </component>
182
- </div>
183
- </template>