-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into fix/updating-bard-con…
…figs-in-fieldsets
- Loading branch information
Showing
42 changed files
with
1,395 additions
and
792 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
resources/js/components/Fieldtypes/ImportMappingsFieldtype.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<template> | ||
<div> | ||
<table class="grid-table table-auto field-mappings-table"> | ||
<thead> | ||
<tr> | ||
<th style="text-align: left">{{ __('Blueprint Field') }}</th> | ||
<th style="text-align: left">{{ __('Data From Import') }}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr v-for="field in meta.fields"> | ||
<td class="w-1/3"> | ||
<label class="text-sm font-medium" :for="`mappings.${field.handle}.key`"> | ||
{{ field.display }} | ||
</label> | ||
<span class="badge rounded-sm text-gray-700 dark:text-dark-100 inline-flex items-center p-0 border border-gray-300 dark:border-dark-300"> | ||
<span class="px-1">{{ __('Type') }}</span> | ||
<span class="bg-white rounded-r-sm dark:bg-dark-300 px-1">{{ field.fieldtype_title }}</span> | ||
</span> | ||
</td> | ||
<td> | ||
<publish-container | ||
:name="`mappings.${field.handle}`" | ||
:values="value[field.handle]" | ||
:meta="field.meta" | ||
:errors="errors(field.handle)" | ||
:track-dirty-state="false" | ||
@updated="mappingUpdated(field.handle, $event)" | ||
> | ||
<div slot-scope="{ setFieldValue, setFieldMeta }"> | ||
<div class="-mx-4 md:-ml-6"> | ||
<publish-fields | ||
:fields="field.fields" | ||
:read-only="isReadOnly" | ||
@updated="setFieldValue" | ||
@meta-updated="setFieldMeta" | ||
/> | ||
</div> | ||
</div> | ||
</publish-container> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</template> | ||
|
||
<style> | ||
.field-mappings-table .form-group { | ||
padding-top: 16px; | ||
padding-bottom: 16px; | ||
} | ||
.field-mappings-table .form-group:first-child { | ||
padding-top: 0; | ||
} | ||
.field-mappings-table .form-group:last-child { | ||
padding-bottom: 0; | ||
} | ||
</style> | ||
|
||
<script> | ||
export default { | ||
mixins: [Fieldtype], | ||
inject: [ | ||
'storeName', | ||
], | ||
methods: { | ||
mappingUpdated(fieldHandle, value) { | ||
this.$emit('input', { | ||
...this.value, | ||
[fieldHandle]: value, | ||
}); | ||
}, | ||
errors(prefix) { | ||
const state = this.$store.state.publish[this.storeName]; | ||
if (! state) return []; | ||
return Object.keys(state.errors || []) | ||
.filter(key => key.startsWith(`mappings.${prefix}`)) | ||
.reduce((acc, key) => { | ||
acc[key.replace(`mappings.${prefix}.`, '')] = state.errors[key]; | ||
return acc; | ||
}, {}); | ||
}, | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.