Browse Source

fix(nc-gui): small changes

pull/7526/head
Ramesh Mane 9 months ago
parent
commit
3579ff23d6
  1. 2
      packages/nc-gui/components/smartsheet/Gallery.vue
  2. 2
      packages/nc-gui/components/smartsheet/Map.vue
  3. 4
      packages/nc-gui/components/smartsheet/Row.vue
  4. 2
      packages/nc-gui/components/smartsheet/SharedMapMarkerPopup.vue
  5. 2
      packages/nc-gui/components/smartsheet/expanded-form/index.vue
  6. 8
      packages/nc-gui/composables/useLTARStore.ts
  7. 5
      packages/nc-gui/context/index.ts

2
packages/nc-gui/components/smartsheet/Gallery.vue

@ -188,7 +188,7 @@ reloadViewDataHook?.on(
)
// provide view data reload hook as fallback to row data reload
provide(ReloadRowDataHookInj, reloadViewDataHook)
provide(ReloadRowDataHookInj, reloadViewDataHook!)
watch(
view,

2
packages/nc-gui/components/smartsheet/Map.vue

@ -175,7 +175,7 @@ reloadViewDataHook?.on(async () => {
await loadMapData()
})
provide(ReloadRowDataHookInj, reloadViewDataHook)
provide(ReloadRowDataHookInj, reloadViewDataHook!)
watch([formattedData, mapMetaData, markersClusterGroupRef], () => {
if (formattedData.value == null || mapMetaData.value?.fk_view_id == null || markersClusterGroupRef.value == null) {

4
packages/nc-gui/components/smartsheet/Row.vue

@ -26,9 +26,9 @@ const { isNew, state, syncLTARRefs, clearLTARCell, addLTARRef } = useProvideSmar
const reloadViewDataTrigger = inject(ReloadViewDataHookInj)!
// override reload trigger and use it to reload row
const reloadHook = createEventHook<boolean | void>()
const reloadHook = createEventHook()
reloadHook.on((shouldShowLoading) => {
reloadHook.on(({ shouldShowLoading }) => {
if (isNew.value) return
reloadViewDataTrigger?.trigger({ shouldShowLoading: shouldShowLoading as boolean })
})

2
packages/nc-gui/components/smartsheet/SharedMapMarkerPopup.vue

@ -48,7 +48,7 @@ onMounted(async () => {
await loadData()
})
provide(ReloadRowDataHookInj, reloadViewDataHook)
provide(ReloadRowDataHookInj, reloadViewDataHook!)
const currentRow = toRef(props, 'row')

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

@ -286,7 +286,7 @@ const reloadParentRowHook = inject(ReloadRowDataHookInj, createEventHook())
const reloadHook = createEventHook()
reloadHook.on(() => {
reloadParentRowHook?.trigger(false)
reloadParentRowHook?.trigger({ shouldShowLoading: false })
if (isNew.value) return
_loadRow(null, true)
})

8
packages/nc-gui/composables/useLTARStore.ts

@ -45,7 +45,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
column: Ref<Required<ColumnType>>,
row: Ref<Row>,
isNewRow: ComputedRef<boolean> | Ref<boolean>,
reloadData = (_showProgress?: boolean) => {},
reloadData = (_params: { shouldShowLoading?: boolean }) => {},
) => {
// state
const { metas, getMeta } = useMetas()
@ -351,7 +351,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
return false
}
reloadData?.(false)
reloadData?.({ shouldShowLoading: false })
/** reload child list if not a new row */
if (!isNewRow?.value) {
@ -429,7 +429,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
}, 600)
}
reloadData?.(false)
reloadData?.({ shouldShowLoading: false })
$e('a:links:unlink')
}
@ -499,7 +499,7 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
}, 600)
}
reloadData?.(false)
reloadData?.({ shouldShowLoading: false })
$e('a:links:link')
}

5
packages/nc-gui/context/index.ts

@ -23,11 +23,12 @@ export const ActiveViewInj: InjectionKey<Ref<ViewType>> = Symbol('active-view-in
export const ReadonlyInj: InjectionKey<Ref<boolean>> = Symbol('readonly-injection')
export const RowHeightInj: InjectionKey<Ref<1 | 2 | 4 | 6 | undefined>> = Symbol('row-height-injection')
export const ScrollParentInj: InjectionKey<Ref<HTMLElement | undefined>> = Symbol('scroll-parent-injection')
/** when bool is passed, it indicates if a loading spinner should be visible while reloading */
/** when shouldShowLoading bool is passed, it indicates if a loading spinner should be visible while reloading */
export const ReloadViewDataHookInj: InjectionKey<EventHook<{ shouldShowLoading?: boolean; offset?: number } | void>> =
Symbol('reload-view-data-injection')
export const ReloadViewMetaHookInj: InjectionKey<EventHook<boolean | void>> = Symbol('reload-view-meta-injection')
export const ReloadRowDataHookInj: InjectionKey<EventHook<boolean | void>> = Symbol('reload-row-data-injection')
export const ReloadRowDataHookInj: InjectionKey<EventHook<{ shouldShowLoading?: boolean; offset?: number } | void>> =
Symbol('reload-row-data-injection')
export const OpenNewRecordFormHookInj: InjectionKey<EventHook<void>> = Symbol('open-new-record-form-injection')
export const FieldsInj: InjectionKey<Ref<ColumnType[]>> = Symbol('fields-injection')
export const EditModeInj: InjectionKey<Ref<boolean>> = Symbol('edit-mode-injection')

Loading…
Cancel
Save