多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.5 KiB

<script lang="ts" setup>
import { type ColumnType, isSystemColumn } from 'nocodb-sdk'
const props = defineProps<{
// As we need to focus search box when the parent is opened
isParentOpen: boolean
toolbarMenu: 'groupBy' | 'sort' | 'globalSearch'
searchInputPlaceholder?: string
selectedOptionId?: string
options: ColumnType[]
showSelectedOption?: boolean
}>()
const emits = defineEmits<{ selected: [ColumnType] }>()
const { isParentOpen, toolbarMenu, searchInputPlaceholder, selectedOptionId, showSelectedOption } = toRefs(props)
const { fieldsMap, isLocalMode } = useViewColumnsOrThrow()
const options = computed(() =>
(props.options || [])
.filter((c) => (isLocalMode.value && c?.id && fieldsMap.value[c.id] ? fieldsMap.value[c.id]?.initialShow : true))
.map((c) => c)
.sort((field1, field2) => {
// sort by view column order and keep system columns at the end
let orderVal1 = 0
let orderVal2 = 0
let sortByOrder = 0
if (isSystemColumn(field1)) {
orderVal1 = 1
}
if (isSystemColumn(field2)) {
orderVal2 = 1
}
if (
field1?.id &&
field2?.id &&
fieldsMap.value[field1.id]?.order !== undefined &&
fieldsMap.value[field2.id]?.order !== undefined
) {
sortByOrder = fieldsMap.value[field1.id].order - fieldsMap.value[field2.id].order
}
return orderVal1 - orderVal2 || sortByOrder
}),
)
const configByToolbarMenu = computed(() => {
switch (toolbarMenu.value) {
case 'groupBy':
return {
selectOptionEvent: ['c:group-by:add:column:select'],
optionClassName: 'nc-group-by-column-search-item',
}
case 'sort':
return {
selectOptionEvent: ['c:sort:add:column:select'],
optionClassName: 'nc-sort-column-search-item',
}
case 'globalSearch':
return {
selectOptionEvent: ['c:search:field:select'],
optionClassName: '',
}
default:
return {
selectOptionEvent: undefined,
optionClassName: '',
}
}
})
</script>
<template>
feat: button field (#9144) * feat: static button type * fix: swagger * fix: style corrections * feat: webhook trigger * fix: disables * feat: Button icons fix: row Delete failing * fix: expanded-form ux fix: disable buttons in forms fix: update PlainCell button handling fix: webhook delete, active change handling * fix: disable case * fix: disable case * fix: update Button styles * fix: refactor min/max with limit for columns fix: disable filter, groupby for Button Field fix: disable aggregation for Buttons * fix: hide button field in Filters * fix: fields menu corrections fix: update menu corrections * fix: rebase * feat: support webhook creation from ButtonOptions * fix: sort related tests * fix: keep webhook modal open * fix: ui fixes * fix: icon duplicate * fix: syntax highlighing for handlebar fix: disable mascot fix: truncate selected webhook * fix: sort disable tooltip * test: button playwright test * fix: button column duplication * fix: add error fix: column options * fix: EditOrAddProvider.vue * fix: add invalid configuration * fix: ux corrections * fix: ux corrections * fix: error handling fix: clear single query cache on hook delete * fix: include button type in api * fix: update overlay styles fix: webhook update * fix: formula placeholder * fix: playwright tests * fix: playwright tests * feat: refactor formula input * fix: added more spacing * fix: no icon text * fix: lint * fix: handle invalid url * fix: handle sort by for button causes issue when button used as lookup * fix: button field position * docs: button field * fix: tooltip correction * fix: link * fix: add btn href * fix: handle some edge cases * fix: handle some edge cases * fix: update font color * fix: add manual trigger docs * fix: sqlite BaseModel fix * docs: button share view info * fix: rebase * fix: reduce height and added resize support fix: added tooltip if label overflow * fix: manual hook disable state * docs: manual trigger details in webhook page * fix: chevron grey shade to 500 * docs: sample payload for manual trigger * fix: style update * fix: pr review comments * fix: pr review changes * fix: reactivity issue * fix: reactivity issue * fix: filter enabled on button * fix: reload meta on webhook change * fix: error handling in formula filter * fix: handle url error --------- Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
3 months ago
<NcListWithSearch
:is-parent-open="isParentOpen"
:search-input-placeholder="searchInputPlaceholder"
:option-config="configByToolbarMenu"
:options="options"
:selected-option-id="selectedOptionId"
filter-field="title"
:show-selected-option="showSelectedOption"
@selected="emits('selected', $event)"
>
feat: button field (#9144) * feat: static button type * fix: swagger * fix: style corrections * feat: webhook trigger * fix: disables * feat: Button icons fix: row Delete failing * fix: expanded-form ux fix: disable buttons in forms fix: update PlainCell button handling fix: webhook delete, active change handling * fix: disable case * fix: disable case * fix: update Button styles * fix: refactor min/max with limit for columns fix: disable filter, groupby for Button Field fix: disable aggregation for Buttons * fix: hide button field in Filters * fix: fields menu corrections fix: update menu corrections * fix: rebase * feat: support webhook creation from ButtonOptions * fix: sort related tests * fix: keep webhook modal open * fix: ui fixes * fix: icon duplicate * fix: syntax highlighing for handlebar fix: disable mascot fix: truncate selected webhook * fix: sort disable tooltip * test: button playwright test * fix: button column duplication * fix: add error fix: column options * fix: EditOrAddProvider.vue * fix: add invalid configuration * fix: ux corrections * fix: ux corrections * fix: error handling fix: clear single query cache on hook delete * fix: include button type in api * fix: update overlay styles fix: webhook update * fix: formula placeholder * fix: playwright tests * fix: playwright tests * feat: refactor formula input * fix: added more spacing * fix: no icon text * fix: lint * fix: handle invalid url * fix: handle sort by for button causes issue when button used as lookup * fix: button field position * docs: button field * fix: tooltip correction * fix: link * fix: add btn href * fix: handle some edge cases * fix: handle some edge cases * fix: update font color * fix: add manual trigger docs * fix: sqlite BaseModel fix * docs: button share view info * fix: rebase * fix: reduce height and added resize support fix: added tooltip if label overflow * fix: manual hook disable state * docs: manual trigger details in webhook page * fix: chevron grey shade to 500 * docs: sample payload for manual trigger * fix: style update * fix: pr review comments * fix: pr review changes * fix: reactivity issue * fix: reactivity issue * fix: filter enabled on button * fix: reload meta on webhook change * fix: error handling in formula filter * fix: handle url error --------- Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
3 months ago
<template #default="{ option }">
<SmartsheetHeaderIcon :column="option" class="!w-3.5 !h-3.5 !text-gray-500" />
</template>
</NcListWithSearch>
</template>