From b0412b67a58c966093666a8e1e7660324999310b Mon Sep 17 00:00:00 2001 From: lazerg Date: Fri, 6 Nov 2026 21:27:15 +0500 Subject: [PATCH 1/2] Fix select field preview disappearing after reordering replicator sets --- .../components/fieldtypes/SelectFieldtype.vue | 3 ++- .../fieldtypes/SelectFieldtype.test.js | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 resources/js/tests/components/fieldtypes/SelectFieldtype.test.js diff --git a/resources/js/components/fieldtypes/SelectFieldtype.vue b/resources/js/components/fieldtypes/SelectFieldtype.vue index 93707a46500..5675dcf9b08 100644 --- a/resources/js/components/fieldtypes/SelectFieldtype.vue +++ b/resources/js/components/fieldtypes/SelectFieldtype.vue @@ -25,7 +25,8 @@ import { computed } from 'vue'; const emit = defineEmits(Fieldtype.emits); const props = defineProps(Fieldtype.props); -const { isReadOnly, defineReplicatorPreview, update } = Fieldtype.use(emit, props); +const { isReadOnly, defineReplicatorPreview, update, expose } = Fieldtype.use(emit, props); +defineExpose(expose); const selectedOptions = computed(() => { let selections = props.value === null ? [] : props.value; diff --git a/resources/js/tests/components/fieldtypes/SelectFieldtype.test.js b/resources/js/tests/components/fieldtypes/SelectFieldtype.test.js new file mode 100644 index 00000000000..c4f503e3187 --- /dev/null +++ b/resources/js/tests/components/fieldtypes/SelectFieldtype.test.js @@ -0,0 +1,22 @@ +import { mount } from '@vue/test-utils'; +import { expect, test } from 'vitest'; +import { h, ref } from 'vue'; +import SelectFieldtype from '@/components/fieldtypes/SelectFieldtype.vue'; + +window.__ = (key) => key; + +test('replicator preview is exposed to the parent field', () => { + const fieldtype = ref(); + + mount(() => + h(SelectFieldtype, { + ref: fieldtype, + value: 'two', + handle: 'select', + config: { options: { one: 'One', two: 'Two' } }, + showFieldPreviews: true, + }), + ); + + expect(fieldtype.value.replicatorPreview).toBe('Two'); +}); From c4b261fdfcc5cd73d883c44f36ce78cc051614c2 Mon Sep 17 00:00:00 2001 From: lazerg Date: Fri, 6 Nov 2026 21:29:21 +0500 Subject: [PATCH 2/2] Expose icon fieldtype replicator preview --- resources/js/components/fieldtypes/IconFieldtype.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/js/components/fieldtypes/IconFieldtype.vue b/resources/js/components/fieldtypes/IconFieldtype.vue index f308ba712c2..34dcb4283e9 100644 --- a/resources/js/components/fieldtypes/IconFieldtype.vue +++ b/resources/js/components/fieldtypes/IconFieldtype.vue @@ -7,7 +7,8 @@ import { Button, Combobox, Icon, Input, Modal } from '@/components/ui'; const emit = defineEmits(Fieldtype.emits); const props = defineProps(Fieldtype.props); -const { isReadOnly, update } = Fieldtype.use(emit, props); +const { isReadOnly, update, expose } = Fieldtype.use(emit, props); +defineExpose(expose); const icons = ref([]); const loading = ref(true);