Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/js/components/field-actions/FieldAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class FieldAction {
const response = this.#run(payload);

if (response instanceof Promise) {
const progress = this.#payload.vm.$progress;
const progress = Statamic.$progress;
const name = this.#payload.fieldPathPrefix ?? this.#payload.handle;
progress.loading(name, true);
response.finally(() => progress.loading(name, false));
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/fieldtypes/Fieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ export default {

fieldActionPayload() {
return {
vm: this,
fieldPathPrefix: this.fieldPathPrefix,
handle: this.handle,
value: this.value,
Expand All @@ -93,6 +92,7 @@ export default {
update: this.update,
updateMeta: this.updateMeta,
isReadOnly: this.isReadOnly,
container: this.injectedPublishContainer,
};
},
},
Expand Down
7 changes: 3 additions & 4 deletions resources/js/components/fieldtypes/bard/Set.vue
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,17 @@ export default {

fieldActionPayload() {
return {
// vm: this,
// fieldVm: this.fieldVm,
// fieldPathPrefix: this.fieldVm.fieldPathPrefix || this.fieldVm.handle,
fieldPathPrefix: this.fieldPathPrefix,
index: this.index,
values: this.values,
config: this.config,
// meta: this.meta,
meta: this.meta,
update: (handle, value) =>
this.publishContainer.setFieldValue(`${this.fieldPathPrefix}.${handle}`, value),
updateMeta: (handle, value) =>
this.publishContainer.setFieldMeta(`${this.metaPathPrefix}.${handle}`, value),
isReadOnly: this.isReadOnly,
container: this.publishContainer,
};
},

Expand Down
5 changes: 4 additions & 1 deletion resources/js/components/fieldtypes/fieldtype.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import props from './props.js';
import { computed, ref, watch } from 'vue';
import FieldAction from '@/components/field-actions/FieldAction.js';
import toFieldActions from '@/components/field-actions/toFieldActions.js';
import { injectPublishContext } from "@ui";

const use = function(emit, props) {
const { container } = injectPublishContext() ?? {};

const name = computed(() => {
if (props.namePrefix) {
return `${props.namePrefix}[${props.handle}]`;
Expand Down Expand Up @@ -63,7 +66,6 @@ const use = function(emit, props) {
};

const fieldActionPayload = computed(() => ({
// vm: this,
fieldPathPrefix: props.fieldPathPrefix,
handle: props.handle,
value: props.value,
Expand All @@ -72,6 +74,7 @@ const use = function(emit, props) {
update,
updateMeta,
isReadOnly: isReadOnly.value,
container,
}));

const internalFieldActions = ref([]);
Expand Down
12 changes: 7 additions & 5 deletions resources/js/components/fieldtypes/replicator/Set.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import PreviewHtml from '@/components/fieldtypes/replicator/PreviewHtml.js';
import FieldAction from '@/components/field-actions/FieldAction.js';
import toFieldActions from '@/components/field-actions/toFieldActions.js';
import { reveal } from '@api';
import { data_get } from "@/bootstrap/globals.js";

const emit = defineEmits(['collapsed', 'expanded', 'duplicated', 'removed']);

Expand All @@ -44,7 +45,9 @@ const props = defineProps({
const {
setFieldValue,
setFieldMeta,
previews
previews,
container,
meta
} = injectContainerContext();
const fieldPathPrefix = computed(() => `${props.fieldPath}.${props.index}`);
const metaPathPrefix = computed(() => `${props.metaPath}.existing.${props.id}`);
Expand All @@ -63,16 +66,15 @@ const setGroup = computed(() => {
const isSetGroupVisible = computed(() => replicatorSets.length > 1 && setGroup.value.display);

const fieldActionPayload = computed(() => ({
// vm: this,
// fieldVm: this.fieldVm,
// fieldPathPrefix: this.fieldPathPrefix,
fieldPathPrefix: fieldPathPrefix.value,
index: props.index,
values: props.values,
config: props.config,
// meta: this.meta,
meta: data_get(meta.value, metaPathPrefix.value),
update: (handle, value) => setFieldValue(`${fieldPathPrefix.value}.${handle}`, value),
updateMeta: (handle, value) => setFieldMeta(`${metaPathPrefix.value}.${handle}`, value),
isReadOnly: props.readOnly,
container,
}));

const fieldActions = computed(() => {
Expand Down