mirror of https://github.com/nocodb/nocodb
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.
1232 lines
38 KiB
1232 lines
38 KiB
3 years ago
|
<template>
|
||
3 years ago
|
<v-container fluid class="h-100 py-0">
|
||
3 years ago
|
<v-row class="h-100 my-0" :class="{ 'd-flex justify-center': submitted }">
|
||
3 years ago
|
<template v-if="submitted">
|
||
|
<v-col class="d-flex justify-center">
|
||
3 years ago
|
<div v-if="view" style="min-width: 350px">
|
||
3 years ago
|
<v-alert type="success" outlined>
|
||
3 years ago
|
<span class="title">{{
|
||
|
view.success_msg || "Successfully submitted form data"
|
||
|
}}</span>
|
||
3 years ago
|
</v-alert>
|
||
3 years ago
|
<p
|
||
|
v-if="view.show_blank_form"
|
||
|
class="caption grey--text text-center"
|
||
|
>
|
||
3 years ago
|
New form will be loaded after {{ secondsRemain }} seconds
|
||
|
</p>
|
||
3 years ago
|
<div v-if="view.submit_another_form" class="text-center">
|
||
3 years ago
|
<v-btn color="primary" @click="submitted = false">
|
||
|
Submit Another Form
|
||
|
</v-btn>
|
||
3 years ago
|
</div>
|
||
|
</div>
|
||
3 years ago
|
</v-col>
|
||
|
</template>
|
||
|
<template v-else>
|
||
|
<v-col v-if="isEditable" class="h-100 col-md-4 col-lg-3">
|
||
3 years ago
|
<v-card
|
||
|
class="h-100 overflow-auto pa-4 pa-md-6 backgroundColor elevation-0 nc-form-left-nav"
|
||
|
>
|
||
3 years ago
|
<div class="d-flex grey--text">
|
||
3 years ago
|
<span class="">
|
||
|
<!--Fields-->
|
||
3 years ago
|
{{ $t("objects.fields") }}
|
||
3 years ago
|
</span>
|
||
3 years ago
|
<v-spacer />
|
||
|
<span
|
||
3 years ago
|
v-if="hiddenColumns.length"
|
||
3 years ago
|
class="pointer caption mr-2"
|
||
3 years ago
|
style="border-bottom: 2px solid rgb(218, 218, 218)"
|
||
3 years ago
|
@click="addAllColumns()"
|
||
3 years ago
|
>
|
||
3 years ago
|
<!--Add all-->
|
||
3 years ago
|
{{ $t("general.addAll") }}
|
||
3 years ago
|
</span>
|
||
3 years ago
|
<span
|
||
|
v-if="columns.length"
|
||
|
class="pointer caption"
|
||
3 years ago
|
style="border-bottom: 2px solid rgb(218, 218, 218)"
|
||
3 years ago
|
@click="removeAllColumns"
|
||
3 years ago
|
>
|
||
3 years ago
|
<!--Remove all-->
|
||
3 years ago
|
{{ $t("general.removeAll") }}
|
||
3 years ago
|
</span>
|
||
3 years ago
|
</div>
|
||
|
<draggable
|
||
3 years ago
|
v-if="showFields"
|
||
3 years ago
|
v-model="hiddenColumns"
|
||
|
draggable=".item"
|
||
|
group="form-inputs"
|
||
3 years ago
|
@start="drag = true"
|
||
|
@end="drag = false"
|
||
3 years ago
|
>
|
||
3 years ago
|
<v-card
|
||
3 years ago
|
v-for="col in hiddenColumns"
|
||
3 years ago
|
:key="col.title"
|
||
3 years ago
|
class="pa-2 my-2 item pointer elevation-0"
|
||
3 years ago
|
@mousedown="moved = false"
|
||
|
@mousemove="moved = false"
|
||
3 years ago
|
@mouseup="handleMouseUp(col)"
|
||
3 years ago
|
>
|
||
3 years ago
|
<div class="d-flex">
|
||
3 years ago
|
<label
|
||
|
:for="`data-table-form-${col.title}`"
|
||
|
class="body-2 text-capitalize flex-grow-1"
|
||
|
>
|
||
3 years ago
|
<virtual-header-cell
|
||
3 years ago
|
v-if="isVirtualCol(col)"
|
||
3 years ago
|
class="caption"
|
||
3 years ago
|
:column="col"
|
||
3 years ago
|
:nodes="nodes"
|
||
3 years ago
|
:is-form="true"
|
||
3 years ago
|
:meta="meta"
|
||
3 years ago
|
/>
|
||
3 years ago
|
<header-cell
|
||
3 years ago
|
v-else
|
||
3 years ago
|
class="caption"
|
||
3 years ago
|
:is-form="true"
|
||
3 years ago
|
:value="col.title"
|
||
3 years ago
|
:column="col"
|
||
|
:sql-ui="sqlUi"
|
||
|
/>
|
||
3 years ago
|
</label>
|
||
3 years ago
|
<v-icon color="grey">
|
||
|
mdi-drag
|
||
|
</v-icon>
|
||
3 years ago
|
</div>
|
||
|
</v-card>
|
||
3 years ago
|
<div
|
||
|
class="mt-4 nc-drag-n-drop-to-hide py-3 text-center grey--text text--lighter-1"
|
||
|
>
|
||
3 years ago
|
<!--Drag and drop fields here to hide-->
|
||
3 years ago
|
{{ $t("msg.info.dragDropHide") }}
|
||
3 years ago
|
</div>
|
||
|
</draggable>
|
||
|
|
||
|
<v-menu
|
||
|
v-model="addNewColMenu"
|
||
|
fixed
|
||
|
z-index="99"
|
||
|
content-class="elevation-0"
|
||
|
>
|
||
3 years ago
|
<template #activator="{ on }">
|
||
3 years ago
|
<div class="grey--text caption text-center mt-4" v-on="on">
|
||
3 years ago
|
<v-icon size="20" color="grey">
|
||
|
mdi-plus
|
||
|
</v-icon>
|
||
3 years ago
|
<!--Add new field to this table-->
|
||
3 years ago
|
{{ $t("activity.addField") }}
|
||
3 years ago
|
</div>
|
||
|
</template>
|
||
|
<edit-column
|
||
|
v-if="addNewColMenu"
|
||
|
:meta="meta"
|
||
|
:nodes="nodes"
|
||
|
:sql-ui="sqlUi"
|
||
|
@close="addNewColMenu = false"
|
||
|
@saved="onNewColCreation"
|
||
|
/>
|
||
|
</v-menu>
|
||
|
</v-card>
|
||
|
</v-col>
|
||
|
<v-col
|
||
3 years ago
|
:class="{ 'col-12': !isEditable, 'col-lg-9 col-md-8': isEditable }"
|
||
|
class="h-100 px-sm-1 px-md-10"
|
||
3 years ago
|
style="overflow-y: auto"
|
||
|
>
|
||
3 years ago
|
<!-- <pre class="caption">{{ fields }}</pre>-->
|
||
|
|
||
3 years ago
|
<!-- <div class="my-14 d-flex align-center justify-center">-->
|
||
|
<!-- <v-chip>Add cover image</v-chip>-->
|
||
|
<!-- </div>-->
|
||
3 years ago
|
<div class="nc-form-wrapper elevation-3 ma-3 pb-10">
|
||
3 years ago
|
<div class="mt-10 d-flex align-center justify-center flex-column">
|
||
3 years ago
|
<div
|
||
|
class="nc-form-banner backgroundColor darken-1 flex-column justify-center d-flex"
|
||
|
>
|
||
3 years ago
|
<div class="d-flex align-center justify-center flex-grow-1">
|
||
|
<!-- <v-chip small color="backgroundColorDefault caption grey--text">
|
||
|
Add cover image
|
||
|
</v-chip>-->
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
3 years ago
|
<div class="mx-auto nc-form elevation-3 pa-2">
|
||
3 years ago
|
<div class="nc-form-logo py-8">
|
||
|
<!-- <div v-ripple class="nc-form-add-logo text-center caption pointer" @click.stop>-->
|
||
|
<!-- Add a logo-->
|
||
|
<!-- </div>-->
|
||
|
</div>
|
||
|
<editable
|
||
|
:is="isEditable ? 'editable' : 'h2'"
|
||
3 years ago
|
v-model="view.heading"
|
||
3 years ago
|
class="display-1 font-weight-bold text-left mx-4 mb-3 px-1 text--text text--lighten-1"
|
||
|
:class="{ 'nc-meta-inputs': isEditable }"
|
||
3 years ago
|
placeholder="Form Title"
|
||
3 years ago
|
@input="updateView"
|
||
3 years ago
|
>
|
||
3 years ago
|
{{ view.heading }}
|
||
3 years ago
|
</editable>
|
||
3 years ago
|
<!--placeholder="Add form description"-->
|
||
3 years ago
|
<editable
|
||
|
:is="isEditable ? 'editable' : 'div'"
|
||
3 years ago
|
v-model="view.subheading"
|
||
3 years ago
|
:class="{ 'nc-meta-inputs': isEditable }"
|
||
|
class="body-1 text-left mx-4 py-2 px-1 text--text text--lighten-2"
|
||
3 years ago
|
:placeholder="$t('msg.info.formDesc')"
|
||
3 years ago
|
@input="updateView"
|
||
3 years ago
|
>
|
||
3 years ago
|
{{ view.subheading }}
|
||
3 years ago
|
</editable>
|
||
|
<draggable
|
||
|
v-model="columns"
|
||
|
draggable=".item"
|
||
|
group="form-inputs"
|
||
|
class="h-100"
|
||
3 years ago
|
@start="drag = true"
|
||
|
@end="drag = false"
|
||
3 years ago
|
@change="onMove($event)"
|
||
3 years ago
|
>
|
||
|
<div
|
||
3 years ago
|
v-for="(col, i) in columns"
|
||
3 years ago
|
:key="col.title"
|
||
3 years ago
|
class="nc-field-wrapper item px-4 my-3 pointer"
|
||
3 years ago
|
:class="{
|
||
|
'nc-editable': isEditable,
|
||
|
'active-row': isActiveRow(col),
|
||
|
'py-4': !isActiveRow(col),
|
||
|
'pb-4': isActiveRow(col),
|
||
|
}"
|
||
3 years ago
|
>
|
||
3 years ago
|
<div
|
||
3 years ago
|
v-click-outside="() => onClickOutside(col)"
|
||
3 years ago
|
@click="activeRow = col.title"
|
||
3 years ago
|
>
|
||
3 years ago
|
<template v-if="_isUIAllowed('editFormView')">
|
||
|
<v-icon
|
||
|
small
|
||
|
class="nc-field-remove-icon"
|
||
|
@click.stop="hideColumn(i)"
|
||
|
>
|
||
3 years ago
|
mdi-eye-off-outline
|
||
|
</v-icon>
|
||
|
</template>
|
||
|
|
||
|
<div
|
||
3 years ago
|
v-if="localParams.fields && localParams.fields[col.title]"
|
||
3 years ago
|
:class="{
|
||
3 years ago
|
'active-row': active === col.title,
|
||
|
required: isRequired(
|
||
|
col,
|
||
|
localState,
|
||
|
localParams.fields[col.title].required
|
||
|
),
|
||
3 years ago
|
}"
|
||
|
>
|
||
3 years ago
|
<div
|
||
|
class="nc-field-editables"
|
||
|
:class="{ 'nc-show': isActiveRow(col) }"
|
||
|
>
|
||
3 years ago
|
<div class="d-flex align-center pb-2 mt-2">
|
||
3 years ago
|
<v-icon small color="grey">
|
||
|
mdi-drag
|
||
|
</v-icon>
|
||
3 years ago
|
|
||
|
<label
|
||
|
class="grey--text caption ml-2"
|
||
3 years ago
|
@click="
|
||
|
(col.required = !col.required),
|
||
3 years ago
|
updateColMeta(col, i)
|
||
3 years ago
|
"
|
||
3 years ago
|
>
|
||
|
<!--Required-->
|
||
3 years ago
|
{{ $t("general.required") }}
|
||
3 years ago
|
</label>
|
||
3 years ago
|
<v-switch
|
||
3 years ago
|
v-model="col.required"
|
||
3 years ago
|
v-t="['a:form-view:field:mark-required']"
|
||
3 years ago
|
class="nc-required-switch ml-1 mt-0"
|
||
|
hide-details
|
||
|
flat
|
||
3 years ago
|
color="primary"
|
||
3 years ago
|
dense
|
||
|
inset
|
||
3 years ago
|
@change="updateColMeta(col, i)"
|
||
3 years ago
|
/>
|
||
|
</div>
|
||
3 years ago
|
<!--placeholder=" Enter form input label"-->
|
||
3 years ago
|
<editable
|
||
3 years ago
|
v-model.lazy="col.label"
|
||
3 years ago
|
style="width: 300px; white-space: pre-wrap"
|
||
3 years ago
|
:placeholder="$t('msg.info.formInput')"
|
||
3 years ago
|
class="caption pa-1 backgroundColor darken-1 mb-2"
|
||
|
@input="updateColMeta(col, i)"
|
||
3 years ago
|
/>
|
||
3 years ago
|
<!--placeholder=" Add some help text"-->
|
||
3 years ago
|
<editable
|
||
3 years ago
|
v-model.lazy="col.description"
|
||
3 years ago
|
style="width: 300px; white-space: pre-wrap"
|
||
3 years ago
|
:placeholder="$t('msg.info.formHelpText')"
|
||
3 years ago
|
class="caption pa-1 backgroundColor darken-1 mb-2"
|
||
3 years ago
|
@input="updateColMeta(col, i)"
|
||
3 years ago
|
@keydown.enter.prevent
|
||
3 years ago
|
/>
|
||
|
</div>
|
||
|
<label
|
||
3 years ago
|
:class="{ 'nc-show': !isActiveRow(col) }"
|
||
3 years ago
|
:for="`data-table-form-${col.title}`"
|
||
3 years ago
|
class="body-2 text-capitalize nc-field-labels"
|
||
|
>
|
||
|
<virtual-header-cell
|
||
3 years ago
|
v-if="isVirtualCol(col)"
|
||
3 years ago
|
class="caption"
|
||
3 years ago
|
:column="{ ...col, _cn: col.label || col.title }"
|
||
3 years ago
|
:nodes="nodes"
|
||
|
:is-form="true"
|
||
|
:meta="meta"
|
||
3 years ago
|
:required="
|
||
|
isRequired(
|
||
|
col,
|
||
|
localState,
|
||
|
localParams.fields[col.title].required
|
||
|
)
|
||
|
"
|
||
3 years ago
|
/>
|
||
|
<header-cell
|
||
|
v-else
|
||
|
class="caption"
|
||
|
:is-form="true"
|
||
3 years ago
|
:value="col.label || col.title"
|
||
3 years ago
|
:column="col"
|
||
|
:sql-ui="sqlUi"
|
||
3 years ago
|
:required="
|
||
|
isRequired(
|
||
|
col,
|
||
|
localState,
|
||
|
localParams.fields[col.title].required
|
||
|
)
|
||
|
"
|
||
3 years ago
|
/>
|
||
|
</label>
|
||
3 years ago
|
<div v-if="isVirtualCol(col)" @click.stop>
|
||
3 years ago
|
<virtual-cell
|
||
|
ref="virtual"
|
||
|
:disabled-columns="{}"
|
||
3 years ago
|
:column="col"
|
||
3 years ago
|
:row="localState"
|
||
|
:nodes="nodes"
|
||
3 years ago
|
:meta="meta"
|
||
3 years ago
|
:api="api"
|
||
|
:active="true"
|
||
3 years ago
|
:sql-ui="sqlUi"
|
||
3 years ago
|
:is-new="true"
|
||
|
:is-form="true"
|
||
3 years ago
|
:hint="col.description"
|
||
|
:required="col.required"
|
||
3 years ago
|
@update:localState="
|
||
|
(state) => $set(virtual, col.title, state)
|
||
|
"
|
||
3 years ago
|
@updateCol="updateCol"
|
||
3 years ago
|
/>
|
||
3 years ago
|
<div
|
||
3 years ago
|
v-if="
|
||
|
$v.virtual &&
|
||
3 years ago
|
$v.virtual.$dirty &&
|
||
|
$v.virtual[col.title] &&
|
||
|
(!$v.virtual[col.title].required ||
|
||
|
!$v.virtual[col.alias].minLength)
|
||
3 years ago
|
"
|
||
3 years ago
|
class="error--text caption"
|
||
|
>
|
||
|
Field is required.
|
||
|
</div>
|
||
|
|
||
|
<!-- todo: optimize -->
|
||
|
<template
|
||
3 years ago
|
v-if="
|
||
|
col.bt &&
|
||
3 years ago
|
$v.localState &&
|
||
|
$v.localState.$dirty &&
|
||
|
$v.localState[
|
||
|
meta.columns.find(
|
||
|
(c) => c.column_name === col.bt.column_name
|
||
|
).title
|
||
|
]
|
||
3 years ago
|
"
|
||
3 years ago
|
>
|
||
|
<div
|
||
3 years ago
|
v-if="
|
||
|
!$v.localState[
|
||
|
meta.columns.find(
|
||
|
(c) => c.column_name === col.bt.column_name
|
||
|
).title
|
||
|
].required
|
||
|
"
|
||
3 years ago
|
class="error--text caption"
|
||
|
>
|
||
|
Field is required.
|
||
|
</div>
|
||
|
</template>
|
||
3 years ago
|
</div>
|
||
3 years ago
|
<template v-else>
|
||
|
<div
|
||
3 years ago
|
v-if="
|
||
|
col.ai ||
|
||
3 years ago
|
(col.pk && !isNew) ||
|
||
|
disabledColumns[col.title]
|
||
3 years ago
|
"
|
||
|
style="height: 100%; width: 100%"
|
||
3 years ago
|
class="caption xc-input"
|
||
|
@click.stop
|
||
3 years ago
|
@click="
|
||
|
col.ai &&
|
||
|
$toast
|
||
|
.info('Auto Increment field is not editable')
|
||
|
.goAway(3000)
|
||
|
"
|
||
3 years ago
|
>
|
||
|
<input
|
||
3 years ago
|
style="height: 100%; width: 100%"
|
||
3 years ago
|
readonly
|
||
|
disabled
|
||
3 years ago
|
:value="localState[col.title]"
|
||
3 years ago
|
>
|
||
3 years ago
|
</div>
|
||
|
|
||
3 years ago
|
<div v-else @click.stop>
|
||
3 years ago
|
<editable-cell
|
||
3 years ago
|
:id="`data-table-form-${col.title}`"
|
||
|
v-model="localState[col.title]"
|
||
3 years ago
|
:db-alias="dbAlias"
|
||
|
:column="col"
|
||
|
class="xc-input body-2"
|
||
|
:meta="meta"
|
||
|
:sql-ui="sqlUi"
|
||
|
is-form
|
||
3 years ago
|
:hint="col.description"
|
||
|
@focus="active = col.title"
|
||
3 years ago
|
@blur="active = ''"
|
||
|
/>
|
||
|
</div>
|
||
3 years ago
|
<template
|
||
|
v-if="
|
||
|
$v.localState &&
|
||
3 years ago
|
$v.localState.$dirty &&
|
||
|
$v.localState[col.title]
|
||
3 years ago
|
"
|
||
|
>
|
||
|
<div
|
||
|
v-if="!$v.localState[col.title].required"
|
||
|
class="error--text caption"
|
||
|
>
|
||
3 years ago
|
Field is required.
|
||
|
</div>
|
||
|
</template>
|
||
|
</template>
|
||
3 years ago
|
</div>
|
||
|
<!-- </div>-->
|
||
3 years ago
|
</div>
|
||
3 years ago
|
</div>
|
||
|
<div
|
||
|
v-if="!columns.length"
|
||
3 years ago
|
class="nc-drag-n-drop-to-show py-4 mx-8 my-10 text-center grey--text text--lighter-1"
|
||
3 years ago
|
>
|
||
|
Drag and drop fields here to add
|
||
3 years ago
|
</div>
|
||
3 years ago
|
</draggable>
|
||
|
<div class="my-10 text-center">
|
||
3 years ago
|
<v-btn
|
||
|
color="primary"
|
||
|
:loading="loading"
|
||
|
:disabled="loading"
|
||
|
@click="save"
|
||
|
>
|
||
3 years ago
|
<!--Submit-->
|
||
3 years ago
|
{{ $t("general.submit") }}
|
||
3 years ago
|
</v-btn>
|
||
|
<!-- <span class="caption grey--text pointer">Edit label</span>-->
|
||
3 years ago
|
</div>
|
||
3 years ago
|
<div
|
||
|
v-if="isEditable && localParams.submit"
|
||
|
style="max-width: 700px"
|
||
|
class="mx-auto mt-4 px-4 mb-4"
|
||
|
>
|
||
3 years ago
|
<!-- <v-switch v-model="localParams.nocoBranding" dense inset hide-details>
|
||
|
<template #label>
|
||
|
<span class="caption">Show NocoDB branding</span>
|
||
|
</template>
|
||
|
</v-switch>
|
||
|
<v-switch v-model="localParams.submitRedirectUrl" dense inset hide-details>
|
||
|
<template #label>
|
||
|
<span class="caption">Redirect to URL after form submission</span>
|
||
|
</template>
|
||
|
</v-switch>-->
|
||
3 years ago
|
|
||
3 years ago
|
<div class="caption grey--text mt-10 mb-2">
|
||
3 years ago
|
<!--After form is submitted:-->
|
||
3 years ago
|
{{ $t("msg.info.afterFormSubmitted") }}
|
||
3 years ago
|
</div>
|
||
3 years ago
|
<label class="caption grey--text font-weight-bold">
|
||
|
<!--Show this message:-->
|
||
3 years ago
|
{{ $t("msg.info.showMessage") }}:
|
||
3 years ago
|
</label>
|
||
3 years ago
|
<v-textarea
|
||
3 years ago
|
v-model="view.success_msg"
|
||
3 years ago
|
rows="3"
|
||
|
hide-details
|
||
|
solo
|
||
|
class="caption"
|
||
3 years ago
|
@input="updateView"
|
||
3 years ago
|
/>
|
||
|
|
||
3 years ago
|
<v-switch
|
||
|
v-model="view.submit_another_form"
|
||
3 years ago
|
v-t="[`a:form-view:submit-another-form`]"
|
||
3 years ago
|
dense
|
||
|
inset
|
||
|
hide-details
|
||
|
class="nc-switch"
|
||
|
@change="updateView"
|
||
|
>
|
||
3 years ago
|
<template #label>
|
||
3 years ago
|
<span class="font-weight-bold grey--text caption">
|
||
|
<!--Show "Submit Another Form" button-->
|
||
3 years ago
|
{{ $t("msg.info.submitAnotherForm") }}
|
||
3 years ago
|
</span>
|
||
3 years ago
|
</template>
|
||
|
</v-switch>
|
||
3 years ago
|
<v-switch
|
||
|
v-model="view.show_blank_form"
|
||
3 years ago
|
v-t="[`a:form-view:show-blank-form`]"
|
||
3 years ago
|
dense
|
||
|
inset
|
||
|
hide-details
|
||
|
class="nc-switch"
|
||
|
@change="updateView"
|
||
|
>
|
||
3 years ago
|
<template #label>
|
||
3 years ago
|
<span class="font-weight-bold grey--text caption">
|
||
|
<!--Show a blank form after 5 seconds-->
|
||
3 years ago
|
{{ $t("msg.info.showBlankForm") }}
|
||
3 years ago
|
</span>
|
||
3 years ago
|
</template>
|
||
|
</v-switch>
|
||
3 years ago
|
<v-switch
|
||
3 years ago
|
v-model="emailMe"
|
||
3 years ago
|
v-t="[`a:form-view:email-me`]"
|
||
3 years ago
|
dense
|
||
|
inset
|
||
|
hide-details
|
||
|
class="nc-switch"
|
||
|
>
|
||
3 years ago
|
<template #label>
|
||
3 years ago
|
<span class="caption font-weight-bold grey--text">
|
||
|
{{ $t("msg.info.emailForm") }}
|
||
|
<span class="font-eright-bold">{{
|
||
3 years ago
|
$store.state.users.user.email
|
||
|
}}</span>
|
||
|
</span>
|
||
3 years ago
|
</template>
|
||
3 years ago
|
</v-switch>
|
||
3 years ago
|
</div>
|
||
3 years ago
|
</div>
|
||
3 years ago
|
</div>
|
||
3 years ago
|
</v-col>
|
||
|
</template>
|
||
3 years ago
|
</v-row>
|
||
|
</v-container>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
3 years ago
|
import draggable from 'vuedraggable'
|
||
|
import { validationMixin } from 'vuelidate'
|
||
|
import { required, minLength } from 'vuelidate/lib/validators'
|
||
3 years ago
|
import {
|
||
|
UITypes,
|
||
|
isVirtualCol,
|
||
|
RelationTypes,
|
||
3 years ago
|
getSystemColumns
|
||
|
} from 'nocodb-sdk'
|
||
|
import VirtualHeaderCell from '../components/VirtualHeaderCell'
|
||
|
import HeaderCell from '../components/HeaderCell'
|
||
|
import VirtualCell from '../components/VirtualCell'
|
||
|
import EditableCell from '../components/EditableCell'
|
||
|
import Editable from '../components/Editable'
|
||
|
import EditColumn from '../components/EditColumn'
|
||
|
import form from '../mixins/form'
|
||
3 years ago
|
|
||
3 years ago
|
// todo: generate hideCols based on default values
|
||
3 years ago
|
const hiddenCols = ['created_at', 'updated_at']
|
||
3 years ago
|
|
||
3 years ago
|
export default {
|
||
3 years ago
|
name: 'FormView',
|
||
3 years ago
|
components: {
|
||
|
EditColumn,
|
||
|
Editable,
|
||
|
EditableCell,
|
||
|
VirtualCell,
|
||
|
HeaderCell,
|
||
|
VirtualHeaderCell,
|
||
3 years ago
|
draggable
|
||
3 years ago
|
},
|
||
3 years ago
|
mixins: [form, validationMixin],
|
||
3 years ago
|
props: [
|
||
3 years ago
|
'meta',
|
||
|
'availableColumns',
|
||
|
'nodes',
|
||
|
'sqlUi',
|
||
|
'formParams',
|
||
|
'showFields',
|
||
|
'fieldsOrder',
|
||
|
'allColumns',
|
||
|
'dbAlias',
|
||
|
'api',
|
||
|
'id',
|
||
|
'viewId',
|
||
|
'viewTitle'
|
||
3 years ago
|
],
|
||
3 years ago
|
data: () => ({
|
||
3 years ago
|
isVirtualCol,
|
||
3 years ago
|
localState: {},
|
||
3 years ago
|
moved: false,
|
||
|
addNewColMenu: false,
|
||
3 years ago
|
addNewColModal: false,
|
||
3 years ago
|
activeRow: null,
|
||
|
active: null,
|
||
|
isNew: true,
|
||
|
submitted: false,
|
||
|
secondsRemain: null,
|
||
3 years ago
|
loading: false,
|
||
3 years ago
|
virtual: {},
|
||
|
formColumns: [],
|
||
|
fields: [],
|
||
3 years ago
|
view: {}
|
||
3 years ago
|
// hiddenColumns: []
|
||
|
}),
|
||
3 years ago
|
validations() {
|
||
3 years ago
|
const obj = {
|
||
|
localState: {},
|
||
3 years ago
|
virtual: {}
|
||
|
}
|
||
3 years ago
|
for (const column of this.columns) {
|
||
3 years ago
|
if (
|
||
|
!this.localParams ||
|
||
|
!this.localParams.fields ||
|
||
|
!this.localParams.fields[column.title]
|
||
|
) {
|
||
3 years ago
|
continue
|
||
3 years ago
|
}
|
||
3 years ago
|
if (
|
||
|
!column.virtual &&
|
||
|
(((column.rqd || column.notnull) && !column.cdf) ||
|
||
|
(column.pk && !(column.ai || column.default)) ||
|
||
|
this.localParams.fields[column.title].required)
|
||
|
) {
|
||
3 years ago
|
obj.localState[column.title] = { required }
|
||
3 years ago
|
} else if (column.bt) {
|
||
3 years ago
|
const col = this.meta.columns.find(
|
||
3 years ago
|
c => c.column_name === column.bt.column_name
|
||
|
)
|
||
3 years ago
|
if (
|
||
|
(col.rqd && !col.default) ||
|
||
|
this.localParams.fields[column.title].required
|
||
|
) {
|
||
3 years ago
|
obj.localState[col.title] = { required }
|
||
3 years ago
|
}
|
||
3 years ago
|
} else if (
|
||
|
column.virtual &&
|
||
|
this.localParams.fields[column.title].required &&
|
||
|
(column.mm || column.hm)
|
||
|
) {
|
||
3 years ago
|
obj.virtual[column.title] = {
|
||
3 years ago
|
minLength: minLength(1),
|
||
3 years ago
|
required
|
||
|
}
|
||
3 years ago
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
return obj
|
||
3 years ago
|
},
|
||
3 years ago
|
computed: {
|
||
3 years ago
|
systemFieldsIds() {
|
||
3 years ago
|
return getSystemColumns(this.fields).map(c => c.fk_column_id)
|
||
3 years ago
|
},
|
||
|
emailMe: {
|
||
|
get() {
|
||
|
try {
|
||
3 years ago
|
const data = JSON.parse(this.view.email)
|
||
|
return data[this.$store.state.users.user.email]
|
||
3 years ago
|
} catch (e) {}
|
||
3 years ago
|
return false
|
||
3 years ago
|
},
|
||
|
set(v) {
|
||
3 years ago
|
let data = {}
|
||
3 years ago
|
try {
|
||
3 years ago
|
data = JSON.parse(this.view.email) || {}
|
||
3 years ago
|
} catch (e) {}
|
||
3 years ago
|
data[this.$store.state.users.user.email] = v
|
||
|
this.view.email = JSON.stringify(data)
|
||
|
this.updateView()
|
||
|
this.checkSMTPStatus()
|
||
|
}
|
||
3 years ago
|
},
|
||
3 years ago
|
allColumnsLoc() {
|
||
3 years ago
|
return this.fields // this.mets.columns.filter(c => !hiddenCols.includes(c.column_name) && !(c.pk && c.ai) && this.meta.belongsTo.every(bt => c.column_name !== bt.column_name))
|
||
3 years ago
|
},
|
||
3 years ago
|
isEditable() {
|
||
3 years ago
|
return this._isUIAllowed('editFormView')
|
||
3 years ago
|
},
|
||
3 years ago
|
localParams: {
|
||
|
get() {
|
||
3 years ago
|
return this.formParams || {}
|
||
3 years ago
|
},
|
||
|
set(params) {
|
||
3 years ago
|
this.$emit('update:formParams', params)
|
||
|
}
|
||
3 years ago
|
},
|
||
|
hiddenColumns: {
|
||
|
get() {
|
||
3 years ago
|
return this.fields.filter(
|
||
3 years ago
|
f => !f.show && !this.systemFieldsIds.includes(f.fk_column_id)
|
||
|
)
|
||
3 years ago
|
},
|
||
3 years ago
|
set(v) {}
|
||
3 years ago
|
},
|
||
|
columns: {
|
||
|
get() {
|
||
3 years ago
|
return this.fields.filter(f => f.show && f.uidt != UITypes.Rollup && f.uidt != UITypes.Lookup).sort((a, b) => a.order - b.order)
|
||
3 years ago
|
},
|
||
3 years ago
|
set(v) {}
|
||
|
}
|
||
3 years ago
|
},
|
||
3 years ago
|
watch: {
|
||
3 years ago
|
'meta.columns'() {
|
||
3 years ago
|
this.meta.columns.forEach((c) => {
|
||
3 years ago
|
this.localParams.fields[c.title] =
|
||
3 years ago
|
this.localParams.fields[c.title] || {}
|
||
|
})
|
||
3 years ago
|
},
|
||
|
submitted(val) {
|
||
3 years ago
|
if (val && this.view.show_blank_form) {
|
||
3 years ago
|
this.secondsRemain = 5
|
||
3 years ago
|
const intvl = setInterval(() => {
|
||
|
if (--this.secondsRemain < 0) {
|
||
3 years ago
|
this.submitted = false
|
||
|
clearInterval(intvl)
|
||
3 years ago
|
}
|
||
3 years ago
|
}, 1000)
|
||
3 years ago
|
}
|
||
3 years ago
|
}
|
||
3 years ago
|
},
|
||
3 years ago
|
created() {
|
||
3 years ago
|
this.loadView()
|
||
3 years ago
|
},
|
||
3 years ago
|
mounted() {
|
||
3 years ago
|
const localParams = Object.assign(
|
||
|
{
|
||
|
name: this.meta.title,
|
||
3 years ago
|
description: 'Form view description',
|
||
3 years ago
|
submit: {},
|
||
|
emailMe: {},
|
||
3 years ago
|
fields: {}
|
||
3 years ago
|
},
|
||
|
this.localParams
|
||
3 years ago
|
)
|
||
3 years ago
|
this.availableColumns.forEach((c) => {
|
||
3 years ago
|
localParams.fields[c.title] = localParams.fields[c.title] || {}
|
||
|
})
|
||
|
this.localParams = localParams
|
||
3 years ago
|
// this.columns = [...this.availableColumns]
|
||
3 years ago
|
// this.hiddenColumns = this.meta.columns.filter(c => this.availableColumns.find(c1 => c.column_name === c1.column_name && c.title === c1.title))
|
||
3 years ago
|
},
|
||
|
methods: {
|
||
3 years ago
|
onMove(event) {
|
||
3 years ago
|
const { newIndex, element, oldIndex } =
|
||
3 years ago
|
event.added || event.moved || event.removed
|
||
3 years ago
|
|
||
|
if (event.added) {
|
||
3 years ago
|
this.$set(element, 'show', true)
|
||
3 years ago
|
}
|
||
|
|
||
|
if (event.removed) {
|
||
3 years ago
|
this.$set(element, 'show', false)
|
||
|
this.saveOrUpdateOrderOrVisibility(element, oldIndex)
|
||
3 years ago
|
} else {
|
||
|
if (!this.columns.length || this.columns.length === 1) {
|
||
3 years ago
|
this.$set(element, 'order', 1)
|
||
3 years ago
|
} else if (this.columns.length - 1 === newIndex) {
|
||
3 years ago
|
this.$set(element, 'order', this.columns[newIndex - 1].order + 1)
|
||
3 years ago
|
} else if (newIndex === 0) {
|
||
3 years ago
|
this.$set(element, 'order', this.columns[1].order / 2)
|
||
3 years ago
|
} else {
|
||
3 years ago
|
this.$set(
|
||
|
element,
|
||
3 years ago
|
'order',
|
||
3 years ago
|
(this.columns[newIndex - 1].order +
|
||
|
this.columns[newIndex + 1].order) /
|
||
|
2
|
||
3 years ago
|
)
|
||
3 years ago
|
}
|
||
3 years ago
|
this.saveOrUpdateOrderOrVisibility(element, newIndex)
|
||
3 years ago
|
}
|
||
|
|
||
3 years ago
|
this.$e('a:form-view:reorder')
|
||
3 years ago
|
},
|
||
|
|
||
|
async saveOrUpdateOrderOrVisibility(field, i) {
|
||
3 years ago
|
const { fk_view_id, fk_column_id, order, show, id } = field
|
||
3 years ago
|
|
||
|
if (id) {
|
||
|
await this.$api.dbViewColumn.update(this.viewId, field.id, {
|
||
|
fk_view_id,
|
||
|
fk_column_id,
|
||
|
order,
|
||
3 years ago
|
show
|
||
|
})
|
||
3 years ago
|
} else {
|
||
3 years ago
|
field.id = (
|
||
|
await this.$api.dbViewColumn.create(this.viewId, {
|
||
|
fk_view_id,
|
||
|
fk_column_id,
|
||
|
order,
|
||
3 years ago
|
show
|
||
3 years ago
|
})
|
||
3 years ago
|
).id
|
||
3 years ago
|
}
|
||
3 years ago
|
this.$emit(
|
||
3 years ago
|
'update:fieldsOrder',
|
||
|
this.fields.map(c => c.title)
|
||
|
)
|
||
3 years ago
|
},
|
||
|
async updateColMeta(col, i) {
|
||
3 years ago
|
// todo: introduce debounce to avoid consecutive api call
|
||
3 years ago
|
if (col.id) {
|
||
3 years ago
|
await this.$api.dbView.formColumnUpdate(col.id, col)
|
||
3 years ago
|
}
|
||
|
},
|
||
|
async updateView() {
|
||
3 years ago
|
if (this.view.subheading?.length > 255) {
|
||
3 years ago
|
this.$toast.error('Data too long for Form Description').goAway(3000)
|
||
|
return
|
||
3 years ago
|
}
|
||
3 years ago
|
await this.$api.dbView.formUpdate(this.viewId, this.view)
|
||
3 years ago
|
},
|
||
|
async loadView() {
|
||
3 years ago
|
const { columns, ...view } = await this.$api.dbView.formRead(this.viewId)
|
||
|
this.view = view
|
||
|
this.formColumns = columns
|
||
|
let order = 1
|
||
3 years ago
|
const fieldById = this.formColumns.reduce(
|
||
|
(o, f) => ({
|
||
|
...o,
|
||
3 years ago
|
[f.fk_column_id]: f
|
||
3 years ago
|
}),
|
||
|
{}
|
||
3 years ago
|
)
|
||
3 years ago
|
|
||
3 years ago
|
const meta = this.$store.state.meta.metas[this.meta.id]
|
||
3 years ago
|
this.fields = meta.columns
|
||
3 years ago
|
.map(c => ({
|
||
3 years ago
|
...c,
|
||
|
fk_column_id: c.id,
|
||
|
fk_view_id: this.viewId,
|
||
|
...(fieldById[c.id] ? fieldById[c.id] : {}),
|
||
|
order: (fieldById[c.id] && fieldById[c.id].order) || order++,
|
||
3 years ago
|
id: fieldById[c.id] && fieldById[c.id].id
|
||
3 years ago
|
}))
|
||
3 years ago
|
.sort((a, b) => a.order - b.order)
|
||
3 years ago
|
},
|
||
3 years ago
|
hideColumn(i) {
|
||
|
if (this.isDbRequired(this.columns[i])) {
|
||
3 years ago
|
this.$toast.info("Required field can't be removed").goAway(3000)
|
||
|
return
|
||
3 years ago
|
}
|
||
3 years ago
|
|
||
3 years ago
|
this.saveOrUpdateOrderOrVisibility(
|
||
|
{
|
||
|
...this.columns[i],
|
||
3 years ago
|
show: false
|
||
3 years ago
|
},
|
||
|
i
|
||
3 years ago
|
)
|
||
|
this.$set(this.columns[i], 'show', false)
|
||
3 years ago
|
|
||
3 years ago
|
this.$e('a:form-view:hide-columns')
|
||
3 years ago
|
// this.columns = this.columns.filter((_, j) => i !== j)
|
||
|
},
|
||
|
async addAllColumns() {
|
||
|
for (const col of this.fields) {
|
||
|
if (!this.systemFieldsIds.includes(col.fk_column_id)) {
|
||
3 years ago
|
this.$set(col, 'show', true)
|
||
3 years ago
|
}
|
||
|
}
|
||
|
await this.$api.dbView.showAllColumn(this.viewId, {
|
||
3 years ago
|
ignoreIds: this.systemFieldsIds
|
||
|
})
|
||
3 years ago
|
// this.columns = [...this.allColumnsLoc]
|
||
3 years ago
|
this.$e('a:form-view:add-all')
|
||
3 years ago
|
},
|
||
3 years ago
|
async removeAllColumns() {
|
||
|
for (const col of this.fields) {
|
||
|
if (this.isDbRequired(col)) {
|
||
3 years ago
|
continue
|
||
3 years ago
|
}
|
||
3 years ago
|
this.$set(col, 'show', false)
|
||
3 years ago
|
}
|
||
|
await this.$api.dbView.hideAllColumn(this.viewId, {
|
||
3 years ago
|
ignoreIds: this.fields
|
||
|
.filter(this.isDbRequired)
|
||
3 years ago
|
.map(f => f.fk_column_id)
|
||
|
})
|
||
|
this.$e('a:form-view:remove-all')
|
||
3 years ago
|
},
|
||
|
isDbRequired(column) {
|
||
3 years ago
|
if (hiddenCols.includes(column.fk_column_id)) {
|
||
3 years ago
|
return false
|
||
3 years ago
|
}
|
||
3 years ago
|
|
||
3 years ago
|
let isRequired =
|
||
3 years ago
|
// confirm column is not virtual
|
||
|
(!isVirtualCol(column) &&
|
||
3 years ago
|
// column required / not null
|
||
|
column.rqd &&
|
||
|
// column default value
|
||
|
!column.cdf &&
|
||
|
// confirm it's not foreign key
|
||
|
!this.meta.columns.some(
|
||
3 years ago
|
c =>
|
||
3 years ago
|
c.uidt === UITypes.LinkToAnotherRecord &&
|
||
3 years ago
|
c.colOptions.type === RelationTypes.BELONGS_TO &&
|
||
|
column.fk_column_id === c.colOptions.fk_child_column_id
|
||
|
)) ||
|
||
|
// primary column
|
||
3 years ago
|
(column.pk && !column.ai && !column.cdf)
|
||
3 years ago
|
if (
|
||
|
column.uidt === UITypes.LinkToAnotherRecord &&
|
||
|
column.colOptions.type === RelationTypes.BELONGS_TO
|
||
|
) {
|
||
|
const col = this.meta.columns.find(
|
||
3 years ago
|
c => c.id === column.colOptions.fk_child_column_id
|
||
|
)
|
||
3 years ago
|
if (
|
||
|
(col.rqd && !col.default) ||
|
||
|
this.localParams.fields[column.title].required
|
||
|
) {
|
||
3 years ago
|
isRequired = true
|
||
3 years ago
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
return isRequired
|
||
3 years ago
|
},
|
||
3 years ago
|
async checkSMTPStatus() {
|
||
3 years ago
|
if (this.emailMe) {
|
||
3 years ago
|
const emailPluginActive = await this.$api.plugin.status('SMTP')
|
||
3 years ago
|
if (!emailPluginActive) {
|
||
3 years ago
|
this.emailMe = false
|
||
3 years ago
|
this.$toast
|
||
|
.info(
|
||
3 years ago
|
'Please activate SMTP plugin in App store for enabling email notification'
|
||
3 years ago
|
)
|
||
3 years ago
|
.goAway(5000)
|
||
3 years ago
|
}
|
||
|
}
|
||
|
},
|
||
3 years ago
|
updateCol(_, column, id) {
|
||
3 years ago
|
this.$set(this.localState, column, id)
|
||
3 years ago
|
},
|
||
3 years ago
|
isActiveRow(col) {
|
||
3 years ago
|
return this.activeRow === col.title
|
||
3 years ago
|
},
|
||
|
onClickOutside(col) {
|
||
3 years ago
|
this.activeRow = this.activeRow === col.title ? null : this.activeRow
|
||
3 years ago
|
},
|
||
3 years ago
|
handleMouseUp(col) {
|
||
|
if (!this.moved) {
|
||
3 years ago
|
const index = this.columns.length
|
||
3 years ago
|
// this.columns = [...this.columns, col]
|
||
3 years ago
|
col.order = (index ? this.columns[index - 1].order : 0) + 1
|
||
|
this.$set(col, 'show', true)
|
||
3 years ago
|
this.$nextTick(() => {
|
||
3 years ago
|
this.saveOrUpdateOrderOrVisibility(col, index)
|
||
|
})
|
||
3 years ago
|
}
|
||
3 years ago
|
},
|
||
3 years ago
|
async onNewColCreation(col) {
|
||
3 years ago
|
this.addNewColMenu = false
|
||
|
this.addNewColModal = false
|
||
|
this.$emit('onNewColCreation', col)
|
||
|
await this.$store.dispatch('meta/ActLoadMeta', {
|
||
3 years ago
|
env: this.nodes.env,
|
||
|
dbAlias: this.nodes.dbAlias,
|
||
|
id: this.meta.id,
|
||
3 years ago
|
force: true
|
||
|
})
|
||
3 years ago
|
|
||
3 years ago
|
await this.loadView()
|
||
3 years ago
|
|
||
3 years ago
|
this.$e('a:form-view:add-new-field')
|
||
3 years ago
|
},
|
||
|
async save() {
|
||
|
try {
|
||
3 years ago
|
this.$v.$touch()
|
||
3 years ago
|
if (this.$v.localState.$invalid) {
|
||
3 years ago
|
this.$toast
|
||
3 years ago
|
.error('Provide values of all required field')
|
||
|
.goAway(3000)
|
||
3 years ago
|
|
||
3 years ago
|
return
|
||
3 years ago
|
}
|
||
|
|
||
3 years ago
|
this.loading = true
|
||
3 years ago
|
|
||
3 years ago
|
let data = await this.$api.dbViewRow.create(
|
||
3 years ago
|
'noco',
|
||
3 years ago
|
this.projectName,
|
||
|
this.meta.title,
|
||
3 years ago
|
this.viewTitle,
|
||
3 years ago
|
this.localState
|
||
3 years ago
|
)
|
||
3 years ago
|
|
||
3 years ago
|
data = { ...this.localState, ...data }
|
||
3 years ago
|
|
||
|
// save hasmany and manytomany relations from local state
|
||
|
if (this.$refs.virtual && Array.isArray(this.$refs.virtual)) {
|
||
|
for (const vcell of this.$refs.virtual) {
|
||
|
if (vcell.save) {
|
||
3 years ago
|
await vcell.save(data)
|
||
3 years ago
|
}
|
||
|
}
|
||
|
}
|
||
3 years ago
|
|
||
3 years ago
|
this.virtual = {}
|
||
|
this.localState = {}
|
||
3 years ago
|
|
||
3 years ago
|
this.submitted = true
|
||
3 years ago
|
|
||
3 years ago
|
this.$toast
|
||
3 years ago
|
.success(this.localParams.submit.message || 'Saved successfully.', {
|
||
|
position: 'bottom-right'
|
||
3 years ago
|
})
|
||
3 years ago
|
.goAway(3000)
|
||
3 years ago
|
} catch (e) {
|
||
3 years ago
|
console.log(e)
|
||
|
this.$toast.error(`Failed to update row : ${e.message}`).goAway(3000)
|
||
3 years ago
|
}
|
||
3 years ago
|
this.loading = false
|
||
|
}
|
||
|
}
|
||
|
}
|
||
3 years ago
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
3 years ago
|
.nc-form-wrapper {
|
||
|
border-radius: 4px;
|
||
|
|
||
|
.nc-form {
|
||
|
position: relative;
|
||
|
border-radius: 4px;
|
||
|
z-index: 2;
|
||
|
background: var(--v-backgroundColorDefault-base);
|
||
|
width: 80%;
|
||
|
max-width: 600px;
|
||
|
margin: 0 auto;
|
||
|
margin-top: -100px;
|
||
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
.nc-field-wrapper {
|
||
3 years ago
|
&.active-row {
|
||
|
border-radius: 4px;
|
||
|
border: 1px solid var(--v-backgroundColor-darken1);
|
||
|
}
|
||
|
|
||
3 years ago
|
position: relative;
|
||
|
|
||
|
.nc-field-remove-icon {
|
||
|
opacity: 0;
|
||
|
position: absolute;
|
||
|
right: 10px;
|
||
|
top: 10px;
|
||
|
transition: 200ms opacity;
|
||
3 years ago
|
z-index: 9;
|
||
3 years ago
|
}
|
||
|
|
||
3 years ago
|
&.nc-editable:hover {
|
||
|
background: var(--v-backgroundColor-base);
|
||
3 years ago
|
|
||
|
.nc-field-remove-icon {
|
||
|
opacity: 1;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
.row-col > label {
|
||
|
color: grey;
|
||
|
font-weight: 700;
|
||
|
}
|
||
|
|
||
3 years ago
|
.row-col:focus > label,
|
||
|
.active-row > label {
|
||
3 years ago
|
color: var(--v-primary-base);
|
||
|
}
|
||
|
|
||
|
.title.text-center {
|
||
|
white-space: nowrap;
|
||
|
overflow: hidden;
|
||
|
text-overflow: ellipsis;
|
||
|
}
|
||
|
|
||
|
::v-deep {
|
||
3 years ago
|
.nc-hint {
|
||
|
padding-left: 3px;
|
||
|
}
|
||
|
|
||
3 years ago
|
.nc-required-switch,
|
||
|
.nc-switch {
|
||
3 years ago
|
.v-input--selection-controls__input {
|
||
|
transform: scale(0.65) !important;
|
||
|
}
|
||
|
}
|
||
3 years ago
|
|
||
|
.v-breadcrumbs__item:nth-child(odd) {
|
||
3 years ago
|
font-size: 0.72rem;
|
||
3 years ago
|
color: grey;
|
||
|
}
|
||
|
|
||
|
.v-breadcrumbs li:nth-child(even) {
|
||
|
padding: 0 6px;
|
||
3 years ago
|
font-size: 0.72rem;
|
||
3 years ago
|
color: var(--v-textColor-base);
|
||
|
}
|
||
|
|
||
|
.comment-icon {
|
||
|
position: absolute;
|
||
|
right: 60px;
|
||
|
bottom: 60px;
|
||
|
}
|
||
|
|
||
3 years ago
|
.nc-field-wrapper {
|
||
3 years ago
|
//.required {
|
||
|
// & > input,
|
||
|
// .xc-input > input,
|
||
|
// .xc-input .v-input__slot input,
|
||
|
// .xc-input > div > input,
|
||
|
// & > select,
|
||
|
// .xc-input > select,
|
||
|
// textarea:not(.inputarea) {
|
||
|
// border: 1px solid rgba(255, 0, 0, 0.98);
|
||
|
// border-radius: 4px;
|
||
|
// background: var(--v-backgroundColorDefault-base);
|
||
|
// }
|
||
|
//}
|
||
3 years ago
|
|
||
3 years ago
|
div > input,
|
||
|
div > .xc-input > input,
|
||
|
div > .xc-input > div > input,
|
||
|
div > select,
|
||
|
div > .xc-input > select,
|
||
|
div textarea:not(.inputarea) {
|
||
|
border: 1px solid #7f828b33;
|
||
|
padding: 1px 5px;
|
||
3 years ago
|
font-size: 0.8rem;
|
||
3 years ago
|
border-radius: 4px;
|
||
|
min-height: 44px;
|
||
|
|
||
|
&:focus {
|
||
|
border: 1px solid var(--v-primary-base);
|
||
|
}
|
||
3 years ago
|
|
||
3 years ago
|
&:hover:not(:focus) {
|
||
|
box-shadow: 0 0 2px dimgrey;
|
||
|
}
|
||
3 years ago
|
|
||
3 years ago
|
background: var(--v-backgroundColorDefault-base);
|
||
3 years ago
|
}
|
||
|
|
||
3 years ago
|
.v-input__slot {
|
||
|
padding: 0 !important;
|
||
|
}
|
||
3 years ago
|
}
|
||
|
}
|
||
|
|
||
|
.nc-meta-inputs {
|
||
3 years ago
|
//width: 400px;
|
||
3 years ago
|
min-height: 40px;
|
||
|
border-radius: 4px;
|
||
3 years ago
|
//display: flex;
|
||
|
//align-items: center;
|
||
|
//justify-content: center;
|
||
3 years ago
|
|
||
|
&:hover {
|
||
|
background: var(--v-backgroundColor-base);
|
||
|
}
|
||
|
|
||
3 years ago
|
&:active,
|
||
|
&:focus {
|
||
3 years ago
|
border: 1px solid #7f828b33;
|
||
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
.nc-drag-n-drop-to-hide,
|
||
|
.nc-drag-n-drop-to-show {
|
||
3 years ago
|
border: 2px dashed #c4c4c4;
|
||
3 years ago
|
border-radius: 4px;
|
||
3 years ago
|
font-size: 0.62rem;
|
||
3 years ago
|
|
||
3 years ago
|
color: grey;
|
||
3 years ago
|
}
|
||
|
|
||
3 years ago
|
.nc-form-left-nav {
|
||
3 years ago
|
max-height: 100%;
|
||
|
}
|
||
|
|
||
3 years ago
|
.required > div > label + * {
|
||
|
border: 1px solid red;
|
||
|
border-radius: 4px;
|
||
|
background: var(--v-backgroundColorDefault-base);
|
||
|
}
|
||
|
|
||
3 years ago
|
.nc-form-banner {
|
||
|
width: 100%;
|
||
|
height: 200px;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
|
justify-content: center;
|
||
|
border-top-left-radius: 4px;
|
||
|
border-top-right-radius: 4px;
|
||
3 years ago
|
padding-bottom: 100px;
|
||
3 years ago
|
|
||
|
.nc-form-logo {
|
||
|
border-top-left-radius: 4px;
|
||
|
border-top-right-radius: 4px;
|
||
|
height: 100px;
|
||
|
display: flex;
|
||
|
align-items: center;
|
||
3 years ago
|
justify-content: flex-start;
|
||
3 years ago
|
width: 70%;
|
||
|
padding: 0 20px;
|
||
|
background: var(--v-backgroundColorDefault-base);
|
||
|
|
||
|
.nc-form-add-logo {
|
||
|
border-radius: 4px;
|
||
|
color: grey;
|
||
|
border: 2px dashed var(--v-backgroundColor-darken1);
|
||
|
padding: 15px 15px;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
3 years ago
|
//.nc-field-labels,
|
||
|
.nc-field-editables {
|
||
|
max-height: 0;
|
||
3 years ago
|
transition: 0.4s max-height;
|
||
3 years ago
|
overflow-y: hidden;
|
||
3 years ago
|
display: block;
|
||
|
|
||
|
&.nc-show {
|
||
3 years ago
|
max-height: 500px;
|
||
3 years ago
|
}
|
||
|
}
|
||
3 years ago
|
</style>
|