mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
feat(MySQL): spatial fields support (#165)
* feat: POINT field support * feat(MySQL): support to LINESTRING, POLYGON and GEOMETRY fields * refactor: removed links from map attribution * feat(MySQL): support to MULTIPOINT, MULTILINESTRING, MULTIPOLYGON and GEOMCOLLECTION fields * test: temporary fix on Windows tests
This commit is contained in:
@ -123,6 +123,21 @@
|
||||
</div>
|
||||
</template>
|
||||
</ConfirmModal>
|
||||
<ConfirmModal
|
||||
v-if="isMapModal"
|
||||
:hide-footer="true"
|
||||
size="medium"
|
||||
@hide="hideEditorModal"
|
||||
>
|
||||
<template #header>
|
||||
<div class="d-flex">
|
||||
<i class="mdi mdi-24px mdi-map mr-1" /> <span class="cut-text">"{{ editingField }}"</span>
|
||||
</div>
|
||||
</template>
|
||||
<template #body>
|
||||
<BaseMap :points="editingContent" :is-multi-spatial="isMultiSpatial" />
|
||||
</template>
|
||||
</ConfirmModal>
|
||||
<ConfirmModal
|
||||
v-if="isBlobEditor"
|
||||
:confirm-text="$t('word.update')"
|
||||
@ -187,10 +202,27 @@ import { mimeFromHex } from 'common/libs/mimeFromHex';
|
||||
import { formatBytes } from 'common/libs/formatBytes';
|
||||
import { bufferToBase64 } from 'common/libs/bufferToBase64';
|
||||
import hexToBinary from 'common/libs/hexToBinary';
|
||||
import { TEXT, LONG_TEXT, ARRAY, TEXT_SEARCH, NUMBER, FLOAT, BOOLEAN, DATE, TIME, DATETIME, BLOB, BIT, HAS_TIMEZONE } from 'common/fieldTypes';
|
||||
import {
|
||||
TEXT,
|
||||
LONG_TEXT,
|
||||
ARRAY,
|
||||
TEXT_SEARCH,
|
||||
NUMBER,
|
||||
FLOAT,
|
||||
BOOLEAN,
|
||||
DATE,
|
||||
TIME,
|
||||
DATETIME,
|
||||
BLOB,
|
||||
BIT,
|
||||
HAS_TIMEZONE,
|
||||
SPATIAL,
|
||||
IS_MULTI_SPATIAL
|
||||
} from 'common/fieldTypes';
|
||||
import { VueMaskDirective } from 'v-mask';
|
||||
import ConfirmModal from '@/components/BaseConfirmModal';
|
||||
import TextEditor from '@/components/BaseTextEditor';
|
||||
import BaseMap from '@/components/BaseMap';
|
||||
import ForeignKeySelect from '@/components/ForeignKeySelect';
|
||||
|
||||
export default {
|
||||
@ -198,7 +230,8 @@ export default {
|
||||
components: {
|
||||
ConfirmModal,
|
||||
TextEditor,
|
||||
ForeignKeySelect
|
||||
ForeignKeySelect,
|
||||
BaseMap
|
||||
},
|
||||
directives: {
|
||||
mask: VueMaskDirective
|
||||
@ -248,7 +281,10 @@ export default {
|
||||
return val;
|
||||
}
|
||||
|
||||
return val;
|
||||
if (SPATIAL.includes(type))
|
||||
return val;
|
||||
|
||||
return typeof val === 'object' ? JSON.stringify(val) : val;
|
||||
}
|
||||
},
|
||||
props: {
|
||||
@ -263,6 +299,8 @@ export default {
|
||||
isInlineEditor: {},
|
||||
isTextareaEditor: false,
|
||||
isBlobEditor: false,
|
||||
isMapModal: false,
|
||||
isMultiSpatial: false,
|
||||
willBeDeleted: false,
|
||||
originalContent: null,
|
||||
editingContent: null,
|
||||
@ -331,6 +369,9 @@ export default {
|
||||
if (BOOLEAN.includes(this.editingType))
|
||||
return { type: 'boolean', mask: false };
|
||||
|
||||
if (SPATIAL.includes(this.editingType))
|
||||
return { type: 'map', mask: false };
|
||||
|
||||
return { type: 'text', mask: false };
|
||||
},
|
||||
isImage () {
|
||||
@ -403,7 +444,7 @@ export default {
|
||||
return bufferToBase64(val);
|
||||
},
|
||||
editON (event, content, field) {
|
||||
if (!this.isEditable) return;
|
||||
if (!this.isEditable || this.editingType === 'none') return;
|
||||
|
||||
window.addEventListener('keydown', this.onKey);
|
||||
|
||||
@ -419,6 +460,15 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SPATIAL.includes(type)) {
|
||||
if (content) {
|
||||
this.isMultiSpatial = IS_MULTI_SPATIAL.includes(type);
|
||||
this.isMapModal = true;
|
||||
this.editingContent = this.$options.filters.typeFormat(content, type);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (BLOB.includes(type)) {
|
||||
this.isBlobEditor = true;
|
||||
this.editingContent = content || '';
|
||||
@ -490,6 +540,8 @@ export default {
|
||||
hideEditorModal () {
|
||||
this.isTextareaEditor = false;
|
||||
this.isBlobEditor = false;
|
||||
this.isMapModal = false;
|
||||
this.isMultiSpatial = false;
|
||||
},
|
||||
downloadFile () {
|
||||
const downloadLink = document.createElement('a');
|
||||
|
Reference in New Issue
Block a user