Browse Source

fix(nc-gui): pr review changes

pull/8629/head
Ramesh Mane 6 months ago
parent
commit
d0d26f6e00
  1. 8
      packages/nc-gui/components/general/Loader.vue
  2. 10
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  3. 20
      packages/nc-gui/components/smartsheet/header/Menu.vue

8
packages/nc-gui/components/general/Loader.vue

@ -2,7 +2,7 @@
import { LoadingOutlined } from '@ant-design/icons-vue' import { LoadingOutlined } from '@ant-design/icons-vue'
const props = defineProps<{ const props = defineProps<{
size?: 'small' | 'medium' | 'large' | 'xlarge' size?: 'small' | 'medium' | 'large' | 'xlarge' | 'regular'
loaderClass?: string loaderClass?: string
}>() }>()
@ -18,17 +18,19 @@ function getFontSize() {
return 'text-xl' return 'text-xl'
case 'xlarge': case 'xlarge':
return 'text-3xl' return 'text-3xl'
case 'regular':
return 'text-[16px] leading-4'
} }
} }
const indicator = h(LoadingOutlined, { const indicator = h(LoadingOutlined, {
class: `!${getFontSize()} flex flex-row items-center !bg-inherit !hover:bg-inherit !text-inherit ${props.loaderClass}}`, class: `!${getFontSize()} flex flex-row items-center !bg-inherit !hover:bg-inherit !text-inherit ${props.loaderClass || ''}}`,
spin: true, spin: true,
}) })
</script> </script>
<template> <template>
<a-spin class="nc-loader flex flex-row items-center" :indicator="indicator" /> <a-spin class="nc-loader !flex flex-row items-center" :indicator="indicator" />
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>

10
packages/nc-gui/components/smartsheet/expanded-form/index.vue

@ -639,16 +639,12 @@ export default {
<NcButton <NcButton
v-if="!isNew && rowId && !isMobileMode" v-if="!isNew && rowId && !isMobileMode"
:disabled="isLoading" :disabled="isLoading"
class="!<lg:hidden text-gray-700 !h-7 !px-2" class="!<lg:hidden text-gray-700 !h-7 !w-7"
type="text" type="text"
size="xsmall" size="xsmall"
@click="copyRecordUrl()" @click="copyRecordUrl()"
> >
<div <div v-e="['c:row-expand:copy-url']" data-testid="nc-expanded-form-copy-url" class="flex items-center">
v-e="['c:row-expand:copy-url']"
data-testid="nc-expanded-form-copy-url"
class="flex items-center"
>
<component :is="iconMap.check" v-if="isRecordLinkCopied" class="cursor-pointer nc-duplicate-row h-4 w-4" /> <component :is="iconMap.check" v-if="isRecordLinkCopied" class="cursor-pointer nc-duplicate-row h-4 w-4" />
<component :is="iconMap.copy" v-else class="cursor-pointer nc-duplicate-row h-4 w-4" /> <component :is="iconMap.copy" v-else class="cursor-pointer nc-duplicate-row h-4 w-4" />
</div> </div>
@ -888,7 +884,7 @@ export default {
class="flex gap-2 items-center" class="flex gap-2 items-center"
data-testid="nc-expanded-form-copy-url" data-testid="nc-expanded-form-copy-url"
> >
<component :is="iconMap.link" class="cursor-pointer nc-duplicate-row" /> <component :is="iconMap.copy" class="cursor-pointer nc-duplicate-row" />
{{ $t('labels.copyRecordURL') }} {{ $t('labels.copyRecordURL') }}
</div> </div>
</NcMenuItem> </NcMenuItem>

20
packages/nc-gui/components/smartsheet/header/Menu.vue

@ -43,7 +43,7 @@ const { gridViewCols } = useViewColumnsOrThrow()
const { fieldsToGroupBy, groupByLimit } = useViewGroupByOrThrow(view) const { fieldsToGroupBy, groupByLimit } = useViewGroupByOrThrow(view)
const isLoading = ref('') const isLoading = ref<'' | 'hideOrShow' | 'setDisplay'>('')
const setAsDisplayValue = async () => { const setAsDisplayValue = async () => {
isLoading.value = 'setDisplay' isLoading.value = 'setDisplay'
@ -94,8 +94,9 @@ const setAsDisplayValue = async () => {
}) })
} catch (e) { } catch (e) {
message.error(t('msg.error.primaryColumnUpdateFailed')) message.error(t('msg.error.primaryColumnUpdateFailed'))
} finally {
isLoading.value = ''
} }
isLoading.value = ''
} }
const sortByColumn = async (direction: 'asc' | 'desc') => { const sortByColumn = async (direction: 'asc' | 'desc') => {
@ -293,7 +294,8 @@ const hideOrShowField = async () => {
}, },
scope: defineViewScope({ view: view.value }), scope: defineViewScope({ view: view.value }),
}) })
// isLoading.value = false
isLoading.value = ''
} }
const handleDelete = () => { const handleDelete = () => {
@ -389,12 +391,8 @@ const filterOrGroupByThisField = (event: SmartsheetStoreEvents) => {
<a-divider v-if="!column?.pv" class="!my-0" /> <a-divider v-if="!column?.pv" class="!my-0" />
<NcMenuItem v-if="!column?.pv" @click="hideOrShowField"> <NcMenuItem v-if="!column?.pv" @click="hideOrShowField">
<div v-e="['a:field:hide']" class="nc-column-insert-before nc-header-menu-item"> <div v-e="['a:field:hide']" class="nc-column-insert-before nc-header-menu-item">
<component <GeneralLoader v-if="isLoading === 'hideOrShow'" size="regular" />
:is="isHiddenCol ? iconMap.eye : iconMap.eyeSlash" <component v-else :is="isHiddenCol ? iconMap.eye : iconMap.eyeSlash" class="text-gray-700 !w-4 !h-4" />
v-show="isLoading !== 'hideOrShow'"
class="text-gray-700 !w-3.75 !h-3.75"
/>
<GeneralLoader v-show="isLoading === 'hideOrShow'" size="large" class="!w-3.75 !h-3.75" />
<!-- Hide Field --> <!-- Hide Field -->
{{ isHiddenCol ? $t('general.showField') : $t('general.hideField') }} {{ isHiddenCol ? $t('general.showField') : $t('general.hideField') }}
</div> </div>
@ -404,8 +402,8 @@ const filterOrGroupByThisField = (event: SmartsheetStoreEvents) => {
@click="setAsDisplayValue" @click="setAsDisplayValue"
> >
<div class="nc-column-set-primary nc-header-menu-item item"> <div class="nc-column-set-primary nc-header-menu-item item">
<GeneralIcon v-show="isLoading !== 'setDisplay'" icon="star" class="text-gray-700 !w-4.25 !h-4.25" /> <GeneralLoader v-if="isLoading === 'setDisplay'" size="regular" />
<GeneralLoader v-show="isLoading === 'setDisplay'" size="large" class="!w-4.25 !h-4.25" /> <GeneralIcon v-else icon="star" class="text-gray-700 !w-4.25 !h-4.25" />
<!-- todo : tooltip --> <!-- todo : tooltip -->
<!-- Set as Display value --> <!-- Set as Display value -->

Loading…
Cancel
Save