Browse Source

refactor(gui-v2): formula hint layout

pull/3049/head
Wing-Kam Wong 2 years ago
parent
commit
7a19c8df1c
  1. 35
      packages/nc-gui-v2/components/smartsheet-column/FormulaOptions.vue

35
packages/nc-gui-v2/components/smartsheet-column/FormulaOptions.vue

@ -101,6 +101,7 @@ const suggestionsList = computed(() => {
text: c.title,
type: 'column',
icon: getUIDTIcon(c.uidt),
uidt: c.uidt,
})),
...availableBinOps.map((op: string) => ({
text: op,
@ -613,7 +614,7 @@ onMounted(() => {
<template>
<div class="formula-wrapper">
<a-form-item v-bind="validateInfos.formula_raw" label="Formula">
<a-input
<a-textarea
ref="formulaRef"
v-model:value="formState.formula_raw"
class="mb-2"
@ -623,21 +624,13 @@ onMounted(() => {
@change="handleInputDeb"
/>
</a-form-item>
<div class="text-gray-600 mt-2 prose-sm">
<div class="text-gray-600 mt-2 mb-4 prose-sm">
Hint: Use {} to reference columns, e.g: {column_name}. For more, please check out
<a class="prose-sm" href="https://docs.nocodb.com/setup-and-usages/formulas#available-formula-features" target="_blank"
>Formulas</a
>.
</div>
<a-drawer
v-model:visible="formulaSuggestionDrawer"
:closable="false"
:mask="false"
:mask-closable="false"
placement="right"
width="500px"
class="h-full overflow-auto"
>
<div class="h-[250px] overflow-auto scrollbar-thin-primary">
<a-list ref="sugListRef" :data-source="suggestion" :locale="{ emptyText: 'No suggested formula was found' }">
<template #renderItem="{ item, index }">
<a-list-item
@ -650,7 +643,13 @@ onMounted(() => {
@click.prevent.stop="appendText(item)"
>
<a-list-item-meta>
<template v-if="item.type === 'function'" #description>
<template #title>
<div class="flex">
<a-col :span="6">
<span class="prose-sm text-gray-600">{{ item.text }}</span>
</a-col>
<a-col :span="18">
<div v-if="item.type === 'function'" class="text-xs text-gray-500">
{{ item.description }} <br /><br />
Syntax: <br />
{{ item.syntax }} <br /><br />
@ -658,15 +657,11 @@ onMounted(() => {
<div v-for="(example, idx) of item.examples" :key="idx">
<div>({{ idx + 1 }}): {{ example }}</div>
</div>
</template>
<template #title>
<div class="flex">
<div class="flex-1">
{{ item.text }}
</div>
<div class="">
{{ getFormulaTypeName(item.type) }}
<div v-if="item.type === 'column'" class="float-right mr-5 -mt-2">
<a-badge-ribbon :text="item.uidt" />
</div>
</a-col>
</div>
</template>
<template #avatar>
@ -678,6 +673,6 @@ onMounted(() => {
</a-list-item>
</template>
</a-list>
</a-drawer>
</div>
</div>
</template>

Loading…
Cancel
Save