Skip to content

Commit

Permalink
Merge pull request #8180 from nocodb/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 4, 2024
2 parents eea9233 + e721491 commit d826bf1
Show file tree
Hide file tree
Showing 36 changed files with 477 additions and 197 deletions.
14 changes: 8 additions & 6 deletions packages/nc-gui/components/cell/Url.vue
Expand Up @@ -47,28 +47,30 @@ const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!
const isForm = inject(IsFormInj)!
const trim = (val: string) => val?.trim?.()
// Used in the logic of when to display error since we are not storing the url if it's not valid
const localState = ref(value)
const vModel = computed({
get: () => value,
set: (val) => {
localState.value = val
if (!parseProp(column.value.meta)?.validate || (val && isValidURL(val)) || !val || isForm.value) {
if (!parseProp(column.value.meta)?.validate || (val && isValidURL(trim(val))) || !val || isForm.value) {
emit('update:modelValue', val)
}
},
})
const isValid = computed(() => value && isValidURL(value))
const isValid = computed(() => value && isValidURL(trim(value)))
const url = computed(() => {
if (!value || !isValidURL(value)) return ''
if (!value || !isValidURL(trim(value))) return ''
/** add url scheme if missing */
if (/^https?:\/\//.test(value)) return value
if (/^https?:\/\//.test(trim(value))) return trim(value)
return `https://${value}`
return `https://${trim(value)}`
})
const { cellUrlOptions } = useCellUrlConfig(url)
Expand All @@ -84,7 +86,7 @@ watch(
parseProp(column.value.meta)?.validate &&
!editEnabled.value &&
localState.value &&
!isValidURL(localState.value)
!isValidURL(trim(localState.value))
) {
message.error(t('msg.error.invalidURL'))
localState.value = undefined
Expand Down
2 changes: 1 addition & 1 deletion packages/nc-gui/components/smartsheet/Topbar.vue
Expand Up @@ -29,7 +29,7 @@ const isSharedBase = computed(() => route.value.params.typeOrId === 'base')
<GeneralOpenLeftSidebarBtn />
<LazySmartsheetToolbarViewInfo v-if="!isPublic" />

<div v-if="!isSharedBase && !isMobileMode" class="w-47.5">
<div v-if="!isSharedBase && !isMobileMode">
<SmartsheetTopbarSelectMode />
</div>
<div class="flex-1" />
Expand Down
Expand Up @@ -81,7 +81,7 @@ const {
activeView,
parentId?.value,
computed(() => autoSave.value),
() => reloadDataHook.trigger({ shouldShowLoading: showLoading.value }),
() => reloadDataHook.trigger({ shouldShowLoading: showLoading.value, offset: 0 }),
modelValue.value || nestedFilters.value,
!modelValue.value,
webHook.value,
Expand Down
6 changes: 3 additions & 3 deletions packages/nc-gui/components/smartsheet/topbar/SelectMode.vue
Expand Up @@ -62,9 +62,9 @@ const onClickDetails = () => {
}
.tab .tab-title {
@apply min-w-0;
word-break: 'keep-all';
white-space: 'nowrap';
display: 'inline';
word-break: keep-all;
white-space: nowrap;
display: inline;
line-height: 0.95;
}
Expand Down
Expand Up @@ -51,7 +51,7 @@ const {
unlink,
row,
headerDisplayValue,
resetChildrenExcludedOffsetCount
resetChildrenExcludedOffsetCount,
} = useLTARStoreOrThrow()
const { addLTARRef, isNew, removeLTARRef, state: rowState } = useSmartsheetRowStoreOrThrow()
Expand Down Expand Up @@ -102,7 +102,7 @@ watch(
}
loadChildrenExcludedList(rowState.value)
}
if(!nextVal){
if (!nextVal) {
resetChildrenExcludedOffsetCount()
}
},
Expand Down Expand Up @@ -262,7 +262,7 @@ onUnmounted(() => {
})
const onFilterChange = () => {
childrenExcludedListPagination.page = 1;
childrenExcludedListPagination.page = 1
resetChildrenExcludedOffsetCount()
}
</script>
Expand Down
7 changes: 4 additions & 3 deletions packages/nc-gui/composables/useLTARStore.ts
Expand Up @@ -191,7 +191,8 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
const loadChildrenExcludedList = async (activeState?: any) => {
if (activeState) newRowState.state = activeState
try {
let offset = childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1) - childrenExcludedOffsetCount.value
let offset =
childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1) - childrenExcludedOffsetCount.value

if (offset < 0) {
offset = 0
Expand Down Expand Up @@ -550,8 +551,8 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
})
})

const resetChildrenExcludedOffsetCount = () =>{
childrenExcludedOffsetCount.value = 0;
const resetChildrenExcludedOffsetCount = () => {
childrenExcludedOffsetCount.value = 0
}

const resetChildrenListOffsetCount = () => {
Expand Down
41 changes: 23 additions & 18 deletions packages/nc-gui/composables/useSharedFormViewStore.ts
Expand Up @@ -132,25 +132,27 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
{} as Record<string, FormColumnType>,
)

columns.value = viewMeta.model?.columns?.map((c) => {
if (
!isSystemColumn(c) &&
!isVirtualCol(c) &&
!isAttachment(c) &&
c.uidt !== UITypes.SpecificDBType &&
c?.title &&
c?.cdf &&
!/^\w+\(\)|CURRENT_TIMESTAMP$/.test(c.cdf)
) {
formState.value[c.title] = typeof c.cdf === 'string' ? c.cdf.replace(/^'|'$/g, '') : c.cdf
}
columns.value = (viewMeta.model?.columns || [])
.filter((c) => fieldById[c.id])
.map((c) => {
if (
!isSystemColumn(c) &&
!isVirtualCol(c) &&
!isAttachment(c) &&
c.uidt !== UITypes.SpecificDBType &&
c?.title &&
c?.cdf &&
!/^\w+\(\)|CURRENT_TIMESTAMP$/.test(c.cdf)
) {
formState.value[c.title] = typeof c.cdf === 'string' ? c.cdf.replace(/^'|'$/g, '') : c.cdf
}

return {
...c,
meta: { ...parseProp(fieldById[c.id].meta), ...parseProp(c.meta) },
description: fieldById[c.id].description,
}
})
return {
...c,
meta: { ...parseProp(fieldById[c.id].meta), ...parseProp(c.meta) },
description: fieldById[c.id].description,
}
})

const _sharedViewMeta = (viewMeta as any).meta
sharedViewMeta.value = isString(_sharedViewMeta) ? JSON.parse(_sharedViewMeta) : _sharedViewMeta
Expand Down Expand Up @@ -188,6 +190,9 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
if (password.value && password.value !== '') {
passwordError.value = error.message
}
} else if (error.error === NcErrorType.UNKNOWN_ERROR) {
console.error('Error occurred while loading shared form view', e)
message.error('Error occurred while loading shared form view')
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nc-gui/lang/pl.json
Expand Up @@ -701,7 +701,7 @@
"hideNocodbBranding": "Ukryj branding NocoDB",
"showOnConditions": "Pokaż na warunkach",
"showFieldOnConditionsMet": "Pokazuje pole tylko, gdy spełnione są warunki",
"limitOptions": "Limit options",
"limitOptions": "Ogranicz opcje",
"limitOptionsSubtext": "Ogranicz opcje widoczne dla użytkowników, wybierając dostępne opcje",
"clearSelection": "Wyczyść wybór"
},
Expand Down
56 changes: 28 additions & 28 deletions packages/nc-gui/lang/ru.json
Expand Up @@ -157,8 +157,8 @@
"groupingField": "Поле группировки",
"insertAfter": "Вставить после",
"insertBefore": "Вставить перед",
"insertAbove": "Insert above",
"insertBelow": "Insert below",
"insertAbove": "Вставить выше",
"insertBelow": "Вставить ниже",
"hideField": "Скрыть поле",
"sortAsc": "По Возрастанию",
"sortDesc": "По убыванию",
Expand Down Expand Up @@ -192,21 +192,21 @@
"enter": "Вход",
"seconds": "Секунды",
"paste": "Вставить",
"restore": "Restore",
"replace": "Replace",
"banner": "Banner",
"logo": "Logo",
"dropdown": "Dropdown",
"list": "List",
"apply": "Apply",
"text": "Text",
"appearance": "Appearance"
"restore": "Восстановить",
"replace": "Заменить",
"banner": "Баннер",
"logo": "Логотип",
"dropdown": "Выпадающий список",
"list": "Список",
"apply": "Применить",
"text": "Текст",
"appearance": "Внешний вид"
},
"objects": {
"day": "Day",
"week": "Week",
"month": "Month",
"year": "Year",
"day": "День",
"week": "Неделя",
"month": "Месяц",
"year": "Год",
"workspace": "Рабочее пространство",
"workspaces": "Рабочие пространства",
"project": "Проект",
Expand Down Expand Up @@ -313,7 +313,7 @@
"isNotNull": "не равно Null"
},
"title": {
"sso": "Authentication (SSO)",
"sso": "Аутентификация (SSO)",
"docs": "Документация",
"forum": "Форум",
"parameter": "Параметр",
Expand Down Expand Up @@ -341,7 +341,7 @@
"removeFile": "Удалить файл",
"hasMany": "Имеет много",
"manyToMany": "Многие ко многим",
"oneToOne": "One to One",
"oneToOne": "Один к одному",
"virtualRelation": "Виртуальные отношения",
"linkMore": "Ссылка Подробнее",
"linkMoreRecords": "Связать больше записей",
Expand Down Expand Up @@ -436,22 +436,22 @@
"surveyFormSubmitConfirmMsg": "Are you sure you want to submit this form?"
},
"labels": {
"selectYear": "Select Year",
"save": "Save",
"cancel": "Cancel",
"selectYear": "Выберите год",
"save": "Сохранить",
"cancel": "Отмена",
"metadataUrl": "Metadata URL",
"audience-entityId": "Audience/ Entity ID",
"redirectUrl": "Redirect URL",
"oidc": "OpenID Connect (OIDC)",
"saml": "Security Assertion Markup Language (SAML)",
"newProvider": "New Provider",
"generalSettings": "General Settings",
"ssoSettings": "SSO Settings",
"ssoSettings": "Настройки SSO",
"organizeBy": "Organize by",
"previous": "Previous",
"nextMonth": "Next Month",
"previousMonth": "Previous Month",
"next": "Next",
"previous": "Предыдущий",
"nextMonth": "Следующий месяц",
"previousMonth": "Предыдущий месяц",
"next": "Следующий",
"organiseBy": "Organise by",
"heading1": "Заголовок 1",
"heading2": "Заголовок 2",
Expand Down Expand Up @@ -573,7 +573,7 @@
"where": "Где",
"cache": "Кэш",
"chat": "Чат",
"showOrHide": "Show or Hide",
"showOrHide": "Показать / Скрыть",
"airtable": "Airtable",
"csv": "CSV",
"csvFile": "Файл CSV",
Expand All @@ -589,7 +589,7 @@
"created": "Созданный",
"sqlOutput": "Вывод SQL",
"addOption": "Добавить настройку",
"interfaceColor": "Interface Color",
"interfaceColor": "Цвет интерфейса",
"qrCodeValueColumn": "Столбец с QR-кодом",
"barcodeValueColumn": "Колонка со значением штрих-кода",
"barcodeFormat": "Формат штрих-кода",
Expand Down Expand Up @@ -618,7 +618,7 @@
"joinCommunity": "Сообщество NocoDB",
"joinReddit": "Присоединиться /r/NocoDB",
"followNocodb": "Следите за NocoDB",
"communityTranslated": "(Community Translated)"
"communityTranslated": "(Перевод сообщества)"
},
"twitter": "Twitter",
"docReference": "Ссылка на документ",
Expand Down
36 changes: 22 additions & 14 deletions packages/noco-docs/docs/090.views/040.view-types/030.form.md
Expand Up @@ -32,7 +32,7 @@ Form view builder layout can be divided into 4 sections:
In the **Form View** area, click on in input boxes provided for **Title** & **Description** to add/update title & description to the form.

:::info
Formatting options are supported for the description field. You can also use markdown to format the text.
Formatting options are supported for the description field. You can also use Markdown to format the text.
:::

![Form Title & Description](/img/v2/views/form-view/title-description.png)
Expand Down Expand Up @@ -80,19 +80,19 @@ NocoDB allows you to configure the form view to perform various actions after a
![Form View Settings](/img/v2/views/form-view/post-submit-settings.png)

:::info
Formatting options are supported for the `After Submit Message` field. You can also use markdown to format the text.
Formatting options are supported for the `After Submit Message` field. You can also use Markdown to format the text.
:::

## Field configuration
To change the field label displayed on the form & add help-text, click on the required field in the **Form Area** and on the right side configuration panel, configure
1. **Label** `Opitonal` : Defaults to the field name. This doesn't affect the field name in the table.
1. **Label** `Optional` : Defaults to the field name. This doesn't affect the field name in the table.
2. **Help Text** `Optional`
3. **Required** : Toggle to mark the field as required

![Field Label & Help Text](/img/v2/views/form-view/field-config.png)

:::info
Formatting options are supported for the `Help Text` field. You can also use markdown to format the text.
Formatting options are supported for the `Help Text` field. You can also use Markdown to format the text.
:::

### Field Type Specific Settings
Expand All @@ -111,14 +111,22 @@ For select based field types, you can configure the options layout to be display
![Options Layout](/img/v2/views/form-view/options-layout.png)

## Prefill Form Fields
Prefilling form fields is a way to pre-populate form fields with default values. This can be useful when you want to save time for users by prefilling some fields with default values. The prefilled fields and their values are visible in the URL of the form view & can be manually constructed by ensuring URL parameters are appropriately encoded.
Here's a more professional rephrasing of the given content:

## Pre-Filling Form Fields
NocoDB offers a convenient feature that allows pre-filling form fields with specific values by setting URL parameters. This functionality enables the creation of custom URLs with desired field values, streamlining data entry and enhancing user experience.

To construct a pre-filled form URL manually, ensure that the URL parameters are appropriately encoded in the following format: `?key1=value1&key2=value2`.

For instance, the URL `https://wh8s5w.noco.to/#/nc/form/66da06-f074-47af-ace7-fde46df55?Status=Qualification&Priority=Very+high` pre-fills the `Status` field with `Qualification` and the `Priority` field with `Very high`.

NocoDB provides an intuitive alternative approach to generate pre-filled URLs through the form builder.
1. Open the form builder and pre-fill the required form fields with the desired values.
2. Click on the `Share` button located in the top right corner.
3. Toggle the `Enable Public Viewing` button to enable sharing.
4. Toggle the `Enable Prefill` button to enable pre-filling.
5. Click on the `Copy Link` button to copy the pre-filled URL.

NocoDB provides an easier approach to construct prefilled URLs. One can use the form builder to prefill form fields with default values & auto-generate encoded prefilled URL. Follow the below steps to prefill form fields & generate a prefilled URL -
1. Open the form builder, prefill the required form fields with default values.
2. Click on the `Share` button in the top right corner.
3. Toggle `Enable Public Viewing` button to enable share.
4. Toggle `Enable Prefill` button to enable prefill.
5. Click on the `Copy Link` button to copy the link.

![Prefill](/img/v2/views/form-view/prefill.png)
![Prefill share](/img/v2/views/form-view/prefill-share.png)
Expand All @@ -129,15 +137,15 @@ NocoDB provides an easier approach to construct prefilled URLs. One can use the
:::

### Prefill modes
1. **Default**: Standard mode. This mode will prefill the form fields with the default values set in the form builder. Users can edit the prefilled fields. When shared, the prefilled fields will be visible in the URL. In the image below, the `Number` field is prefilled with the value `1234`, `Currency` field is prefilled with the value `1000` and `Year` field is prefilled with value `2023`.
1. **Default**: Standard mode. This mode will prefill the form fields with the values set in the shared form URL. Users can edit the prefilled fields in the form. In the image below, the `Number` field is prefilled with the value `1234`, `Currency` field is prefilled with the value `1000` and `Year` field is prefilled with value `2023`.

![Prefill default](/img/v2/views/form-view/prefill-default.png)

2. **Hide prefilled fields**: This mode will prefill the form fields with the default values set in the form builder but will hide the prefilled fields from the user. When shared, the prefilled fields will be visible in the URL. In the image below, the `Number` field is prefilled with the value `1234`, `Currency` field is prefilled with the value `1000` and `Year` field is prefilled with value `2023`.
2. **Hide prefilled fields**: This mode will prefill the form fields with the values set in the shared form URL but will hide the prefilled fields in the form from the user. In the image below, the `Number` field is prefilled with the value `1234`, `Currency` field is prefilled with the value `1000` and `Year` field is prefilled with value `2023`.

![Prefill hide](/img/v2/views/form-view/prefill-hide.png)

3. **Lock prefilled fields as read-only**: This mode will prefill the form fields with the default values set in the form builder and will lock the prefilled fields as read-only. When shared, the prefilled fields will be visible in the URL. In the image below, the `Number` field is prefilled with the value `1234`, `Currency` field is prefilled with the value `1000` and `Year` field is prefilled with value `2023`.
3. **Lock prefilled fields as read-only**: This mode will prefill the form fields with the values set in the shared form URL and will lock the prefilled fields as read-only. In the image below, the `Number` field is prefilled with the value `1234`, `Currency` field is prefilled with the value `1000` and `Year` field is prefilled with value `2023`.

![Prefill lock](/img/v2/views/form-view/prefill-lock.png)

Expand Down

0 comments on commit d826bf1

Please sign in to comment.