Browse Source

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

pull/2979/head
Wing-Kam Wong 2 years ago
parent
commit
5ff3de3e94
  1. 9
      .all-contributorsrc
  2. 1
      README.md
  3. 92
      packages/nc-gui-v2/components/cell/Text.vue
  4. 72
      packages/nc-gui-v2/components/cell/TextArea.vue
  5. 3
      packages/nc-gui-v2/components/dlg/AirtableImport.vue
  6. 6
      packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue
  7. 3
      packages/nc-gui-v2/components/smartsheet/VirtualCell.vue
  8. 9
      packages/nc-gui-v2/components/virtual-cell/Count.vue
  9. 2
      packages/nc-gui-v2/composables/useTableCreate.ts
  10. 2
      packages/nc-gui-v2/composables/useVirtualCell.ts
  11. 2
      packages/nocodb-sdk/src/lib/UITypes.ts

9
.all-contributorsrc

@ -837,6 +837,15 @@
"contributions": [ "contributions": [
"translation" "translation"
] ]
},
{
"login": "drsantam",
"name": "Santam Chakraborty",
"avatar_url": "https://avatars.githubusercontent.com/u/10681456?v=4",
"profile": "https://github.com/drsantam",
"contributions": [
"translation"
]
} }
], ],
"contributorsPerLine": 7, "contributorsPerLine": 7,

1
README.md

@ -449,6 +449,7 @@ Our mission is to provide the most powerful no-code interface for databases whic
</tr> </tr>
<tr> <tr>
<td align="center"><a href="https://yohanboniface.me"><img src="https://avatars.githubusercontent.com/u/146023?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yohan Boniface</b></sub></a><br /><a href="#translation-yohanboniface" title="Translation">🌍</a></td> <td align="center"><a href="https://yohanboniface.me"><img src="https://avatars.githubusercontent.com/u/146023?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yohan Boniface</b></sub></a><br /><a href="#translation-yohanboniface" title="Translation">🌍</a></td>
<td align="center"><a href="https://github.com/drsantam"><img src="https://avatars.githubusercontent.com/u/10681456?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Santam Chakraborty</b></sub></a><br /><a href="#translation-drsantam" title="Translation">🌍</a></td>
</tr> </tr>
</table> </table>

92
packages/nc-gui-v2/components/cell/Text.vue

@ -1,100 +1,28 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, inject, onMounted, ref } from '#imports' import { inject, onMounted, ref } from '#imports'
interface Props { interface Props {
modelValue: any modelValue: any
} }
const { modelValue: value } = defineProps<Props>() const props = defineProps<Props>()
const emit = defineEmits(['update:modelValue']) const emits = defineEmits(['update:modelValue'])
const editEnabled = inject<boolean>('editEnabled', false) const editEnabled = inject<boolean>('editEnabled', false)
const root = ref<HTMLInputElement>() const root = ref<HTMLInputElement>()
const localState = computed({ const vModel = useVModel(props, 'modelValue', emits)
get: () => value,
set: (val) => emit('update:modelValue', val),
})
onMounted(() => { const onSetRef = (el: HTMLInputElement) => {
root.value?.focus() el.focus()
}) }
/* export default {
name: 'TextCell',
props: {
value: [String, Object, Number, Boolean, Array],
},
computed: {
localState: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
},
},
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
$listeners.blur = this.$listeners.blur
}
if (this.$listeners.focus) {
$listeners.focus = this.$listeners.focus
}
if (this.$listeners.cancel) {
$listeners.cancel = this.$listeners.cancel
}
return $listeners
},
},
mounted() {
this.$el.focus()
},
} */
</script> </script>
<template> <template>
<input v-if="editEnabled" ref="root" v-model="localState" /> <input v-if="editEnabled" :ref="onSetRef" v-model="vModel" class="h-full w-full outline-none" />
<span v-else>{{ localState }}</span> <span v-else>{{ vModel }}</span>
<!-- v-on="parentListeners" /> -->
</template> </template>
<style scoped> <style scoped></style>
input,
textarea {
width: 100%;
height: 100%;
color: var(--v-textColor-base);
outline: none;
}
</style>
<!--
/**
* @copyright Copyright (c) 2021, Xgene Cloud Ltd
*
* @author Naveen MR <oof1lab@gmail.com>
* @author Pranav C Balan <pranavxc@gmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-->

72
packages/nc-gui-v2/components/cell/TextArea.vue

@ -5,70 +5,34 @@ interface Props {
modelValue?: string modelValue?: string
} }
const { modelValue: value } = defineProps<Props>() const props = defineProps<Props>()
const emit = defineEmits(['update:modelValue']) const emits = defineEmits(['update:modelValue'])
const editEnabled = inject<boolean>('editEnabled', false) const editEnabled = inject<boolean>('editEnabled', false)
const root = ref<HTMLInputElement>() const vModel = useVModel(props, 'modelValue', emits)
const localState = computed({ const onSetRef = (el: HTMLInputElement) => {
get: () => value, el.focus()
set: (val) => emit('update:modelValue', val), }
})
onMounted(() => {
root.value?.focus()
})
/* export default {
name: 'TextAreaCell',
props: {
value: String,
},
computed: {
localState: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
},
},
parentListeners() {
const $listeners = {}
if (this.$listeners.blur) {
$listeners.blur = this.$listeners.blur
}
if (this.$listeners.focus) {
$listeners.focus = this.$listeners.focus
}
return $listeners
},
},
created() {
this.localState = this.value
},
mounted() {
this.$refs.textarea && this.$refs.textarea.focus()
},
} */
</script> </script>
<template> <template>
<textarea v-if="editEnabled" ref="root" v-model="localState" rows="4" @keydown.alt.enter.stop @keydown.shift.enter.stop /> <textarea
<span v-else>{{ localState }}</span> v-if="editEnabled"
:ref="onSetRef"
v-model="vModel"
rows="4"
class="h-full w-full min-h-[60px] outline-none"
@keydown.alt.enter.stop
@keydown.shift.enter.stop
/>
<span v-else>{{ vModel }}</span>
</template> </template>
<style scoped> <style scoped>
input, textarea:focus {
textarea { @apply ring-transparent;
width: 100%;
min-height: 60px;
height: 100%;
color: var(--v-textColor-base);
} }
</style> </style>

3
packages/nc-gui-v2/components/dlg/AirtableImport.vue

@ -336,7 +336,8 @@ onBeforeUnmount(() => {
</div> </div>
</a-card> </a-card>
<div class="flex justify-center items-center"> <div class="flex justify-center items-center">
<a-button v-if="showGoToDashboardButton" class="mt-4" size="large" @click="dialogShow = false">Go to Dashboard</a-button <a-button v-if="showGoToDashboardButton" class="mt-4" size="large" @click="dialogShow = false"
>Go to Dashboard</a-button
> >
</div> </div>
</div> </div>

6
packages/nc-gui-v2/components/smartsheet-header/VirtualCellIcon.vue

@ -8,6 +8,8 @@ import BTIcon from '~icons/mdi/table-arrow-left'
import MMIcon from '~icons/mdi/table-network' import MMIcon from '~icons/mdi/table-network'
import FormulaIcon from '~icons/mdi/math-integral' import FormulaIcon from '~icons/mdi/math-integral'
import RollupIcon from '~icons/mdi/movie-roll' import RollupIcon from '~icons/mdi/movie-roll'
import CountIcon from '~icons/mdi/counter'
import SpecificDBTypeIcon from '~icons/mdi/database-settings'
const { columnMeta } = defineProps<{ columnMeta?: ColumnType }>() const { columnMeta } = defineProps<{ columnMeta?: ColumnType }>()
@ -25,12 +27,16 @@ const icon = computed(() => {
return BTIcon return BTIcon
} }
break break
case UITypes.SpecificDBType:
return SpecificDBTypeIcon
case UITypes.Formula: case UITypes.Formula:
return FormulaIcon return FormulaIcon
case UITypes.Lookup: case UITypes.Lookup:
return GenericIcon return GenericIcon
case UITypes.Rollup: case UITypes.Rollup:
return RollupIcon return RollupIcon
case UITypes.Count:
return CountIcon
} }
return GenericIcon return GenericIcon
}) })

3
packages/nc-gui-v2/components/smartsheet/VirtualCell.vue

@ -15,7 +15,7 @@ const emit = defineEmits(['update:modelValue'])
provide(ColumnInj, column) provide(ColumnInj, column)
provide('value', value) provide('value', value)
const { isLookup, isBt, isRollup, isMm, isHm, isFormula } = useVirtualCell(column) const { isLookup, isBt, isRollup, isMm, isHm, isFormula, isCount } = useVirtualCell(column)
</script> </script>
<template> <template>
@ -25,6 +25,7 @@ const { isLookup, isBt, isRollup, isMm, isHm, isFormula } = useVirtualCell(colum
<VirtualCellBelongsTo v-else-if="isBt" /> <VirtualCellBelongsTo v-else-if="isBt" />
<VirtualCellRollup v-else-if="isRollup" /> <VirtualCellRollup v-else-if="isRollup" />
<VirtualCellFormula v-else-if="isFormula" /> <VirtualCellFormula v-else-if="isFormula" />
<VirtualCellCount v-else-if="isCount" />
<!-- <v-lazy> --> <!-- <v-lazy> -->
<!-- <has-many-cell <!-- <has-many-cell

9
packages/nc-gui-v2/components/virtual-cell/Count.vue

@ -0,0 +1,9 @@
<script setup lang="ts">
// TODO: wait for Count Column implementation
</script>
<template>
<span class="prose-sm"></span>
</template>
<style scoped lang="scss"></style>

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

@ -1,8 +1,8 @@
import type { TableType } from 'nocodb-sdk' import type { TableType } from 'nocodb-sdk'
import { UITypes } from 'nocodb-sdk' import { UITypes } from 'nocodb-sdk'
import { useToast } from 'vue-toastification'
import { useProject } from './useProject' import { useProject } from './useProject'
import { useNuxtApp } from '#app' import { useNuxtApp } from '#app'
import { useToast } from 'vue-toastification'
import { extractSdkResponseErrorMsg } from '~/utils/errorUtils' import { extractSdkResponseErrorMsg } from '~/utils/errorUtils'
export function useTableCreate(onTableCreate?: (tableMeta: TableType) => void) { export function useTableCreate(onTableCreate?: (tableMeta: TableType) => void) {

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

@ -20,6 +20,7 @@ export function useVirtualCell(column: ColumnType) {
const isLookup = computed(() => column.uidt === UITypes.Lookup) const isLookup = computed(() => column.uidt === UITypes.Lookup)
const isRollup = computed(() => column.uidt === UITypes.Rollup) const isRollup = computed(() => column.uidt === UITypes.Rollup)
const isFormula = computed(() => column.uidt === UITypes.Formula) const isFormula = computed(() => column.uidt === UITypes.Formula)
const isCount = computed(() => column.uidt === UITypes.Count)
return { return {
isHm, isHm,
@ -28,5 +29,6 @@ export function useVirtualCell(column: ColumnType) {
isLookup, isLookup,
isRollup, isRollup,
isFormula, isFormula,
isCount,
} }
} }

2
packages/nocodb-sdk/src/lib/UITypes.ts

@ -46,10 +46,12 @@ export function isVirtualCol(
| ColumnType | ColumnType
) { ) {
return [ return [
UITypes.SpecificDBType,
UITypes.LinkToAnotherRecord, UITypes.LinkToAnotherRecord,
UITypes.Formula, UITypes.Formula,
UITypes.Rollup, UITypes.Rollup,
UITypes.Lookup, UITypes.Lookup,
UITypes.Count,
].includes(<UITypes>(typeof col === 'object' ? col?.uidt : col)); ].includes(<UITypes>(typeof col === 'object' ? col?.uidt : col));
} }

Loading…
Cancel
Save