refac: duplicates, crap, dry etc. on last features commits

This commit is contained in:
Florian Sylvain committed 2026-10-21 00:52:14 +02:00
1 parent fba20f83c5
commit 89051b3f1f
12 files changed
+260 -153

No files matched your search

+35 -17
View File
@@ -6,8 +6,26 @@ import type { FieldErrors } from '@/lib/schemaBuilderValidation'
type Builder = ReturnType<typeof useSchemaBuilder>
type InspectorActions = Pick<
Builder,
| 'setLabel'
| 'setFieldKey'
| 'unlockFieldKey'
| 'resetFieldKey'
| 'setFieldType'
| 'patchField'
| 'setLimit'
| 'setDefault'
| 'addChoice'
| 'removeChoice'
| 'renameChoice'
| 'reorderChoices'
>
const props = defineProps<{
builder: Builder
actions: InspectorActions
saving: boolean
focusToken: number
field: BuilderField
errors: FieldErrors
compact: boolean
@@ -20,22 +38,22 @@ const uid = () => props.field.uid
<FieldInspector
:field="field"
:errors="errors"
:disabled="builder.saving.value"
:disabled="saving"
:compact="compact"
:focus-token="builder.labelFocusToken.value"
@label="builder.setLabel(uid(), $event)"
@key="builder.setFieldKey(uid(), $event)"
@unlock="builder.unlockFieldKey(uid())"
@reset="builder.resetFieldKey(uid())"
@type="builder.setFieldType(uid(), $event)"
@required="builder.patchField(uid(), { required: $event })"
@unique="builder.patchField(uid(), { unique: $event })"
@limit="(which, value) => builder.setLimit(uid(), which, value)"
@default="builder.setDefault(uid(), $event)"
@default-on="builder.patchField(uid(), { defaultOn: $event })"
@add-choice="builder.addChoice(uid(), $event)"
@remove-choice="builder.removeChoice(uid(), $event)"
@rename-choice="(index, text) => builder.renameChoice(uid(), index, text)"
@reorder-choices="builder.reorderChoices(uid(), $event)"
:focus-token="focusToken"
@label="actions.setLabel(uid(), $event)"
@key="actions.setFieldKey(uid(), $event)"
@unlock="actions.unlockFieldKey(uid())"
@reset="actions.resetFieldKey(uid())"
@type="actions.setFieldType(uid(), $event)"
@required="actions.patchField(uid(), { required: $event })"
@unique="actions.patchField(uid(), { unique: $event })"
@limit="(which, value) => actions.setLimit(uid(), which, value)"
@default="actions.setDefault(uid(), $event)"
@default-on="actions.patchField(uid(), { defaultOn: $event })"
@add-choice="actions.addChoice(uid(), $event)"
@remove-choice="actions.removeChoice(uid(), $event)"
@rename-choice="(index, text) => actions.renameChoice(uid(), index, text)"
@reorder-choices="actions.reorderChoices(uid(), $event)"
/>
</template>