Skip to content

Commit

Permalink
Merge branch 'next-36596/disable-vue-compat-group-27' into 'trunk'
Browse files Browse the repository at this point in the history
NEXT-36596 - disable vue compat group 27

See merge request shopware/6/product/platform!14323
  • Loading branch information
seggewiss committed Jul 29, 2024
2 parents 44ab159 + 3042213 commit 1040306
Show file tree
Hide file tree
Showing 31 changed files with 504 additions and 171 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,23 @@ Component.register('sw-form-field-renderer', {

computed: {
bind() {
const bind = {
...this.$attrs,
let bind = {};

if (!this.isCompatEnabled('INSTANCE_LISTENERS')) {
// Filter all listeners from the $attrs object
Object.keys(this.$attrs).forEach((key) => {
if (!['onUpdate:value'].includes(key)) {
bind[key] = this.$attrs[key];
}
});
} else {
bind = {
...this.$attrs,
};
}

bind = {
...bind,
...this.config,
...this.swFieldType,
...this.translations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,23 @@ Component.register('sw-price-field', {
},
},

attributesWithoutListeners() {
if (this.isCompatEnabled('INSTANCE_LISTENERS')) {
return this.$attrs;
}

const attributes = {};

// Filter all listeners from the $attrs object
Object.keys(this.$attrs).forEach((key) => {
if (!key.startsWith('on')) {
attributes[key] = this.$attrs[key];
}
});

return attributes;
},

isInherited() {
if (this.inherited !== undefined) {
return this.inherited;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
:error="grossError"
:disabled="isDisabled"
:name="grossFieldName"
v-bind="$attrs"
v-bind="attributesWithoutListeners"
@update:value="onPriceGrossChange"
@keyup="keymonitor"
@input-change="onPriceGrossInputChange"
Expand Down Expand Up @@ -67,7 +67,6 @@

<!-- eslint-disable-next-line sw-deprecation-rules/no-twigjs-blocks -->
{% block sw_price_field_net %}
{# TODO: check selectors #}
<sw-number-field
v-model:value="priceForCurrency.net"
class="sw-price-field__net"
Expand All @@ -82,7 +81,7 @@
:error="netError"
:disabled="isInherited || disabled"
:name="netFieldName"
v-bind="$attrs"
v-bind="attributesWithoutListeners"
@update:value="onPriceNetChange"
@keyup="keymonitor"
@input-change="onPriceNetInputChange"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ export default {

toggleItemCheck($event, item) {
if ($event) {
this.$set(this.selectedCustomFields, item.name, this.entity.customFields[item.name]);
} else {
if (this.isCompatEnabled('INSTANCE_SET')) {
this.$set(this.selectedCustomFields, item.name, this.entity.customFields[item.name]);
} else {
this.selectedCustomFields[item.name] = this.entity.customFields[item.name];
}
} else if (this.isCompatEnabled('INSTANCE_DELETE')) {
this.$delete(this.selectedCustomFields, item.name);
} else {
delete this.selectedCustomFields[item.name];
}
},

Expand All @@ -56,7 +62,11 @@ export default {
return;
}

this.$set(this.selectedCustomFields, item.name, this.entity.customFields[item.name]);
if (this.isCompatEnabled('INSTANCE_SET')) {
this.$set(this.selectedCustomFields, item.name, this.entity.customFields[item.name]);
} else {
this.selectedCustomFields[item.name] = this.entity.customFields[item.name];
}
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const { Criteria } = Shopware.Data;
export default {
template,

compatConfig: Shopware.compatConfig,

inject: ['repositoryFactory'],

mixins: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @package services-settings
* @group disabledCompat
*/
import { mount } from '@vue/test-utils';
import swBulkEditState from 'src/module/sw-bulk-edit/state/sw-bulk-edit.state';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const { State } = Shopware;
export default {
template,

compatConfig: Shopware.compatConfig,

computed: {
generateData: {
get() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/**
* @package services-settings
* @group disabledCompat
*/
import { mount } from '@vue/test-utils';
import swBulkEditState from 'src/module/sw-bulk-edit/state/sw-bulk-edit.state';
import swBulkEditOrderDocumentsGenerateInvoice from 'src/module/sw-bulk-edit/component/sw-bulk-edit-order/sw-bulk-edit-order-documents-generate-invoice';

Shopware.Component.register('sw-bulk-edit-order-documents-generate-invoice', swBulkEditOrderDocumentsGenerateInvoice);

async function createWrapper() {
return mount(await wrapTestComponent('sw-bulk-edit-order-documents-generate-invoice', { sync: true }), {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const { Criteria } = Shopware.Data;
export default {
template,

compatConfig: Shopware.compatConfig,

inject: [
'repositoryFactory',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
:key="document.id"
v-model:value="value.documentType[document.technicalName]"
:label="document.name"
:disabled="documents?.disabled"
:disabled="documents?.disabled || undefined"
/>
{% endblock %}

Expand All @@ -23,7 +23,7 @@
<sw-switch-field
v-model:value="value.skipSentDocuments"
:label="$tc('sw-bulk-edit.order.status.documents.skipSentDocuments')"
:disabled="documents?.disabled"
:disabled="documents?.disabled || undefined"
/>
{% endblock %}
</sw-container>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @package services-settings
* @group disabledCompat
*/
import { mount } from '@vue/test-utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default {
this.createdComponent();
},

beforeDestroy() {
beforeUnmount() {
this.beforeDestroyComponent();
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const { cloneDeep } = Shopware.Utils.object;
export default {
template,

compatConfig: Shopware.compatConfig,

inject: [
'feature',
'bulkEditApiFactory',
Expand Down Expand Up @@ -160,7 +162,7 @@ export default {
this.createdComponent();
},

beforeDestroy() {
beforeUnmount() {
Shopware.State.unregisterModule('swBulkEdit');
},

Expand Down Expand Up @@ -189,20 +191,37 @@ export default {
},

setRouteMetaModule() {
this.$set(this.$route.meta.$module, 'color', '#F88962');
this.$set(this.$route.meta.$module, 'icon', 'regular-users');
if (this.isCompatEnabled('INSTANCE_SET')) {
this.$set(this.$route.meta.$module, 'color', '#F88962');
this.$set(this.$route.meta.$module, 'icon', 'regular-users');
} else {
if (!this.$route.meta.$module) {
this.$route.meta.$module = {};
}

this.$route.meta.$module.color = '#F88962';
this.$route.meta.$module.icon = 'regular-users';
}
},

defineBulkEditData(name, value = null, type = 'overwrite', isChanged = false) {
if (this.bulkEditData[name]) {
return;
}

this.$set(this.bulkEditData, name, {
isChanged: isChanged,
type: type,
value: value,
});
if (this.isCompatEnabled('INSTANCE_SET')) {
this.$set(this.bulkEditData, name, {
isChanged: isChanged,
type: type,
value: value,
});
} else {
this.bulkEditData[name] = {
isChanged: isChanged,
type: type,
value: value,
};
}
},

loadBulkEditData() {
Expand All @@ -217,10 +236,17 @@ export default {
});
});

this.$set(this.bulkEditData, 'customFields', {
type: 'overwrite',
value: null,
});
if (this.isCompatEnabled('INSTANCE_SET')) {
this.$set(this.bulkEditData, 'customFields', {
type: 'overwrite',
value: null,
});
} else {
this.bulkEditData.customFields = {
type: 'overwrite',
value: null,
};
}
},

loadCustomFieldSets() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/**
* @package services-settings
* @group disabledCompat
*/
import { config, mount } from '@vue/test-utils';
import { createRouter, createWebHashHistory } from 'vue-router';
Expand Down Expand Up @@ -84,6 +85,24 @@ describe('src/module/sw-bulk-edit/page/sw-bulk-edit-customer', () => {
'sw-bulk-edit-save-modal-success': await wrapTestComponent('sw-bulk-edit-save-modal-success', { sync: true }),
'sw-bulk-edit-save-modal-confirm': await wrapTestComponent('sw-bulk-edit-save-modal-confirm', { sync: true }),
'sw-bulk-edit-save-modal': await wrapTestComponent('sw-bulk-edit-save-modal', { sync: true }),
'sw-app-topbar-button': true,
'sw-help-center-v2': true,
'mt-button': true,
'mt-loader': true,
'sw-loader-deprecated': true,
'mt-card': true,
'sw-ai-copilot-badge': true,
'sw-context-button': true,
'sw-inheritance-switch': true,
'sw-inherit-wrapper': true,
'sw-media-collapse': true,
'mt-tabs': true,
'mt-checkbox': true,
'sw-highlight-text': true,
'sw-select-result': true,
'sw-select-result-list': true,
'sw-product-variant-info': true,
'mt-switch': true,
},
provide: {
validationService: {},
Expand Down Expand Up @@ -174,11 +193,14 @@ describe('src/module/sw-bulk-edit/page/sw-bulk-edit-customer', () => {
{
name: 'sw.bulk.edit.customer',
path: '/index',
component: {
template: '<div></div>',
},
},
{
name: 'sw.bulk.edit.customer.save',
path: '',
component: await wrapTestComponent('sw-bulk-edit-save-modal'),
component: await wrapTestComponent('sw-bulk-edit-save-modal', { sync: true }),
meta: {
$module: {
title: 'sw-bulk-edit-customer.general.mainMenuTitle',
Expand All @@ -191,7 +213,7 @@ describe('src/module/sw-bulk-edit/page/sw-bulk-edit-customer', () => {
{
name: 'sw.bulk.edit.customer.save.confirm',
path: '/confirm',
component: await wrapTestComponent('sw-bulk-edit-save-modal-confirm'),
component: await wrapTestComponent('sw-bulk-edit-save-modal-confirm', { sync: true }),
meta: {
$module: {
title: 'sw-bulk-edit-customer.general.mainMenuTitle',
Expand All @@ -201,7 +223,7 @@ describe('src/module/sw-bulk-edit/page/sw-bulk-edit-customer', () => {
{
name: 'sw.bulk.edit.customer.save.process',
path: '/process',
component: await wrapTestComponent('sw-bulk-edit-save-modal-process'),
component: await wrapTestComponent('sw-bulk-edit-save-modal-process', { sync: true }),
meta: {
$module: {
title: 'sw-bulk-edit-customer.general.mainMenuTitle',
Expand All @@ -211,7 +233,7 @@ describe('src/module/sw-bulk-edit/page/sw-bulk-edit-customer', () => {
{
name: 'sw.bulk.edit.customer.save.success',
path: '/success',
component: await wrapTestComponent('sw-bulk-edit-save-modal-success'),
component: await wrapTestComponent('sw-bulk-edit-save-modal-success', { sync: true }),
meta: {
$module: {
title: 'sw-bulk-edit-customer.general.mainMenuTitle',
Expand All @@ -221,7 +243,7 @@ describe('src/module/sw-bulk-edit/page/sw-bulk-edit-customer', () => {
{
name: 'sw.bulk.edit.customer.save.error',
path: '/error',
component: await wrapTestComponent('sw-bulk-edit-save-modal-error'),
component: await wrapTestComponent('sw-bulk-edit-save-modal-error', { sync: true }),
meta: {
$module: {
title: 'sw-bulk-edit-customer.general.mainMenuTitle',
Expand Down
Loading

0 comments on commit 1040306

Please sign in to comment.