Browse Source

Merge branch 'develop' into feat/gui-v2-formula-options

pull/2998/head
Wing-Kam Wong 2 years ago
parent
commit
2e6c6264cf
  1. 50
      packages/nc-gui-v2/components/cell/Checkbox.vue
  2. 2
      packages/nc-gui-v2/components/cell/Integer.vue
  3. 3
      packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue
  4. 93
      packages/nc-gui-v2/components/smartsheet-column/RatingOptions.vue
  5. 65
      packages/nc-gui-v2/components/smartsheet-header/Cell.vue
  6. 50
      packages/nc-gui-v2/components/smartsheet-header/Menu.vue
  7. 65
      packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue
  8. 54
      packages/nc-gui-v2/components/smartsheet/Cell.vue
  9. 295
      packages/nc-gui-v2/components/smartsheet/Grid.vue
  10. 2
      packages/nc-gui-v2/composables/useGridViewColumnWidth.ts
  11. 250
      packages/nc-gui-v2/composables/useViewData.ts
  12. 37
      packages/nc-gui-v2/package-lock.json
  13. 1
      packages/nc-gui-v2/package.json
  14. 47
      packages/nc-gui-v2/utils/iconUtils.ts
  15. 1
      packages/nc-gui-v2/utils/index.ts

50
packages/nc-gui-v2/components/cell/Checkbox.vue

@ -1,20 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { inject } from '#imports' import { inject } from '#imports'
import { ColumnInj, IsFormInj } from '~/context' import { ColumnInj, IsFormInj } from '~/context'
import MdiCheckBold from '~icons/mdi/check-bold' import { getMdiIcon } from '@/utils'
import MdiCropSquare from '~icons/mdi/crop-square'
import MdiCheckCircleOutline from '~icons/mdi/check-circle-outline'
import MdiCheckboxBlankCircleOutline from '~icons/mdi/checkbox-blank-circle-outline'
import MdiStar from '~icons/mdi/star'
import MdiStarOutline from '~icons/mdi/star-outline'
import MdiHeart from '~icons/mdi/heart'
import MdiHeartOutline from '~icons/mdi/heart-outline'
import MdiMoonFull from '~icons/mdi/moon-full'
import MdiMoonNew from '~icons/mdi/moon-new'
import MdiThumbUp from '~icons/mdi/thumb-up'
import MdiThumbUpOutline from '~icons/mdi/thumb-up-outline'
import MdiFlag from '~icons/mdi/flag'
import MdiFlagOutline from '~icons/mdi/flag-outline'
interface Props { interface Props {
modelValue?: boolean | undefined | number modelValue?: boolean | undefined | number
@ -42,46 +29,13 @@ const checkboxMeta = $computed(() => {
...(column?.meta || {}), ...(column?.meta || {}),
} }
}) })
const icon = (type: string) => {
switch (type) {
case 'mdi-check-bold':
return MdiCheckBold
case 'mdi-crop-square':
return MdiCropSquare
case 'mdi-check-circle-outline':
return MdiCheckCircleOutline
case 'mdi-checkbox-blank-circle-outline':
return MdiCheckboxBlankCircleOutline
case 'mdi-star':
return MdiStar
case 'mdi-star-outline':
return MdiStarOutline
case 'mdi-heart':
return MdiHeart
case 'mdi-heart-outline':
return MdiHeartOutline
case 'mdi-moon-full':
return MdiMoonFull
case 'mdi-moon-new':
return MdiMoonNew
case 'mdi-thumb-up':
return MdiThumbUp
case 'mdi-thumb-up-outline':
return MdiThumbUpOutline
case 'mdi-flag':
return MdiFlag
case 'mdi-flag-outline':
return MdiFlagOutline
}
}
</script> </script>
<template> <template>
<div class="flex" :class="{ 'justify-center': !isForm, 'nc-cell-hover-show': !vModel }"> <div class="flex" :class="{ 'justify-center': !isForm, 'nc-cell-hover-show': !vModel }">
<div class="px-1 pt-1 rounded-full items-center" :class="{ 'bg-gray-100': !vModel }" @click="vModel = !vModel"> <div class="px-1 pt-1 rounded-full items-center" :class="{ 'bg-gray-100': !vModel }" @click="vModel = !vModel">
<component <component
:is="icon(vModel ? checkboxMeta.icon.checked : checkboxMeta.icon.unchecked)" :is="getMdiIcon(vModel ? checkboxMeta.icon.checked : checkboxMeta.icon.unchecked)"
:style="{ :style="{
color: checkboxMeta.color, color: checkboxMeta.color,
}" }"

2
packages/nc-gui-v2/components/cell/Integer.vue

@ -16,7 +16,7 @@ const emits = defineEmits<Emits>()
const editEnabled = inject(EditModeInj, ref(false)) const editEnabled = inject(EditModeInj, ref(false))
const vModel = useVModel(props, 'modelValue', emit) const vModel = useVModel(props, 'modelValue', emits)
const focus = (el: HTMLInputElement) => el?.focus() const focus = (el: HTMLInputElement) => el?.focus()

3
packages/nc-gui-v2/components/smartsheet-column/EditOrAdd.vue

@ -90,6 +90,7 @@ watchEffect(() => {
<SmartsheetColumnFormulaOptions v-if="formState.uidt === UITypes.Formula" /> <SmartsheetColumnFormulaOptions v-if="formState.uidt === UITypes.Formula" />
<SmartsheetColumnCurrencyOptions v-if="formState.uidt === UITypes.Currency" /> <SmartsheetColumnCurrencyOptions v-if="formState.uidt === UITypes.Currency" />
<SmartsheetColumnDurationOptions v-if="formState.uidt === UITypes.Duration" /> <SmartsheetColumnDurationOptions v-if="formState.uidt === UITypes.Duration" />
<SmartsheetColumnRatingOptions v-if="formState.uidt === UITypes.Rating" />
<div> <div>
<div <div
@ -118,7 +119,7 @@ watchEffect(() => {
<!-- Cancel --> <!-- Cancel -->
{{ $t('general.cancel') }} {{ $t('general.cancel') }}
</a-button> </a-button>
<a-button html-type="submit" type="primary" size="small" @click="addOrUpdate(reloadMeta)"> <a-button html-type="submit" type="primary" size="small" @click="addOrUpdate(reloadMeta), (advancedOptions = false)">
<!-- Save --> <!-- Save -->
{{ $t('general.save') }} {{ $t('general.save') }}
</a-button> </a-button>

93
packages/nc-gui-v2/components/smartsheet-column/RatingOptions.vue

@ -0,0 +1,93 @@
<script setup lang="ts">
import { Sketch } from '@ckpack/vue-color'
import { useColumnCreateStoreOrThrow } from '#imports'
import { enumColor, getMdiIcon } from '@/utils'
const { formState, validateInfos, setAdditionalValidations, sqlUi, onDataTypeChange, onAlter } = useColumnCreateStoreOrThrow()
// cater existing v1 cases
const iconList = [
{
full: 'mdi-star',
empty: 'mdi-star-outline',
},
{
full: 'mdi-heart',
empty: 'mdi-heart-outline',
},
{
full: 'mdi-moon-full',
empty: 'mdi-moon-new',
},
{
full: 'mdi-thumb-up',
empty: 'mdi-thumb-up-outline',
},
{
full: 'mdi-flag',
empty: 'mdi-flag-outline',
},
]
const advanced = ref(true)
const picked = ref(formState.value.meta.color || enumColor.light[0])
</script>
<template>
<a-row>
<a-col :span="12">
<a-form-item label="Icon">
<a-select v-model:value="formState.meta.icon" size="small" class="w-52">
<!-- FIXME: antdv doesn't support object as value -->
<a-select-option v-for="(icon, i) of iconList" :key="i" :value="icon">
<component
:is="getMdiIcon(icon.full)"
:style="{
color: formState.meta.color,
}"
/>
{{ ' ' }}
<component
:is="getMdiIcon(icon.empty)"
:style="{
color: formState.meta.color,
}"
/>
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="Max">
<a-select v-model:value="formState.meta.max" class="w-52" size="small">
<a-select-option v-for="(v, i) in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]" :key="i" :value="v">
{{ v }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
</a-row>
<a-row>
<a-card class="w-full shadow-lg mt-2" body-style="padding: 0px">
<a-collapse v-model:activeKey="advanced" accordion ghost expand-icon-position="right">
<a-collapse-panel key="1" header="Advanced" class="">
<a-button class="!bg-primary text-white w-full" @click="formState.meta.color = picked.hex"> Pick Color </a-button>
<div class="px-7 py-3">
<Sketch v-model="picked" />
</div>
</a-collapse-panel>
</a-collapse>
</a-card>
</a-row>
</template>
<style scoped lang="scss">
.color-selector:hover {
@apply brightness-90;
}
.color-selector.selected {
@apply py-[5px] px-[10px] brightness-90;
}
</style>

65
packages/nc-gui-v2/components/smartsheet-header/Cell.vue

@ -6,74 +6,13 @@ import { ColumnInj, MetaInj } from '~/context'
import { useProvideColumnCreateStore } from '#imports' import { useProvideColumnCreateStore } from '#imports'
const { column } = defineProps<{ column: ColumnType & { meta: any } }>() const { column } = defineProps<{ column: ColumnType & { meta: any } }>()
provide(ColumnInj, column) provide(ColumnInj, column)
const meta = inject(MetaInj) const meta = inject(MetaInj)
// instantiate column update store // instantiate column update store
useProvideColumnCreateStore(meta as Ref<TableType>, column) useProvideColumnCreateStore(meta as Ref<TableType>, column)
/*
import { UITypes } from 'nocodb-sdk'
import cell from '@/components/project/spreadsheet/mixins/cell'
import EditColumn from '~/components/project/spreadsheet/components/EditColumn'
export default {
name: 'HeaderCell',
components: { EditColumn },
mixins: [cell],
props: [
'value',
'column',
'isForeignKey',
'meta',
'nodes',
'columnIndex',
'isForm',
'isPublicView',
'isVirtual',
'required',
'isLocked',
],
data: () => ({
editColumnMenu: false,
columnDeleteDialog: false,
}),
methods: {
showColumnEdit() {
if (this.column.uidt === UITypes.ID) {
return this.$toast.info('Primary key column edit is not allowed.').goAway(3000)
}
this.editColumnMenu = true
},
async deleteColumn() {
try {
const column = { ...this.column, cno: this.column.column_name }
column.altered = 4
const columns = this.meta.columns.slice()
columns[this.columnIndex] = column
await this.$api.dbTableColumn.delete(column.id)
this.$emit('colDelete')
this.$emit('saved')
this.columnDeleteDialog = false
} catch (e) {
console.log(e)
}
},
async setAsPrimaryValue() {
// todo: pass only updated fields
try {
await this.$api.dbTableColumn.primaryColumnSet(this.column.id)
this.$toast.success('Successfully updated as primary column').goAway(3000)
} catch (e) {
console.log(e)
this.$toast.error('Failed to update primary column').goAway(3000)
}
this.$emit('saved')
this.columnDeleteDialog = false
},
},
} */
</script> </script>
<template> <template>

50
packages/nc-gui-v2/components/smartsheet-header/Menu.vue

@ -1,10 +1,54 @@
<script lang="ts" setup> <script lang="ts" setup>
import { Modal } from 'ant-design-vue'
import { inject } from 'vue'
import { useI18n } from 'vue-i18n'
import { useToast } from 'vue-toastification'
import { useNuxtApp } from '#app'
import { useMetas } from '#imports'
import { ColumnInj, MetaInj } from '~/context'
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils'
import MdiEditIcon from '~icons/mdi/pencil' import MdiEditIcon from '~icons/mdi/pencil'
import MdiStarIcon from '~icons/mdi/star' import MdiStarIcon from '~icons/mdi/star'
import MdiDeleteIcon from '~icons/mdi/delete-outline' import MdiDeleteIcon from '~icons/mdi/delete-outline'
import MdiMenuDownIcon from '~icons/mdi/menu-down' import MdiMenuDownIcon from '~icons/mdi/menu-down'
const { virtual = false } = defineProps<{ virtual?: boolean }>()
const editColumnDropdown = $ref(false) const editColumnDropdown = $ref(false)
const column = inject(ColumnInj)
const meta = inject(MetaInj)
const { $api } = useNuxtApp()
const { t } = useI18n()
const toast = useToast()
const { getMeta } = useMetas()
const deleteColumn = () =>
Modal.confirm({
title: h('div', ['Do you want to delete ', h('span', { class: 'font-weight-bold' }, [column?.title]), ' column ?']),
okText: t('general.delete'),
okType: 'danger',
cancelText: t('general.cancel'),
async onOk() {
try {
await $api.dbTableColumn.delete(column?.id as string)
getMeta(meta?.value?.id as string, true)
} catch (e) {
toast.error(await extractSdkResponseErrorMsg(e))
}
},
})
const setAsPrimaryValue = async () => {
try {
await $api.dbTableColumn.primaryColumnSet(column?.id as string)
getMeta(meta?.value?.id as string, true)
toast.success('Successfully updated as primary column')
} catch (e) {
console.log(e)
toast.error('Failed to update primary column')
}
}
</script> </script>
<template> <template>
@ -18,12 +62,12 @@ const editColumnDropdown = $ref(false)
<MdiMenuDownIcon class="text-grey" /> <MdiMenuDownIcon class="text-grey" />
<template #overlay> <template #overlay>
<div class="shadow bg-white"> <div class="shadow bg-white">
<div class="nc-column-edit nc-menu-item" @click="editColumnDropdown = true"> <div v-if="!virtual" class="nc-column-edit nc-menu-item" @click="editColumnDropdown = true">
<MdiEditIcon class="text-primary" /> <MdiEditIcon class="text-primary" />
<!-- Edit --> <!-- Edit -->
{{ $t('general.edit') }} {{ $t('general.edit') }}
</div> </div>
<div v-t="['a:column:set-primary']" class="nc-menu-item"> <div v-if="!virtual" v-t="['a:column:set-primary']" class="nc-menu-item" @click="setAsPrimaryValue">
<MdiStarIcon class="text-primary" /> <MdiStarIcon class="text-primary" />
<!-- todo : tooltip --> <!-- todo : tooltip -->
@ -31,7 +75,7 @@ const editColumnDropdown = $ref(false)
{{ $t('activity.setPrimary') }} {{ $t('activity.setPrimary') }}
<!-- <span class="caption font-weight-bold">Primary value will be shown in place of primary key</span> --> <!-- <span class="caption font-weight-bold">Primary value will be shown in place of primary key</span> -->
</div> </div>
<div class="nc-column-delete nc-menu-item"> <div class="nc-column-delete nc-menu-item" @click="deleteColumn">
<MdiDeleteIcon class="text-error" /> <MdiDeleteIcon class="text-error" />
<!-- Delete --> <!-- Delete -->
{{ $t('general.delete') }} {{ $t('general.delete') }}

65
packages/nc-gui-v2/components/smartsheet-header/VirtualCell.vue

@ -145,71 +145,8 @@ provide(ColumnInj, column)
<!-- </v-tooltip> --> <!-- </v-tooltip> -->
<v-spacer /> <v-spacer />
<!--
todo: implement delete or edit column
<v-menu <SmartsheetHeaderMenu :virtual="true" />
v-if="!isLocked && !isVirtual && !isPublicView && _isUIAllowed('edit-column') && !isForm"
offset-y
open-on-hover
left
transition="slide-y-transition"
>
<template #activator="{ on }">
<v-icon v-if="!isLocked && !isForm" small v-on="on"> mdi-menu-down </v-icon>
</template>
<v-list dense>
<v-list-item dense @click="editColumnMenu = true">
<x-icon small class="mr-1 nc-column-edit" color="primary"> mdi-pencil </x-icon>
<span class="caption">
&lt;!&ndash; Edit &ndash;&gt;
{{ $t('general.edit') }}
</span>
</v-list-item>
<v-list-item @click="columnDeleteDialog = true">
<x-icon small class="mr-1 nc-column-delete" color="error"> mdi-delete-outline </x-icon>
<span class="caption">
&lt;!&ndash; Delete &ndash;&gt;
{{ $t('general.delete') }}
</span>
</v-list-item>
</v-list>
</v-menu>
<v-dialog v-model="columnDeleteDialog" max-width="500" persistent>
<v-card>
<v-card-title class="grey darken-2 subheading white&#45;&#45;text"> Confirm </v-card-title>
<v-divider />
<v-card-text class="mt-4 title">
Do you want to delete <span class="font-weight-bold">'{{ column.title }}'</span> column ?
</v-card-text>
<v-divider />
<v-card-actions class="d-flex pa-4">
<v-spacer />
<v-btn small @click="columnDeleteDialog = false">
&lt;!&ndash; Cancel &ndash;&gt;
{{ $t('general.cancel') }}
</v-btn>
<v-btn v-t="['a:column:delete']" small color="error" @click="deleteColumn"> Confirm </v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-menu v-model="editColumnMenu" offset-y content-class="" left transition="slide-y-transition">
<template #activator="{ on }">
<span v-on="on" />
</template>
<edit-virtual-column
v-if="editColumnMenu"
v-model="editColumnMenu"
:nodes="nodes"
:edit-column="true"
:column="column"
:meta="meta"
:sql-ui="sqlUi"
v-on="$listeners"
/>
</v-menu> -->
</div> </div>
</template> </template>

54
packages/nc-gui-v2/components/smartsheet/Cell.vue

@ -1,25 +1,71 @@
<script setup lang="ts"> <script setup lang="ts">
import { UITypes } from 'nocodb-sdk'
import type { ColumnType } from 'nocodb-sdk' import type { ColumnType } from 'nocodb-sdk'
import { provide } from 'vue' import { provide } from 'vue'
import { useColumn, useVModel } from '#imports' import { computed, useColumn, useDebounceFn, useVModel } from '#imports'
import { ColumnInj } from '~/context' import { ColumnInj } from '~/context'
interface Props { interface Props {
column: ColumnType column: ColumnType
modelValue: any modelValue: any
editEnabled: boolean
} }
interface Emits { interface Emits {
(event: 'update:modelValue', value: any): void (event: 'update:modelValue', value: any): void
} }
const { column, ...rest } = defineProps<Props>() const { column, editEnabled, ...rest } = defineProps<Props>()
const emit = defineEmits<Emits>() const emit = defineEmits(['update:modelValue', 'save'])
provide(ColumnInj, column) provide(ColumnInj, column)
const vModel = useVModel(rest, 'modelValue', emit) provide(
'editEnabled',
computed(() => editEnabled),
)
let changed = $ref(false)
const syncValue = useDebounceFn(function () {
emit('save')
}, 1000)
const isAutoSaved = $computed(() => {
return [
UITypes.SingleLineText,
UITypes.LongText,
UITypes.PhoneNumber,
UITypes.Email,
UITypes.URL,
UITypes.Number,
UITypes.Decimal,
UITypes.Percent,
UITypes.Count,
UITypes.AutoNumber,
UITypes.SpecificDBType,
UITypes.Geometry,
].includes(column.uidt as UITypes)
})
const isManualSaved = $computed(() => {
return [UITypes.Currency, UITypes.Year, UITypes.Time, UITypes.Duration].includes(column.uidt as UITypes)
})
const vModel = computed({
get: () => rest.modelValue,
set: (val) => {
if (val !== rest.modelValue) {
changed = true
emit('update:modelValue', val)
if (isAutoSaved) {
syncValue()
} else if (!isManualSaved) {
emit('save')
}
}
},
})
const { const {
isURL, isURL,

295
packages/nc-gui-v2/components/smartsheet/Grid.vue

@ -1,12 +1,14 @@
<script lang="ts" setup> <script lang="ts" setup>
import { isVirtualCol } from 'nocodb-sdk' import { ColumnType, isVirtualCol } from 'nocodb-sdk'
import { import {
Row,
inject, inject,
onKeyStroke, onKeyStroke,
onMounted, onMounted,
provide, provide,
useGridViewColumnWidth, useGridViewColumnWidth,
useProvideColumnCreateStore, useProvideColumnCreateStore,
useSmartsheetStoreOrThrow,
useViewData, useViewData,
} from '#imports' } from '#imports'
import { import {
@ -16,36 +18,55 @@ import {
FieldsInj, FieldsInj,
IsFormInj, IsFormInj,
IsGridInj, IsGridInj,
IsLockedInj,
MetaInj, MetaInj,
PaginationDataInj, PaginationDataInj,
ReloadViewDataHookInj, ReloadViewDataHookInj,
} from '~/context' } from '~/context'
import MdiPlusIcon from '~icons/mdi/plus' import MdiPlusIcon from '~icons/mdi/plus'
import MdiArrowExpandIcon from '~icons/mdi/arrow-expand'
const meta = inject(MetaInj) const meta = inject(MetaInj)
const view = inject(ActiveViewInj) const view = inject(ActiveViewInj)
// keep a root fields variable and will get modified from // keep a root fields variable and will get modified from
// fields menu and get used in grid and gallery // fields menu and get used in grid and gallery
const fields = inject(FieldsInj) const fields = inject(FieldsInj, ref([]))
const isLocked = inject(IsLockedInj, false)
// todo: get from parent ( inject or use prop ) // todo: get from parent ( inject or use prop )
const isPublicView = false const isPublicView = false
const selected = reactive<{ row?: number | null; col?: number | null }>({}) const selected = reactive<{ row: number | null; col: number | null }>({ row: null, col: null })
const editEnabled = ref(false) let editEnabled = $ref(false)
const { sqlUi } = useProject() const { sqlUi } = useProject()
const { xWhere } = useSmartsheetStoreOrThrow() const { xWhere } = useSmartsheetStoreOrThrow()
const addColumnDropdown = ref(false) const addColumnDropdown = ref(false)
const contextMenu = ref(false)
const contextMenuTarget = ref(false)
const visibleColLength = $computed(() => {
const cols = fields.value
return cols.filter((col) => !isVirtualCol(col)).length
})
const { loadData, paginationData, formattedData: data, updateRowProperty, changePage } = useViewData(meta, view as any, xWhere) const {
const { loadGridViewColumns, updateWidth, resizingColWidth, resizingCol } = useGridViewColumnWidth(view) loadData,
paginationData,
formattedData: data,
updateOrSaveRow,
changePage,
addEmptyRow,
deleteRow,
deleteSelectedRows,
selectedAllRecords,
} = useViewData(meta, view as any, xWhere)
const { loadGridViewColumns, updateWidth, resizingColWidth, resizingCol } = useGridViewColumnWidth(view as any)
onMounted(loadGridViewColumns) onMounted(loadGridViewColumns)
provide(IsFormInj, false) provide(IsFormInj, false)
provide(IsGridInj, true) provide(IsGridInj, true)
provide(PaginationDataInj, paginationData) provide(PaginationDataInj, paginationData)
provide(ChangePageInj, changePage)
provide(EditModeInj, editEnabled) provide(EditModeInj, editEnabled)
provide(ChangePageInj, changePage)
const reloadViewDataHook = inject(ReloadViewDataHookInj) const reloadViewDataHook = inject(ReloadViewDataHookInj)
reloadViewDataHook?.on(() => { reloadViewDataHook?.on(() => {
@ -59,7 +80,7 @@ const selectCell = (row: number, col: number) => {
onKeyStroke(['Enter'], (e) => { onKeyStroke(['Enter'], (e) => {
if (selected.row !== null && selected.col !== null) { if (selected.row !== null && selected.col !== null) {
editEnabled.value = true editEnabled = true
} }
}) })
@ -89,75 +110,200 @@ defineExpose({
// watchEffect(() => { // watchEffect(() => {
if (meta) useProvideColumnCreateStore(meta) if (meta) useProvideColumnCreateStore(meta)
// }) // })
// reset context menu target on hide
watch(contextMenu, () => {
if (!contextMenu.value) {
contextMenuTarget.value = false
}
})
const clearCell = async (ctx: { row: number; col: number }) => {
const rowObj = data.value[ctx.row]
const columnObj = fields.value[ctx.col]
if (isVirtualCol(columnObj)) {
return
}
rowObj.row[columnObj.title] = null
// update/save cell value
await updateOrSaveRow(rowObj, columnObj.title)
}
/** handle keypress events */
onKeyStroke(['Tab', 'Shift', 'Enter', 'Delete', 'ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'], async (e: KeyboardEvent) => {
if (selected.row !== null && selected.col !== null) {
/** on tab key press navigate through cells */
switch (e.key) {
case 'Tab':
e.preventDefault()
if (e.shiftKey) {
if (selected.col > 0) {
selected.col--
} else if (selected.row > 0) {
selected.row--
selected.col = visibleColLength - 1
}
} else {
if (selected.col < visibleColLength - 1) {
selected.col++
} else if (selected.row < data.value.length - 1) {
selected.row++
selected.col = 0
}
}
break
/** on enter key press make cell editable */
case 'Enter':
e.preventDefault()
editEnabled = true
break
/** on delete key press clear cell */
case 'Delete':
e.preventDefault()
await clearCell(selected as { row: number; col: number })
break
/** on arrow key press navigate through cells */
case 'ArrowRight':
e.preventDefault()
if (selected.col < visibleColLength - 1) selected.col++
break
case 'ArrowLeft':
e.preventDefault()
if (selected.col > 0) selected.col--
break
case 'ArrowUp':
e.preventDefault()
if (selected.row > 0) selected.row--
break
case 'ArrowDown':
e.preventDefault()
if (selected.row < data.value.length - 1) selected.row++
break
}
}
})
</script> </script>
<template> <template>
<div class="flex flex-col h-100 min-h-0 w-100"> <div class="flex flex-col h-100 min-h-0 w-100">
<div class="nc-grid-wrapper min-h-0 flex-1 scrollbar-thin-primary"> <div class="nc-grid-wrapper min-h-0 flex-1 scrollbar-thin-primary">
<table class="xc-row-table nc-grid backgroundColorDefault"> <a-dropdown v-model:visible="contextMenu" :trigger="['contextmenu']">
<thead> <table class="xc-row-table nc-grid backgroundColorDefault" @contextmenu.prevent="contextMenu = true">
<tr> <thead>
<th>#</th> <tr class="group">
<th <th>
v-for="col in fields" <div class="flex align-center w-[80px]">
:key="col.title" <div class="group-hover:hidden" :class="{ hidden: selectedAllRecords }">#</div>
v-xc-ver-resize <div
:data-col="col.id" :class="{ hidden: !selectedAllRecords, flex: selectedAllRecords }"
@xcresize="onresize(col.id, $event)" class="group-hover:flex w-full align-center"
@xcresizing="onXcResizing(col.title, $event)" >
@xcresized="resizingCol = null" <a-checkbox v-model:checked="selectedAllRecords" />
> <span class="flex-1" />
<SmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" /> </div>
<SmartsheetHeaderCell v-else :column="col" /> </div>
</th> </th>
<!-- v-if="!isLocked && !isVirtual && !isPublicView && _isUIAllowed('add-column')" --> <th
<th v-t="['c:column:add']" @click="addColumnDropdown = true"> v-for="col in fields"
<a-dropdown v-model:visible="addColumnDropdown" :trigger="['click']"> :key="col.title"
<div class="h-full w-full flex align-center justify-center"> v-xc-ver-resize
<MdiPlusIcon class="text-sm" /> :data-col="col.id"
@xcresize="onresize(col.id, $event)"
@xcresizing="onXcResizing(col.title, $event)"
@xcresized="resizingCol = null"
>
<SmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" />
<SmartsheetHeaderCell v-else :column="col" />
</th>
<!-- v-if="!isLocked && !isVirtual && !isPublicView && _isUIAllowed('add-column')" -->
<th v-t="['c:column:add']" @click="addColumnDropdown = true">
<a-dropdown v-model:visible="addColumnDropdown" :trigger="['click']">
<div class="h-full w-full flex align-center justify-center">
<MdiPlusIcon class="text-sm" />
</div>
<template #overlay>
<SmartsheetColumnEditOrAdd @click.stop @cancel="addColumnDropdown = false" />
</template>
</a-dropdown>
</th>
</tr>
</thead>
<tbody>
<tr v-for="(row, rowIndex) in data" :key="rowIndex" class="nc-grid-row group">
<td key="row-index" class="caption nc-grid-cell">
<div class="align-center flex w-[80px]">
<div class="group-hover:hidden" :class="{ hidden: row.rowMeta.selected }">{{ rowIndex + 1 }}</div>
<div
:class="{ hidden: !row.rowMeta.selected, flex: row.rowMeta.selected }"
class="group-hover:flex w-full align-center"
>
<a-checkbox v-model:checked="row.rowMeta.selected" />
<span class="flex-1" />
<MdiArrowExpandIcon class="text-sm text-pink hidden group-hover:inline-block" />
</div>
</div> </div>
<template #overlay> </td>
<SmartsheetColumnEditOrAdd @click.stop @cancel="addColumnDropdown = false" /> <td
</template> v-for="(columnObj, colIndex) in fields"
</a-dropdown> :key="rowIndex + columnObj.title"
</th> class="cell pointer nc-grid-cell"
</tr> :class="{
</thead> active: !isPublicView && selected.col === colIndex && selected.row === rowIndex,
<tbody> }"
<tr v-for="({ row }, rowIndex) in data" :key="rowIndex" class="nc-grid-row"> :data-col="columnObj.id"
<td key="row-index" style="width: 65px" class="caption nc-grid-cell"> @click="selectCell(rowIndex, colIndex)"
<div class="d-flex align-center"> @dblclick="editEnabled = true"
{{ rowIndex + 1 }} @contextmenu="contextMenuTarget = { row: rowIndex, col: colIndex }"
</div> >
</td> <SmartsheetVirtualCell v-if="isVirtualCol(columnObj)" v-model="row.row[columnObj.title]" :column="columnObj" />
<td
v-for="(columnObj, colIndex) in fields" <SmartsheetCell
:key="rowIndex + columnObj.title" v-else
class="cell pointer nc-grid-cell" v-model="row.row[columnObj.title]"
:class="{ :column="columnObj"
active: !isPublicView && selected.col === colIndex && selected.row === rowIndex, :edit-enabled="editEnabled && selected.col === colIndex && selected.row === rowIndex"
// 'primary-column': primaryValueColumn === columnObj.title, @save="updateOrSaveRow(row, columnObj.title)"
// 'text-center': isCentrallyAligned(columnObj), />
// 'required': isRequired(columnObj, rowObj), </td>
}" </tr>
:data-col="columnObj.id"
@click="selectCell(rowIndex, colIndex)" <tr v-if="!isLocked">
@dblclick="editEnabled = true" <td
> v-t="['c:row:add:grid-bottom']"
<SmartsheetVirtualCell v-if="isVirtualCol(columnObj)" v-model="row[columnObj.title]" :column="columnObj" /> :colspan="visibleColLength + 1"
class="text-left pointer nc-grid-add-new-cell"
<SmartsheetCell @click="addEmptyRow()"
v-else >
v-model="row[columnObj.title]" <a-tooltip top left>
:column="columnObj" <div class="w-min flex align-center">
:edit-enabled="editEnabled && selected.col === colIndex && selected.row === rowIndex" <MdiPlusIcon class="text-pint-500 text-xs" />
@update:model-value="updateRowProperty(row, columnObj.title)" <span class="ml-1 caption grey--text">
/> {{ $t('activity.addRow') }}
</td> </span>
</tr> </div>
</tbody> <template #title>
</table> <span class="caption"> Add new row</span>
</template>
</a-tooltip>
</td>
</tr>
</tbody>
</table>
<template #overlay>
<div class="bg-white shadow" @click="contextMenu = false">
<div v-if="contextMenuTarget" class="nc-menu-item" @click="deleteRow(contextMenuTarget.row)">Delete row</div>
<div class="nc-menu-item" @click="deleteSelectedRows">Delete all selected rows</div>
<div v-if="contextMenuTarget" class="nc-menu-item" @click="clearCell(contextMenuTarget)">Clear cell</div>
<div v-if="contextMenuTarget" class="nc-menu-item" @click="addEmptyRow(contextMenuTarget.row + 1)">
Insert new row
</div>
</div>
</template>
</a-dropdown>
</div> </div>
<SmartsheetPagination /> <SmartsheetPagination />
</div> </div>
</template> </template>
@ -175,6 +321,11 @@ if (meta) useProvideColumnCreateStore(meta)
height: 41px !important; height: 41px !important;
position: relative; position: relative;
padding: 0 5px; padding: 0 5px;
& > * {
@apply flex align-center h-auto;
}
overflow: hidden; overflow: hidden;
} }
@ -186,8 +337,6 @@ if (meta) useProvideColumnCreateStore(meta)
border-bottom: 1px solid #7f828b33 !important; border-bottom: 1px solid #7f828b33 !important;
border-top: 1px solid #7f828b33 !important; border-top: 1px solid #7f828b33 !important;
border-collapse: collapse; border-collapse: collapse;
font-size: 0.8rem;
} }
td { td {

2
packages/nc-gui-v2/composables/useGridViewColumnWidth.ts

@ -19,7 +19,7 @@ export function useGridViewColumnWidth(view: Ref<(GridType & { id?: string }) |
watch( watch(
// todo : update type in swagger // todo : update type in swagger
() => [gridViewCols, resizingCol, resizingColWidth], () => [gridViewCols, resizingCol, resizingColWidth, columns],
() => { () => {
let style = '' let style = ''
for (const c of columns?.value || []) { for (const c of columns?.value || []) {

250
packages/nc-gui-v2/composables/useViewData.ts

@ -1,8 +1,10 @@
import type { Api, PaginatedType, TableType, ViewType } from 'nocodb-sdk' import type { Api, PaginatedType, TableType, ViewType } from 'nocodb-sdk'
import type { ComputedRef, Ref } from 'vue' import type { ComputedRef, Ref } from 'vue'
import { notification } from 'ant-design-vue'
import { useNuxtApp } from '#app' import { useNuxtApp } from '#app'
import { useProject } from '#imports' import { useProject } from '#imports'
import { NOCO } from '~/lib' import { NOCO } from '~/lib'
import { extractSdkResponseErrorMsg } from '~/utils'
const formatData = (list: Record<string, any>[]) => const formatData = (list: Record<string, any>[]) =>
list.map((row) => ({ list.map((row) => ({
@ -11,95 +13,227 @@ const formatData = (list: Record<string, any>[]) =>
rowMeta: {}, rowMeta: {},
})) }))
export interface Row {
row: Record<string, any>
oldRow: Record<string, any>
rowMeta?: any
}
export function useViewData( export function useViewData(
meta: Ref<TableType> | ComputedRef<TableType> | undefined, meta: Ref<TableType> | ComputedRef<TableType> | undefined,
viewMeta: Ref<ViewType & { id: string }> | ComputedRef<ViewType & { id: string }> | undefined, viewMeta: Ref<ViewType & { id: string }> | ComputedRef<ViewType & { id: string }> | undefined,
where?: ComputedRef<string | undefined>, where?: ComputedRef<string | undefined>,
) { ) {
const data = ref<Record<string, any>[]>() const formattedData = ref<Row[]>([])
const formattedData = ref<{ row: Record<string, any>; oldRow: Record<string, any>; rowMeta?: any }[]>()
const paginationData = ref<PaginatedType>({ page: 1, pageSize: 25 }) const paginationData = ref<PaginatedType>({ page: 1, pageSize: 25 })
const { project } = useProject() const { project } = useProject()
const { $api } = useNuxtApp() const { $api } = useNuxtApp()
const selectedAllRecords = computed({
get() {
return formattedData.value.every((row) => row.rowMeta.selected)
},
set(selected) {
formattedData.value.forEach((row) => (row.rowMeta.selected = selected))
},
})
const loadData = async (params: Parameters<Api<any>['dbViewRow']['list']>[4] = {}) => { const loadData = async (params: Parameters<Api<any>['dbViewRow']['list']>[4] = {}) => {
if (!project?.value?.id || !meta?.value?.id || !viewMeta?.value?.id) return if (!project?.value?.id || !meta?.value?.id || !viewMeta?.value?.id) return
const response = await $api.dbViewRow.list('noco', project.value.id, meta.value.id, viewMeta.value.id, { const response = await $api.dbViewRow.list('noco', project.value.id, meta.value.id, viewMeta.value.id, {
...params, ...params,
where: where?.value, where: where?.value,
}) })
data.value = response.list
formattedData.value = formatData(response.list) formattedData.value = formatData(response.list)
paginationData.value = response.pageInfo paginationData.value = response.pageInfo
} }
const insertRow = async (row: Record<string, any>, rowIndex = formattedData.value?.length) => {
try {
const insertObj = meta?.value?.columns?.reduce((o: any, col) => {
if (!col.ai && row?.[col.title as string] !== null) {
o[col.title as string] = row?.[col.title as string]
}
return o
}, {})
const insertedData = await $api.dbViewRow.create(
NOCO,
project?.value.id as string,
meta?.value.id as string,
viewMeta?.value?.id as string,
insertObj,
)
formattedData.value?.splice(rowIndex ?? 0, 1, {
row: insertedData,
rowMeta: {},
oldRow: { ...insertedData },
})
} catch (error: any) {
notification.error({
message: 'Row insert failed',
description: await extractSdkResponseErrorMsg(error),
})
}
}
const updateRowProperty = async (row: Record<string, any>, property: string) => { const updateRowProperty = async (row: Record<string, any>, property: string) => {
const id = meta?.value?.columns try {
?.filter((c) => c.pk) const id = meta?.value?.columns
.map((c) => row[c.title as string]) ?.filter((c) => c.pk)
.join('___') as string .map((c) => row[c.title as string])
.join('___') as string
return $api.dbViewRow.update(
NOCO, return $api.dbViewRow.update(
project?.value.id as string, NOCO,
project?.value.id as string,
meta?.value.id as string,
viewMeta?.value?.id as string,
id,
{
[property]: row[property],
},
// todo:
// {
// query: { ignoreWebhook: !saved }
// }
)
/*
todo: audit
// audit
this.$api.utils
.auditRowUpdate(id, {
fk_model_id: this.meta.id,
column_name: column.title,
row_id: id,
value: getPlainText(rowObj[column.title]),
prev_value: getPlainText(oldRow[column.title])
})
.then(() => {})
*/
} catch (error: any) {
notification.error({
message: 'Row update failed',
description: await extractSdkResponseErrorMsg(error),
})
}
}
const updateOrSaveRow = async (row: Row, property: string) => {
if (row.rowMeta.new) {
await insertRow(row.row, formattedData.value.indexOf(row))
} else {
await updateRowProperty(row.row, property)
}
}
const changePage = async (page: number) => {
paginationData.value.page = page
await loadData({ offset: (page - 1) * (paginationData.value.pageSize || 25), where: where?.value } as any)
}
const addEmptyRow = (addAfter = formattedData.value.length) => {
formattedData.value.splice(addAfter, 0, {
row: {},
oldRow: {},
rowMeta: { new: true },
})
}
const deleteRowById = async (id: string) => {
if (!id) {
throw new Error("Delete not allowed for table which doesn't have primary Key")
}
const res: any = await $api.dbViewRow.delete(
'noco',
project.value.id as string,
meta?.value.id as string, meta?.value.id as string,
viewMeta?.value?.id as string, viewMeta?.value.id as string,
id, id,
{
[property]: row[property],
},
// todo:
// {
// query: { ignoreWebhook: !saved }
// }
) )
/* if (res.message) {
notification.info({
todo: audit message: 'Row delete failed',
description: h('div', {
// audit innerHTML: `<div style="padding:10px 4px">Unable to delete row with ID ${id} because of the following:
this.$api.utils <br><br>${res.message.join('<br>')}<br><br>
.auditRowUpdate(id, { Clear the data first & try again</div>`,
fk_model_id: this.meta.id, }),
column_name: column.title, })
row_id: id, return false
value: getPlainText(rowObj[column.title]), }
prev_value: getPlainText(oldRow[column.title])
}) return true
.then(() => {})
*/
} }
const insertRow = async (row: Record<string, any>, rowIndex = formattedData.value?.length) => {
// todo: implement insert row
const insertObj = meta?.value?.columns?.reduce((o: any, col) => { const deleteRow = async (rowIndex: number) => {
if (!col.ai && row?.[col.title as string] !== null) { try {
o[col.title as string] = row?.[col.title as string] const row = formattedData.value[rowIndex]
if (!row.rowMeta.new) {
const id = meta?.value?.columns
?.filter((c) => c.pk)
.map((c) => row.row[c.title as any])
.join('___')
const deleted = await deleteRowById(id as string)
if (!deleted) {
return
}
} }
return o formattedData.value.splice(rowIndex, 1)
}, {}) } catch (e: any) {
notification.error({
message: 'Failed to delete row',
description: await extractSdkResponseErrorMsg(e),
})
}
}
const insertedData = await $api.dbViewRow.create( const deleteSelectedRows = async () => {
NOCO, let row = formattedData.value.length
project?.value.id as string, while (row--) {
meta?.value.id as string, try {
viewMeta?.value?.id as string, const { row: rowObj, rowMeta } = formattedData.value[row]
insertObj, if (!rowMeta.selected) {
) continue
}
if (!rowMeta.new) {
const id = meta?.value?.columns
?.filter((c) => c.pk)
.map((c) => rowObj[c.title as string])
.join('___')
formattedData.value?.splice(rowIndex ?? 0, 1, { const successfulDeletion = await deleteRowById(id as string)
row: insertedData, if (!successfulDeletion) {
rowMeta: {}, continue
oldRow: { ...insertedData }, }
}) }
formattedData.value.splice(row, 1)
} catch (e: any) {
return notification.error({
message: 'Failed to delete row',
description: await extractSdkResponseErrorMsg(e),
})
}
}
} }
const changePage = async (page: number) => { return {
paginationData.value.page = page loadData,
await loadData({ offset: (page - 1) * (paginationData.value.pageSize || 25), where: where?.value } as any) paginationData,
formattedData,
insertRow,
updateRowProperty,
changePage,
addEmptyRow,
deleteRow,
deleteSelectedRows,
updateOrSaveRow,
selectedAllRecords,
} }
return { data, loadData, paginationData, formattedData, insertRow, updateRowProperty, changePage }
} }

37
packages/nc-gui-v2/package-lock.json generated

@ -5,6 +5,7 @@
"packages": { "packages": {
"": { "": {
"dependencies": { "dependencies": {
"@ckpack/vue-color": "^1.2.0",
"@vueuse/core": "^9.0.2", "@vueuse/core": "^9.0.2",
"@vueuse/integrations": "^9.0.2", "@vueuse/integrations": "^9.0.2",
"ant-design-vue": "^3.2.10", "ant-design-vue": "^3.2.10",
@ -859,6 +860,22 @@
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@ckpack/vue-color": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@ckpack/vue-color/-/vue-color-1.2.0.tgz",
"integrity": "sha512-c9X82nppYjSxjlITO6jdLLdt9HoyZzqEWpqDL2V6NJd859d6GCh/2AHeRXk+37uRJ1UdTkCuty93WOEqja8quw==",
"dependencies": {
"@ctrl/tinycolor": "^3.4.0",
"lodash-es": "^4.17.21",
"material-colors": "^1.2.6"
},
"engines": {
"node": ">=12"
},
"peerDependencies": {
"vue": "^3.2.0"
}
},
"node_modules/@cloudflare/kv-asset-handler": { "node_modules/@cloudflare/kv-asset-handler": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.2.0.tgz", "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.2.0.tgz",
@ -9325,6 +9342,11 @@
"semver": "bin/semver.js" "semver": "bin/semver.js"
} }
}, },
"node_modules/material-colors": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz",
"integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg=="
},
"node_modules/mdast-util-from-markdown": { "node_modules/mdast-util-from-markdown": {
"version": "0.8.5", "version": "0.8.5",
"resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz", "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz",
@ -15371,6 +15393,16 @@
"to-fast-properties": "^2.0.0" "to-fast-properties": "^2.0.0"
} }
}, },
"@ckpack/vue-color": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@ckpack/vue-color/-/vue-color-1.2.0.tgz",
"integrity": "sha512-c9X82nppYjSxjlITO6jdLLdt9HoyZzqEWpqDL2V6NJd859d6GCh/2AHeRXk+37uRJ1UdTkCuty93WOEqja8quw==",
"requires": {
"@ctrl/tinycolor": "^3.4.0",
"lodash-es": "^4.17.21",
"material-colors": "^1.2.6"
}
},
"@cloudflare/kv-asset-handler": { "@cloudflare/kv-asset-handler": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.2.0.tgz", "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.2.0.tgz",
@ -21702,6 +21734,11 @@
} }
} }
}, },
"material-colors": {
"version": "1.2.6",
"resolved": "https://registry.npmjs.org/material-colors/-/material-colors-1.2.6.tgz",
"integrity": "sha512-6qE4B9deFBIa9YSpOc9O0Sgc43zTeVYbgDT5veRKSlB2+ZuHNoVVxA1L/ckMUayV9Ay9y7Z/SZCLcGteW9i7bg=="
},
"mdast-util-from-markdown": { "mdast-util-from-markdown": {
"version": "0.8.5", "version": "0.8.5",
"resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz", "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz",

1
packages/nc-gui-v2/package.json

@ -11,6 +11,7 @@
"coverage": "vitest -c test/vite.config.ts run --coverage" "coverage": "vitest -c test/vite.config.ts run --coverage"
}, },
"dependencies": { "dependencies": {
"@ckpack/vue-color": "^1.2.0",
"@vueuse/core": "^9.0.2", "@vueuse/core": "^9.0.2",
"@vueuse/integrations": "^9.0.2", "@vueuse/integrations": "^9.0.2",
"ant-design-vue": "^3.2.10", "ant-design-vue": "^3.2.10",

47
packages/nc-gui-v2/utils/iconUtils.ts

@ -0,0 +1,47 @@
import MdiCheckBold from '~icons/mdi/check-bold'
import MdiCropSquare from '~icons/mdi/crop-square'
import MdiCheckCircleOutline from '~icons/mdi/check-circle-outline'
import MdiCheckboxBlankCircleOutline from '~icons/mdi/checkbox-blank-circle-outline'
import MdiStar from '~icons/mdi/star'
import MdiStarOutline from '~icons/mdi/star-outline'
import MdiHeart from '~icons/mdi/heart'
import MdiHeartOutline from '~icons/mdi/heart-outline'
import MdiMoonFull from '~icons/mdi/moon-full'
import MdiMoonNew from '~icons/mdi/moon-new'
import MdiThumbUp from '~icons/mdi/thumb-up'
import MdiThumbUpOutline from '~icons/mdi/thumb-up-outline'
import MdiFlag from '~icons/mdi/flag'
import MdiFlagOutline from '~icons/mdi/flag-outline'
export const getMdiIcon = (type: string) => {
switch (type) {
case 'mdi-check-bold':
return MdiCheckBold
case 'mdi-crop-square':
return MdiCropSquare
case 'mdi-check-circle-outline':
return MdiCheckCircleOutline
case 'mdi-checkbox-blank-circle-outline':
return MdiCheckboxBlankCircleOutline
case 'mdi-star':
return MdiStar
case 'mdi-star-outline':
return MdiStarOutline
case 'mdi-heart':
return MdiHeart
case 'mdi-heart-outline':
return MdiHeartOutline
case 'mdi-moon-full':
return MdiMoonFull
case 'mdi-moon-new':
return MdiMoonNew
case 'mdi-thumb-up':
return MdiThumbUp
case 'mdi-thumb-up-outline':
return MdiThumbUpOutline
case 'mdi-flag':
return MdiFlag
case 'mdi-flag-outline':
return MdiFlagOutline
}
}

1
packages/nc-gui-v2/utils/index.ts

@ -5,6 +5,7 @@ export * from './formulaUtils'
export * from './durationUtils' export * from './durationUtils'
export * from './errorUtils' export * from './errorUtils'
export * from './fileUtils' export * from './fileUtils'
export * from './iconUtils'
export * from './filterUtils' export * from './filterUtils'
export * from './generateName' export * from './generateName'
export * from './projectCreateUtils' export * from './projectCreateUtils'

Loading…
Cancel
Save