Browse Source

Merge pull request #2163 from nocodb/enhancement/column-icons

enhancement: column icons
pull/2169/head
աɨռɢӄաօռɢ 3 years ago committed by GitHub
parent
commit
d047c744cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      packages/nc-gui/components/project/spreadsheet/RowsXcDataTable.vue
  2. 14
      packages/nc-gui/components/project/spreadsheet/components/ColumnFilter.vue
  3. 7
      packages/nc-gui/components/project/spreadsheet/components/FieldsMenu.vue
  4. 9
      packages/nc-gui/components/project/spreadsheet/components/SortListMenu.vue
  5. 6
      packages/nc-gui/components/project/spreadsheet/mixins/spreadsheet.js

3
packages/nc-gui/components/project/spreadsheet/RowsXcDataTable.vue

@ -29,6 +29,9 @@
:key="col.column_name" :key="col.column_name"
@click="searchField = col.title" @click="searchField = col.title"
> >
<v-icon color="grey darken-4" small class="mr-1">
{{ col.icon }}
</v-icon>
<span class="caption">{{ col.title }}</span> <span class="caption">{{ col.title }}</span>
</v-list-item> </v-list-item>
</v-list> </v-list>

14
packages/nc-gui/components/project/spreadsheet/components/ColumnFilter.vue

@ -109,9 +109,10 @@
@change="saveOrUpdate(filter, i)" @change="saveOrUpdate(filter, i)"
> >
<template #item="{ item }"> <template #item="{ item }">
<span <span :class="`caption font-weight-regular nc-filter-fld-${item.title}`">
:class="`caption font-weight-regular nc-filter-fld-${item.title}`" <v-icon color="grey darken-4" small class="mr-1">
> {{ item.icon }}
</v-icon>
{{ item.title }} {{ item.title }}
</span> </span>
</template> </template>
@ -182,7 +183,7 @@
</template> </template>
<script> <script>
import { UITypes } from '~/components/project/spreadsheet/helpers/uiTypes' import { getUIDTIcon, UITypes } from '~/components/project/spreadsheet/helpers/uiTypes'
export default { export default {
name: 'ColumnFilter', name: 'ColumnFilter',
@ -276,7 +277,10 @@ export default {
columns() { columns() {
return ( return (
this.meta && this.meta &&
this.meta.columns.filter(c => c && (!c.colOptions || !c.system)) this.meta.columns.filter(c => c && (!c.colOptions || !c.system)).map(c => ({
...c,
icon: getUIDTIcon(c.uidt)
}))
) )
}, },
types() { types() {

7
packages/nc-gui/components/project/spreadsheet/components/FieldsMenu.vue

@ -123,6 +123,9 @@
@change="saveOrUpdate(field, i)" @change="saveOrUpdate(field, i)"
> >
<template #label> <template #label>
<v-icon color="grey darken-4" small class="mr-1">
{{ field.icon }}
</v-icon>
<span class="caption">{{ field.title }}</span> <span class="caption">{{ field.title }}</span>
</template> </template>
</v-checkbox> </v-checkbox>
@ -172,6 +175,7 @@
<script> <script>
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
import { getSystemColumnsIds } from 'nocodb-sdk' import { getSystemColumnsIds } from 'nocodb-sdk'
import { getUIDTIcon } from '~/components/project/spreadsheet/helpers/uiTypes'
export default { export default {
name: 'FieldsMenu', name: 'FieldsMenu',
@ -346,7 +350,8 @@ export default {
title: c.title, title: c.title,
fk_column_id: c.id, fk_column_id: c.id,
...(fieldById[c.id] ? fieldById[c.id] : {}), ...(fieldById[c.id] ? fieldById[c.id] : {}),
order: (fieldById[c.id] && fieldById[c.id].order) || order++ order: (fieldById[c.id] && fieldById[c.id].order) || order++,
icon: getUIDTIcon(c.uidt)
})) }))
.sort((a, b) => a.order - b.order) .sort((a, b) => a.order - b.order)
} else if (this.isPublic) { } else if (this.isPublic) {

9
packages/nc-gui/components/project/spreadsheet/components/SortListMenu.vue

@ -53,6 +53,9 @@
<span <span
:class="`caption font-weight-regular nc-sort-fld-${item.title}`" :class="`caption font-weight-regular nc-sort-fld-${item.title}`"
> >
<v-icon color="grey darken-4" small class="mr-1">
{{ item.icon }}
</v-icon>
{{ item.title }} {{ item.title }}
</span> </span>
</template> </template>
@ -90,6 +93,7 @@
<script> <script>
import { RelationTypes, UITypes } from "nocodb-sdk"; import { RelationTypes, UITypes } from "nocodb-sdk";
import { getUIDTIcon } from '~/components/project/spreadsheet/helpers/uiTypes'
export default { export default {
name: "SortListMenu", name: "SortListMenu",
@ -115,7 +119,10 @@ export default {
c.uidt === UITypes.LinkToAnotherRecord && c.uidt === UITypes.LinkToAnotherRecord &&
c.colOptions.type !== RelationTypes.BELONGS_TO c.colOptions.type !== RelationTypes.BELONGS_TO
) )
); ).map(c => ({
...c,
icon: getUIDTIcon(c.uidt)
}));
}, },
}, },
watch: { watch: {

6
packages/nc-gui/components/project/spreadsheet/mixins/spreadsheet.js

@ -1,4 +1,5 @@
import { isVirtualCol, filterOutSystemColumns } from 'nocodb-sdk' import { isVirtualCol, filterOutSystemColumns } from 'nocodb-sdk'
import { getUIDTIcon } from '~/components/project/spreadsheet/helpers/uiTypes'
export default { export default {
data: () => ({ data: () => ({
@ -91,7 +92,10 @@ export default {
}, []) }, [])
}, },
availableRealColumns() { availableRealColumns() {
return this.availableColumns && this.availableColumns.filter(c => !isVirtualCol(c)) return this.availableColumns && this.availableColumns.filter(c => !isVirtualCol(c)).map(c => ({
...c,
icon: getUIDTIcon(c.uidt)
}))
}, },
allColumns() { allColumns() {

Loading…
Cancel
Save