[feat] Extension Builder (#3339)

This commit is contained in:
Vlad Stan
2025-09-25 18:33:33 +03:00
committed by GitHub
parent c05122e5fb
commit 4f9a5090c2
27 changed files with 2871 additions and 16 deletions
+186
View File
@@ -1671,3 +1671,189 @@
<q-separator class="col q-ml-sm"></q-separator>
</div>
</template>
<template id="lnbits-data-fields">
<q-table
:rows="fields"
row-key="name"
:columns="fieldsTable.columns"
v-model:pagination="fieldsTable.pagination"
>
<template v-slot:bottom-row>
<q-tr>
<q-td auto-width></q-td>
<q-td colspan="100%">
<q-btn
@click="addField"
icon="add"
size="sm"
color="primary"
class="q-ml-xs"
:label="$t('add_field')"
/>
</q-td>
</q-tr>
</template>
<template v-slot:header="props">
<q-tr :props="props">
<q-th auto-width></q-th>
<q-th v-for="col in props.cols" :key="col.name" :props="props">
<span v-text="col.label"></span>
<q-icon
v-if="col.name == 'optional'"
name="info"
size="xs"
color="primary"
class="cursor-pointer q-ml-xs q-mb-xs"
>
<q-tooltip>
<ul>
<li>
The field is optional. The field can be left blank by the
user.
</li>
<li>
The UI form will not require this field to be filled out.
</li>
<li>The DB table will allow NULL values for this field.</li>
<li>Non optional fields must be filled out.</li>
</ul>
</q-tooltip>
</q-icon>
<q-icon
v-else-if="col.name == 'editable'"
name="info"
size="xs"
color="primary"
class="cursor-pointer q-ml-xs q-mb-xs"
>
<q-tooltip>
<ul>
<li>The UI form will allow the field to be edited.</li>
</ul>
</q-tooltip>
</q-icon>
<q-icon
v-else-if="col.name == 'sortable'"
name="info"
size="xs"
color="primary"
class="cursor-pointer q-ml-xs q-mb-xs"
>
<q-tooltip>
<ul>
<li>In the UI Table a column will be created for the field.</li>
<li>The UI Table column will be sortable.</li>
</ul>
</q-tooltip>
</q-icon>
<q-icon
v-else-if="col.name == 'searchable'"
name="info"
size="xs"
color="primary"
class="cursor-pointer q-ml-xs q-mb-xs"
>
<q-tooltip>
<ul>
<li>
The free text search will include this field when searching.
</li>
</ul>
</q-tooltip>
</q-icon>
</q-th>
</q-tr>
</template>
<template v-slot:body="props">
<q-tr :props="props">
<q-td>
<q-btn
v-if="props.row.readonly !== true"
@click="removeField(props.row)"
round
icon="delete"
size="sm"
color="negative"
class="q-ml-xs"
>
</q-btn>
</q-td>
<q-td full-width>
<q-input
dense
filled
v-model="props.row.name"
:readonly="props.row.readonly === true"
type="text"
>
</q-input>
</q-td>
<q-td>
<q-select
filled
dense
emit-value
map-options
v-model="props.row.type"
:options="fieldTypes"
:readonly="props.row.readonly === true"
></q-select>
</q-td>
<q-td>
<q-input dense filled v-model="props.row.label" type="text">
</q-input>
</q-td>
<q-td>
<q-input dense filled v-model="props.row.hint" type="text"> </q-input>
</q-td>
<q-td>
<q-toggle
v-model="props.row.optional"
:readonly="props.row.readonly === true"
size="md"
color="green"
/>
</q-td>
<q-td v-if="!hideAdvanced">
<q-toggle
v-if="props.row.type !== 'json'"
:readonly="props.row.readonly === true"
v-model="props.row.editable"
size="md"
color="green"
/>
</q-td>
<q-td v-if="!hideAdvanced">
<q-toggle
v-if="props.row.type !== 'json'"
:readonly="props.row.readonly === true"
v-model="props.row.sortable"
size="md"
color="green"
/>
</q-td>
<q-td v-if="!hideAdvanced">
<q-toggle
v-if="props.row.type !== 'json'"
:readonly="props.row.readonly === true"
v-model="props.row.searchable"
size="md"
color="green"
/>
</q-td>
</q-tr>
<q-tr v-if="props.row.type === 'json'" :props="props">
<q-td></q-td>
<q-td></q-td>
<q-td colspan="100%">
<lnbits-data-fields
:fields="props.row.fields"
:hide-advanced="true"
></lnbits-data-fields>
</q-td>
</q-tr>
</template>
</q-table>
</template>