mirror of
https://github.com/nocodb/nocodb.git
synced 2026-02-02 02:37:33 +00:00
Merge pull request #9469 from nocodb/nc-fix/at-button-ph
This commit is contained in:
@@ -26,7 +26,8 @@ const vModel = useVModel(props, 'value', emit)
|
||||
|
||||
const meta = inject(MetaInj, ref())
|
||||
|
||||
const { isEdit, setAdditionalValidations, validateInfos, sqlUi, column, isWebhookCreateModalOpen } = useColumnCreateStoreOrThrow()
|
||||
const { isEdit, setAdditionalValidations, validateInfos, sqlUi, column, isWebhookCreateModalOpen, validate } =
|
||||
useColumnCreateStoreOrThrow()
|
||||
|
||||
const uiTypesNotSupportedInFormulas = [UITypes.QrCode, UITypes.Barcode, UITypes.Button]
|
||||
|
||||
@@ -77,7 +78,7 @@ const validators = {
|
||||
validator: (_: any, formula: any) => {
|
||||
return (async () => {
|
||||
if (vModel.value.type === 'url') {
|
||||
if (!formula?.trim()) throw new Error('Required')
|
||||
if (!formula?.trim()) throw new Error('Formula is required for URL Button')
|
||||
|
||||
try {
|
||||
await validateFormulaAndExtractTreeWithType({
|
||||
@@ -191,6 +192,8 @@ if ((column.value?.colOptions as any)?.formula_raw) {
|
||||
meta?.value?.columns as ColumnType[],
|
||||
(column.value?.colOptions as any)?.formula_raw,
|
||||
) || ''
|
||||
} else {
|
||||
vModel.value.formula_raw = ''
|
||||
}
|
||||
|
||||
const colorClass = {
|
||||
|
||||
@@ -503,6 +503,19 @@ export default class Column<T = any> implements ColumnType {
|
||||
break;
|
||||
case UITypes.Button:
|
||||
res = await ButtonColumn.read(context, this.id, ncMeta);
|
||||
|
||||
// add default values if options are missing
|
||||
if (!res) {
|
||||
res = {
|
||||
type: 'url',
|
||||
theme: 'solid',
|
||||
color: 'brand',
|
||||
label: 'Button',
|
||||
error: 'Invalid configuration',
|
||||
formula_raw: '',
|
||||
};
|
||||
}
|
||||
|
||||
break;
|
||||
case UITypes.QrCode:
|
||||
res = await QrCodeColumn.read(context, this.id, ncMeta);
|
||||
|
||||
Reference in New Issue
Block a user