Browse Source

fix(nc-gui): use radio inputs instead of select for prefilled mode select

pull/7786/head
Ramesh Mane 9 months ago
parent
commit
a454349a47
  1. 67
      packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue
  2. 2
      packages/nc-gui/components/smartsheet/Form.vue
  3. 3
      packages/nc-gui/lang/en.json
  4. 2
      packages/nc-gui/lib/enums.ts

67
packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue

@ -154,7 +154,7 @@ const surveyMode = computed({
const formPreFill = computed({ const formPreFill = computed({
get: () => ({ get: () => ({
preFillEnabled: parseProp(activeView.value?.meta)?.preFillEnabled ?? false, preFillEnabled: parseProp(activeView.value?.meta)?.preFillEnabled ?? false,
preFilledMode: parseProp(activeView.value?.meta)?.preFilledMode || t('general.default'), preFilledMode: parseProp(activeView.value?.meta)?.preFilledMode || PreFilledMode.Default,
}), }),
set: (value) => { set: (value) => {
if (!activeView.value?.meta) return if (!activeView.value?.meta) return
@ -164,7 +164,7 @@ const formPreFill = computed({
} }
if (formPreFill.value.preFilledMode !== value.preFilledMode) { if (formPreFill.value.preFilledMode !== value.preFilledMode) {
$e(`a:view:share:${value.preFillEnabled || 'default'}-prefilled-mode`) $e(`a:view:share:${value.preFilledMode}-prefilled-mode`)
} }
activeView.value.meta = { activeView.value.meta = {
@ -361,9 +361,11 @@ watchEffect(() => {})
<template v-if="activeView?.type === ViewTypes.FORM"> <template v-if="activeView?.type === ViewTypes.FORM">
<div class="flex flex-row items-center justify-between"> <div class="flex flex-row items-center justify-between">
<div class="text-black"> <div class="text-black flex items-center space-x-1">
{{ $t('activity.surveyMode') }} <div>
<NcTooltip class="inline"> {{ $t('activity.surveyMode') }}
</div>
<NcTooltip>
<template #title> {{ $t('tooltip.surveyFormInfo') }}</template> <template #title> {{ $t('tooltip.surveyFormInfo') }}</template>
<GeneralIcon icon="info" class="text-gray-600 cursor-pointer"></GeneralIcon> <GeneralIcon icon="info" class="text-gray-600 cursor-pointer"></GeneralIcon>
</NcTooltip> </NcTooltip>
@ -393,15 +395,17 @@ watchEffect(() => {})
class="nc-pre-filled-mode-wrapper flex flex-col justify-between gap-y-3 mt-1 py-2 px-3 bg-gray-50 rounded-md" class="nc-pre-filled-mode-wrapper flex flex-col justify-between gap-y-3 mt-1 py-2 px-3 bg-gray-50 rounded-md"
> >
<div class="flex flex-row items-center justify-between"> <div class="flex flex-row items-center justify-between">
<div class="text-black flex-1"> <div class="text-black flex items-center space-x-1">
{{ $t('activity.preFilledFields.title') }} <div>
{{ $t('activity.preFilledFields.title') }}
</div>
<NcTooltip class="inline"> <NcTooltip>
<template #title <template #title>
><div class="text-center"> <div class="text-center">
{{ $t('tooltip.preFillFormInfo') }} {{ $t('tooltip.preFillFormInfo') }}
</div></template </div>
> </template>
<GeneralIcon icon="info" class="text-gray-600 cursor-pointer"></GeneralIcon> <GeneralIcon icon="info" class="text-gray-600 cursor-pointer"></GeneralIcon>
</NcTooltip> </NcTooltip>
</div> </div>
@ -422,12 +426,10 @@ watchEffect(() => {})
</a-switch> </a-switch>
</div> </div>
<a-select <a-radio-group
v-if="formPreFill.preFillEnabled" v-if="formPreFill.preFillEnabled"
:value="formPreFill.preFilledMode" :value="formPreFill.preFilledMode || ''"
:allow-clear="formPreFill.preFilledMode !== t('general.default')" class="nc-field-layout-list"
class="nc-pre-filled-mode !rounded-md w-full !mt-0"
dropdown-class-name="nc-dropdown-pre-filled-mode border-1 !rounded-md border-gray-200"
data-testid="nc-modal-share-view__preFillMode" data-testid="nc-modal-share-view__preFillMode"
@update:value=" @update:value="
(value) => { (value) => {
@ -438,23 +440,10 @@ watchEffect(() => {})
} }
" "
> >
<template #suffixIcon> <a-radio v-for="mode of Object.values(PreFilledMode)" :key="mode" :value="mode">
<GeneralIcon icon="arrowDown" class="text-gray-700" /> <div class="flex-1">{{ $t(`activity.preFilledFields.${mode || Default}`) }}</div>
</template> </a-radio>
<template v-for="mode of Object.values(PreFilledMode)" :key="mode"> </a-radio-group>
<a-select-option v-if="mode !== PreFilledMode.Default" :value="mode">
<div class="flex gap-2 items-center">
<div class="flex-1">{{ $t(`activity.preFilledFields.${mode}`) }}</div>
<component
:is="iconMap.check"
v-if="formPreFill.preFilledMode === mode"
id="nc-selected-item-icon"
class="text-primary w-4 h-4"
/>
</div>
</a-select-option>
</template>
</a-select>
</div> </div>
</template> </template>
</div> </div>
@ -479,14 +468,4 @@ watchEffect(() => {})
line-height: 1rem !important; line-height: 1rem !important;
} }
} }
.nc-pre-filled-mode-wrapper {
.nc-pre-filled-mode.ant-select {
@apply !p-0 mt-2;
&.ant-select-focused:not(.ant-select-disabled).ant-select:not(.ant-select-customize-input) .ant-select-selector {
@apply !border-brand-500 !shadow-none;
}
}
}
</style> </style>

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

@ -669,7 +669,7 @@ useEventListener(
(e: KeyboardEvent) => { (e: KeyboardEvent) => {
const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey const cmdOrCtrl = isMac() ? e.metaKey : e.ctrlKey
switch (e.key.toLowerCase()) { switch (e.key?.toLowerCase()) {
case 's': case 's':
if ( if (
cmdOrCtrl && cmdOrCtrl &&

3
packages/nc-gui/lang/en.json

@ -929,6 +929,7 @@
"selectAllFields": "Select all fields", "selectAllFields": "Select all fields",
"preFilledFields": { "preFilledFields": {
"title": "Enable Pre-fill", "title": "Enable Pre-fill",
"default": "Default",
"locked": "Lock pre-filled fields as read-only", "locked": "Lock pre-filled fields as read-only",
"hidden": "Hide pre-filled fields", "hidden": "Hide pre-filled fields",
"lockedFieldTooltip": "Pre-filled value" "lockedFieldTooltip": "Pre-filled value"
@ -964,7 +965,7 @@
"clientKey": "Select .key file", "clientKey": "Select .key file",
"clientCert": "Select .cert file", "clientCert": "Select .cert file",
"clientCA": "Select CA file", "clientCA": "Select CA file",
"preFillFormInfo": "To get a prefilled link, make sure you’ve filled the necessary fields in the form view builder.", "preFillFormInfo": "Generate share form URL with pre-filled field data. To get a pre-filled link, make sure you’ve filled the necessary fields in the form view builder.",
"surveyFormInfo": "Form mode with one field per page" "surveyFormInfo": "Form mode with one field per page"
}, },
"placeholder": { "placeholder": {

2
packages/nc-gui/lib/enums.ts

@ -138,7 +138,7 @@ export enum ImportSource {
} }
export enum PreFilledMode { export enum PreFilledMode {
Default = '', Default = 'default',
Locked = 'locked', Locked = 'locked',
Hidden = 'hidden', Hidden = 'hidden',
} }

Loading…
Cancel
Save