cells align

This commit is contained in:
Pete Matsyburka
2024-12-13 00:24:29 +02:00
parent 5340af0bc6
commit 29fbdfbe2f
4 changed files with 16 additions and 6 deletions
+1
View File
@@ -168,6 +168,7 @@
<div
v-else-if="field.type === 'cells'"
class="w-full flex items-center"
:class="{ 'justify-end': field.preferences?.align === 'right' }"
>
<div
v-for="(char, index) in modelValue"
@@ -27,7 +27,7 @@
</label>
</div>
<div
v-if="['number'].includes(field.type)"
v-if="['number', 'cells'].includes(field.type)"
class="py-1.5 px-1 relative"
@click.stop
>
@@ -36,7 +36,7 @@
@change="[field.preferences ||= {}, field.preferences.align = $event.target.value, save()]"
>
<option
v-for="value in ['left', 'right', 'center']"
v-for="value in ['left', 'right', field.type === 'cells' ? null : 'center'].filter(Boolean)"
:key="value"
:selected="field.preferences?.align ? value === field.preferences.align : value === 'left'"
:value="value"
+1 -1
View File
@@ -50,7 +50,7 @@
<% end %>
<% elsif field['type'] == 'cells' && area['cell_w'].to_f > 0.0 %>
<% cell_width = area['cell_w'] / area['w'] * 100 %>
<div class="w-full flex items-center">
<div class="w-full flex items-center <%= 'justify-end' if align == 'right' %>">
<% (0..(area['w'] / area['cell_w']).ceil).each do |index| %>
<% if value[index] %>
<div class="text-center flex-none" style="width: <%= cell_width %>%;"><%= value[index] %></div>