Browse Source

Merge pull request #6557 from nocodb/nc-fix/ui-misc

Nc fix/UI misc
pull/6559/head
Sreehari jayaraj 1 year ago committed by GitHub
parent
commit
6b53b7b619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      packages/nc-gui/assets/nc-icons/project.svg
  2. 12
      packages/nc-gui/assets/nc-icons/record.svg
  3. 4
      packages/nc-gui/components/dashboard/TreeView/TableNode.vue
  4. 2
      packages/nc-gui/components/dashboard/settings/Metadata.vue
  5. 5
      packages/nc-gui/components/dashboard/settings/UIAcl.vue
  6. 2
      packages/nc-gui/components/dlg/TableDelete.vue
  7. 2
      packages/nc-gui/components/general/ProjectIcon.vue
  8. 1
      packages/nc-gui/components/smartsheet/column/CheckboxOptions.vue
  9. 4
      packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
  10. 15
      packages/nc-gui/components/smartsheet/column/FormulaOptions.vue
  11. 2
      packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue
  12. 1
      packages/nc-gui/components/smartsheet/column/RatingOptions.vue
  13. 28
      packages/nc-gui/components/smartsheet/column/SelectOptions.vue
  14. 33
      packages/nc-gui/components/smartsheet/expanded-form/Comments.vue
  15. 54
      packages/nc-gui/components/virtual-cell/Lookup.vue
  16. 4
      packages/nc-gui/lang/en.json
  17. 19
      packages/nc-gui/utils/iconUtils.ts

16
packages/nc-gui/assets/nc-icons/project.svg

@ -1,9 +1,9 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.99294 14.8095L14.548 12.28C14.8177 12.1572 14.9569 11.9975 14.9659 11.8367H1C1.00896 11.9975 1.14826 12.1572 1.4179 12.28L6.97294 14.8095C7.53075 15.0635 8.43514 15.0635 8.99294 14.8095Z" fill="#142966"/>
<path d="M14.9999 9.27893H1.00513V11.8367H14.9999V9.27893Z" fill="#142966"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.99294 12.2518L14.548 9.72223C14.8177 9.59946 14.9569 9.4398 14.9659 9.27893H1C1.00896 9.4398 1.14826 9.59946 1.4179 9.72223L6.97294 12.2518C7.53075 12.5058 8.43514 12.5058 8.99294 12.2518Z" fill="#142966"/>
<path d="M14.9999 6.72107H1.00513V9.27885H14.9999V6.72107Z" fill="#142966"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.99294 10.9729L14.548 8.44332C14.8177 8.32054 14.9569 8.16088 14.9659 8H1C1.00896 8.16088 1.14826 8.32054 1.4179 8.44332L6.97294 10.9729C7.53075 11.2269 8.43514 11.2269 8.99294 10.9729Z" fill="#36BFFF"/>
<path d="M14.9997 4.16309H1.00491V8.00309H14.9997V4.16309Z" fill="#36BFFF"/>
<path d="M14.5484 4.63991L8.99337 7.16947C8.43561 7.42348 7.53121 7.42348 6.9734 7.16947L1.41836 4.63991C0.860546 4.3859 0.860546 3.97408 1.41836 3.72007L6.9734 1.19051C7.53121 0.936498 8.43561 0.936498 8.99337 1.19051L14.5484 3.72007C15.1063 3.97408 15.1063 4.3859 14.5484 4.63991Z" fill="#36BFFF"/>
<svg width="16" height="16" viewBox="0 0 1073 1073" fill="none" xmlns="http://www.w3.org/2000/svg">
<mask id="mask0_1749_80944" style="mask-type:luminance" maskUnits="userSpaceOnUse" x="94" y="40" width="885" height="993">
<path d="M978.723 40H94V1033H978.723V40Z" fill="white"/>
</mask>
<g mask="url(#mask0_1749_80944)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M638.951 291.265L936.342 462.949C966.129 480.145 980.256 502.958 978.723 525.482V774.266C980.256 796.789 966.129 819.602 936.342 836.798L638.951 1008.48C582.292 1041.19 490.431 1041.19 433.773 1008.48L136.381 836.798C106.595 819.602 92.4675 796.789 93.9999 774.266L93.9999 525.482C92.4675 502.957 106.595 480.145 136.381 462.949L433.773 291.265C490.431 258.556 582.292 258.556 638.951 291.265Z" fill="#142966"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M638.951 65.0055L936.342 236.69C966.129 253.886 980.256 276.699 978.723 299.222V548.006C980.256 570.529 966.129 593.343 936.342 610.538L638.951 782.223C582.292 814.931 490.431 814.931 433.773 782.223L136.381 610.538C106.595 593.343 92.4675 570.529 93.9999 548.006L93.9999 299.222C92.4675 276.699 106.595 253.886 136.381 236.69L433.773 65.0055C490.431 32.2968 582.292 32.2968 638.951 65.0055Z" fill="#36BFFF"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

12
packages/nc-gui/assets/nc-icons/record.svg

@ -0,0 +1,12 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1613_80692)">
<path d="M11.8571 5.96903L4.14285 10.4225" stroke="#374151" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
<rect x="1.15184" width="9.06208" height="9.06208" rx="1.335" transform="matrix(0.866044 -0.499967 0.866044 0.499967 -0.845705 8.77156)" stroke="#374151" stroke-width="1.33"/>
<path d="M3.5 6.34009L11.2143 10.7935" stroke="#374151" stroke-width="1.33333" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_1613_80692">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 686 B

4
packages/nc-gui/components/dashboard/TreeView/TableNode.vue

@ -205,7 +205,8 @@ const isTableOpened = computed(() => {
{{ $t('general.changeIcon') }}
</template>
<MdiTable
<component
:is="iconMap.table"
v-if="table.type === 'table'"
class="flex w-5 !text-gray-500 text-sm"
:class="{
@ -213,6 +214,7 @@ const isTableOpened = computed(() => {
'!text-black': openedTableId === table.id,
}"
/>
<MdiEye
v-else
class="flex w-5 !text-gray-500 text-sm"

2
packages/nc-gui/components/dashboard/settings/Metadata.vue

@ -165,7 +165,7 @@ const columns = [
<div v-if="column.key === 'table_name'">
<div class="flex items-center gap-1">
<div class="min-w-5 flex items-center justify-center">
<GeneralTableIcon :meta="record" class="text-gray-500"></GeneralTableIcon>
<GeneralTableIcon :meta="record" class="text-gray-500" />
</div>
<span class="overflow-ellipsis min-w-0 shrink-1">{{ record.title || record.table_name }}</span>
</div>

5
packages/nc-gui/components/dashboard/settings/UIAcl.vue

@ -171,10 +171,7 @@ const columns = [
<div v-if="column.name === 'table_name'">
<div class="flex items-center gap-1">
<div class="min-w-5 flex items-center justify-center">
<GeneralTableIcon
:meta="{ meta: record.table_meta, type: record.ptype }"
class="text-gray-500"
></GeneralTableIcon>
<GeneralTableIcon :meta="{ meta: record.table_meta, type: record.ptype }" class="text-gray-500" />
</div>
<GeneralTruncateText>
<span class="overflow-ellipsis min-w-0 shrink-1">{{ record._ptn }}</span>

2
packages/nc-gui/components/dlg/TableDelete.vue

@ -110,7 +110,7 @@ const onDelete = async () => {
<GeneralDeleteModal v-model:visible="visible" :entity-name="$t('objects.table')" :on-delete="onDelete">
<template #entity-preview>
<div v-if="table" class="flex flex-row items-center py-2.25 px-2.5 bg-gray-50 rounded-lg text-gray-700 mb-4">
<GeneralTableIcon :meta="table" class="nc-view-icon"></GeneralTableIcon>
<GeneralTableIcon :meta="table" class="nc-view-icon" />
<div
class="capitalize text-ellipsis overflow-hidden select-none w-full pl-1.75"
:style="{ wordBreak: 'keep-all', whiteSpace: 'nowrap', display: 'inline' }"

2
packages/nc-gui/components/general/ProjectIcon.vue

@ -7,7 +7,7 @@ const { hoverable } = defineProps<{
<template>
<GeneralIcon
icon="ncDatabase"
icon="project"
class="text-[#2824FB] base"
:class="{
'nc-base-icon-hoverable': hoverable,

1
packages/nc-gui/components/smartsheet/column/CheckboxOptions.vue

@ -107,6 +107,7 @@ watch(
v-model="picked"
:row-size="8"
:colors="['#FF94B6', '#6A8D9D', '#6DAE42', '#4AC0BF', '#905FB3', '#FF8320', '#6BCC72', '#FF4138']"
@input="(el:string)=>vModel.meta.color=el"
/>
</a-row>
</template>

4
packages/nc-gui/components/smartsheet/column/EditOrAdd.vue

@ -282,9 +282,9 @@ if (props.fromTableExplorer) {
</a-select-option>
</a-select>
</a-form-item>
<div v-if="isEeUI && !props.hideType" class="mt-2 cursor-pointer" @click="predictColumnType()">
<!-- <div v-if="isEeUI && !props.hideType" class="mt-2 cursor-pointer" @click="predictColumnType()">
<GeneralIcon icon="magic" :class="{ 'nc-animation-pulse': loadMagic }" class="w-full flex mt-2 text-orange-400" />
</div>
</div> -->
</div>
<LazySmartsheetColumnFormulaOptions v-if="formState.uidt === UITypes.Formula" v-model:value="formState" />

15
packages/nc-gui/components/smartsheet/column/FormulaOptions.vue

@ -14,7 +14,6 @@ import {
getWordUntilCaret,
iconMap,
insertAtCursor,
isEeUI,
onMounted,
useColumnCreateStoreOrThrow,
useDebounceFn,
@ -32,11 +31,11 @@ const uiTypesNotSupportedInFormulas = [UITypes.QrCode, UITypes.Barcode]
const vModel = useVModel(props, 'value', emit)
const { formState, setAdditionalValidations, validateInfos, sqlUi, column } = useColumnCreateStoreOrThrow()
const { setAdditionalValidations, validateInfos, sqlUi, column } = useColumnCreateStoreOrThrow()
const { t } = useI18n()
const { loadMagic, predictFunction: _predictFunction } = useNocoEe()
const { predictFunction: _predictFunction } = useNocoEe()
enum JSEPNode {
COMPOUND = 'Compound',
@ -714,21 +713,21 @@ onMounted(() => {
jsep.plugins.register(jsepCurlyHook)
})
const predictFunction = async () => {
await _predictFunction(formState, meta, supportedColumns, suggestionsList, vModel)
}
// const predictFunction = async () => {
// await _predictFunction(formState, meta, supportedColumns, suggestionsList, vModel)
// }
</script>
<template>
<div class="formula-wrapper">
<a-form-item v-bind="validateInfos.formula_raw" :label="$t('datatype.Formula')">
<GeneralIcon
<!-- <GeneralIcon
v-if="isEeUI"
icon="magic"
:class="{ 'nc-animation-pulse': loadMagic }"
class="text-orange-400 cursor-pointer absolute right-1 top-1 z-10"
@click="predictFunction()"
/>
/> -->
<a-textarea
ref="formulaRef"
v-model:value="vModel.formula_raw"

2
packages/nc-gui/components/smartsheet/column/LinkedToAnotherRecordOptions.vue

@ -80,7 +80,7 @@ const isLinks = computed(() => vModel.value.uidt === UITypes.Links)
<a-select-option v-for="table of refTables" :key="table.title" :value="table.id">
<div class="flex items-center gap-2">
<div class="min-w-5 flex items-center justify-center">
<GeneralTableIcon :meta="table" class="text-gray-500"></GeneralTableIcon>
<GeneralTableIcon :meta="table" class="text-gray-500" />
</div>
<span class="overflow-ellipsis min-w-0 shrink-1">{{ table.title }}</span>

1
packages/nc-gui/components/smartsheet/column/RatingOptions.vue

@ -110,6 +110,7 @@ watch(
v-model="picked"
:row-size="8"
:colors="['#FF94B6', '#6A8D9D', '#6DAE42', '#4AC0BF', '#905FB3', '#FF8320', '#6BCC72', '#FF4138']"
@input="(el:string) => (vModel.meta.color = el)"
/>
</a-row>
</template>

28
packages/nc-gui/components/smartsheet/column/SelectOptions.vue

@ -1,17 +1,7 @@
<script setup lang="ts">
import Draggable from 'vuedraggable'
import { UITypes } from 'nocodb-sdk'
import {
IsKanbanInj,
enumColor,
iconMap,
isEeUI,
onMounted,
storeToRefs,
useColumnCreateStoreOrThrow,
useVModel,
watch,
} from '#imports'
import { IsKanbanInj, enumColor, iconMap, onMounted, useColumnCreateStoreOrThrow, useVModel, watch } from '#imports'
interface Option {
color: string
@ -29,11 +19,11 @@ const emit = defineEmits(['update:value'])
const vModel = useVModel(props, 'value', emit)
const { formState, setAdditionalValidations, validateInfos, isMysql } = useColumnCreateStoreOrThrow()
const { setAdditionalValidations, validateInfos, isMysql } = useColumnCreateStoreOrThrow()
const { base } = storeToRefs(useBase())
// const { base } = storeToRefs(useBase())
const { loadMagic, optionsMagic: _optionsMagic } = useNocoEe()
const { optionsMagic: _optionsMagic } = useNocoEe()
const options = ref<(Option & { status?: 'remove' })[]>([])
const renderedOptions = ref<(Option & { status?: 'remove' })[]>([])
@ -139,9 +129,9 @@ const addNewOption = () => {
options.value.push(tempOption)
}
const optionsMagic = async () => {
await _optionsMagic(base, formState, getNextColor, options.value, renderedOptions.value)
}
// const optionsMagic = async () => {
// await _optionsMagic(base, formState, getNextColor, options.value, renderedOptions.value)
// }
const syncOptions = () => {
vModel.value.colOptions.options = renderedOptions.value.filter((op) => op.status !== 'remove')
@ -271,9 +261,9 @@ watch(vModel.value, (next) => {
<span class="flex-auto">Add option</span>
</div>
</a-button>
<div v-if="isEeUI" class="w-full cursor-pointer" @click="optionsMagic()">
<!-- <div v-if="isEeUI" class="w-full cursor-pointer" @click="optionsMagic()">
<GeneralIcon icon="magic" :class="{ 'nc-animation-pulse': loadMagic }" class="w-full flex mt-2 text-orange-400" />
</div>
</div> -->
</div>
</template>

33
packages/nc-gui/components/smartsheet/expanded-form/Comments.vue

@ -4,10 +4,14 @@ import type { AuditType } from 'nocodb-sdk'
import { Icon } from '@iconify/vue'
import { ref, timeAgo, useExpandedFormStoreOrThrow, useGlobal, useRoles, watch } from '#imports'
const { loadCommentsAndLogs, commentsAndLogs, saveComment, comment, updateComment } = useExpandedFormStoreOrThrow()
const { loadCommentsAndLogs, commentsAndLogs, saveComment: _saveComment, comment, updateComment } = useExpandedFormStoreOrThrow()
const commentsWrapperEl = ref<HTMLDivElement>()
const auditTabDomRef = (e: HTMLElement) => {
e.scrollTop = e.scrollHeight
}
onMounted(async () => {
await loadCommentsAndLogs()
})
@ -90,15 +94,18 @@ const value = computed({
},
})
watch(
commentsAndLogs,
() => {
setTimeout(() => {
if (commentsWrapperEl.value) commentsWrapperEl.value.scrollTop = commentsWrapperEl.value?.scrollHeight
}, 200)
},
{ immediate: true },
)
function scrollComments() {
if (commentsWrapperEl.value) commentsWrapperEl.value.scrollTop = commentsWrapperEl.value?.scrollHeight
}
const saveComment = async () => {
await _saveComment()
scrollComments()
}
watch(commentsWrapperEl, () => {
scrollComments()
})
// Ignore first line if its the only one
const processedAudit = (log: string) => {
@ -148,14 +155,14 @@ const processedAudit = (log: string) => {
'pb-2': tab !== 'comments',
}"
>
<div v-if="tab === 'comments'" ref="commentsWrapperEl" class="flex flex-col h-full">
<div v-if="tab === 'comments'" class="flex flex-col h-full">
<div v-if="comments.length === 0" class="flex flex-col my-1 text-center justify-center h-full">
<div class="text-center text-3xl text-gray-700">
<GeneralIcon icon="commentHere" />
</div>
<div class="font-medium text-center my-6 text-gray-500">{{ $t('activity.startCommenting') }}</div>
</div>
<div v-else class="flex flex-col h-full py-2 pl-2 pr-1 space-y-2 nc-scrollbar-md">
<div v-else ref="commentsWrapperEl" class="flex flex-col h-full py-2 pl-2 pr-1 space-y-2 nc-scrollbar-md">
<div v-for="log of comments" :key="log.id">
<div class="bg-white rounded-xl group border-1 gap-2 border-gray-200">
<div class="flex flex-col p-4 gap-3">
@ -225,7 +232,7 @@ const processedAudit = (log: string) => {
</div>
</div>
</div>
<div v-else ref="commentsWrapperEl" class="flex flex-col h-full pl-2 pr-1 pt-2 nc-scrollbar-md space-y-2">
<div v-if="tab === 'audits'" :ref="auditTabDomRef" class="flex flex-col h-full pl-2 pr-1 pt-2 nc-scrollbar-md space-y-2">
<template v-if="audits.length === 0">
<div class="flex flex-col text-center justify-center h-full">
<div class="text-center text-3xl text-gray-600">

54
packages/nc-gui/components/virtual-cell/Lookup.vue

@ -114,36 +114,38 @@ const { showEditNonEditableFieldWarning, showClearNonEditableFieldWarning, activ
</div>
<!-- For attachment cell avoid adding chip style -->
<template v-else>
<div
v-for="(v, i) of arrValue"
:key="i"
class="min-w-max"
:class="{
'bg-gray-100 px-1 rounded-full flex-1': !isAttachment(lookupColumn),
'border-gray-200 rounded border-1': ![UITypes.Attachment, UITypes.MultiSelect, UITypes.SingleSelect].includes(
lookupColumn.uidt,
),
}"
>
<LazySmartsheetCell
:model-value="v"
:column="lookupColumn"
:edit-enabled="false"
:virtual="true"
:read-only="true"
/>
<div class="flex flex-col">
<div class="flex gap-1.5">
<div
v-for="(v, i) of arrValue"
:key="i"
class="min-w-max"
:class="{
'bg-gray-100 px-1 rounded-full flex-1': !isAttachment(lookupColumn),
'border-gray-200 rounded border-1': ![UITypes.Attachment, UITypes.MultiSelect, UITypes.SingleSelect].includes(
lookupColumn.uidt,
),
}"
>
<LazySmartsheetCell
:model-value="v"
:column="lookupColumn"
:edit-enabled="false"
:virtual="true"
:read-only="true"
/>
</div>
</div>
<div v-if="showEditNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.info.computedFieldEditWarning') }}
</div>
<div v-if="showClearNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.info.computedFieldDeleteWarning') }}
</div>
</div>
</template>
</template>
</template>
</div>
<div>
<div v-if="showEditNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.info.computedFieldEditWarning') }}
</div>
<div v-if="showClearNonEditableFieldWarning" class="text-left text-wrap mt-2 text-[#e65100] text-xs">
{{ $t('msg.info.computedFieldDeleteWarning') }}
</div>
</div>
</div>
</template>

4
packages/nc-gui/lang/en.json

@ -1100,8 +1100,8 @@
"showNullAndEmptyInFilter": "Show NULL and EMPTY in Filter",
"showNullAndEmptyInFilterDesc": "Enable 'additional' filters to differentiate fields containing NULL & Empty Strings. Default support for Blank treats both NULL & Empty strings alike.",
"deleteKanbanStackConfirmation": "Deleting this stack will also remove the select option `{stackToBeDeleted}` from the `{groupingField}`. The records will move to the uncategorized stack.",
"computedFieldEditWarning": "Computed field: contents are read-only. Use column edit menu to reconfigure",
"computedFieldDeleteWarning": "Computed field: contents are read-only. Unable to clear content.",
"computedFieldEditWarning": "contents are read-only",
"computedFieldDeleteWarning": "contents are read-only",
"noMoreRecords": "No more records",
"tokenNameNotEmpty": "Token name should not be empty",
"tokenNameMaxLength": "Token name should not be more than 255 characters"

19
packages/nc-gui/utils/iconUtils.ts

@ -82,19 +82,21 @@ import NcCommentHere from '~icons/nc-icons/comment-here'
import NcAddDataSource from '~icons/nc-icons/add-data-source'
import NcDatabaseIcon from '~icons/nc-icons/database'
// Roles
import MaterialSymbolsManageAccountsOutline from '~icons/material-symbols/manage-accounts-outline'
// account
import MdiCommentAccountOutline from '~icons/mdi/comment-account-outline'
import MaterialSymbolsPersonSearchOutline from '~icons/material-symbols/person-search-outline'
import MaterialSymbolsBlock from '~icons/material-symbols/block'
import HasManyIcon from '~icons/nc-icons/hasmany'
import ManytoManyIcon from '~icons/nc-icons/manytomany'
import BelongsToIcon from '~icons/nc-icons/belongsto'
import HasManySolidIcon from '~icons/nc-icons/hm-solid'
import ManytoManySolidIcon from '~icons/nc-icons/mm-solid'
import BelongsToSolidIcon from '~icons/nc-icons/bt-solid'
import Record from '~icons/nc-icons/record'
import Project from '~icons/nc-icons/project'
// Roles
import MaterialSymbolsManageAccountsOutline from '~icons/material-symbols/manage-accounts-outline'
// account
import MdiCommentAccountOutline from '~icons/mdi/comment-account-outline'
import MaterialSymbolsPersonSearchOutline from '~icons/material-symbols/person-search-outline'
import MaterialSymbolsBlock from '~icons/material-symbols/block'
// keep it for reference
// todo: remove it after all icons are migrated
@ -251,6 +253,7 @@ export const iconMap = {
hm_solid: HasManySolidIcon,
bt_solid: BelongsToSolidIcon,
workspaceDefault: MsGroup,
project: Project,
search: NcSearch,
error: h('span', { class: 'material-symbols' }, 'error'),
info: h(MsInfo, {}, () => 'info'),
@ -335,7 +338,7 @@ export const iconMap = {
// threeDotHorizontal: h('span', { class: 'material-symbols' }, 'more_horiz'),
threeDotVertical: MdiDotsVertical,
threeDotHorizontal: MdiDotsHorizontal,
table: MdiTable,
table: Record,
excel: PhExcelThin, // h('span', { class: 'material-symbols' }, 'grid_on'),
csv: PhCsvThin, // h('span', { class: 'material-symbols' }, 'grid_on'),
code: Code,

Loading…
Cancel
Save