diff --git a/apps/workflowengine/src/components/Checks/FileSystemTag.vue b/apps/workflowengine/src/components/Checks/FileSystemTag.vue index ee880aec075..e71b0cd259a 100644 --- a/apps/workflowengine/src/components/Checks/FileSystemTag.vue +++ b/apps/workflowengine/src/components/Checks/FileSystemTag.vue @@ -17,18 +17,21 @@ export default { NcSelectTags, }, props: { - value: { + modelValue: { type: String, default: '', }, }, + + emits: ['update:model-value'], + data() { return { newValue: [], } }, watch: { - value() { + modelValue() { this.updateValue() }, }, @@ -37,14 +40,14 @@ export default { }, methods: { updateValue() { - if (this.value !== '') { - this.newValue = parseInt(this.value) + if (this.modelValue !== '') { + this.newValue = parseInt(this.modelValue) } else { this.newValue = null } }, update() { - this.$emit('input', this.newValue || '') + this.$emit('update:model-value', this.newValue || '') }, }, } diff --git a/apps/workflowengine/src/components/Checks/file.js b/apps/workflowengine/src/components/Checks/file.js index 246f46ff55b..5a5b5d22b41 100644 --- a/apps/workflowengine/src/components/Checks/file.js +++ b/apps/workflowengine/src/components/Checks/file.js @@ -80,8 +80,25 @@ const FileChecks = [ { operator: 'is', name: t('workflowengine', 'is tagged with') }, { operator: '!is', name: t('workflowengine', 'is not tagged with') }, ], - component: FileSystemTag, + webComponent: registerWebComponent(FileSystemTag, 'oca-workflowengine-file_system_tag'), }, ] +/** + * + * @param VueComponent + * @param webComponentId + */ +function registerWebComponent(VueComponent, webComponentId) { + const WrappedComponent = wrap(Vue, VueComponent) + window.customElements.define(webComponentId, WrappedComponent) + + // In Vue 2, wrap doesn't support disabling shadow :( + // Disable with a hack + Object.defineProperty(WrappedComponent.prototype, 'attachShadow', { value() { return this } }) + Object.defineProperty(WrappedComponent.prototype, 'shadowRoot', { get() { return this } }) + + return webComponentId +} + export default FileChecks diff --git a/package-lock.json b/package-lock.json index d6d0b7e0150..cd5c7879bf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,6 +32,7 @@ "@nextcloud/upload": "^1.9.1", "@nextcloud/vue": "^8.24.0", "@simplewebauthn/browser": "^12.0.0", + "@vue/web-component-wrapper": "^1.3.0", "@vueuse/components": "^11.1.0", "@vueuse/core": "^11.0.1", "@vueuse/integrations": "^11.3.0", @@ -6778,6 +6779,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@vue/web-component-wrapper": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@vue/web-component-wrapper/-/web-component-wrapper-1.3.0.tgz", + "integrity": "sha512-Iu8Tbg3f+emIIMmI2ycSI8QcEuAUgPTgHwesDU1eKMLE4YC/c/sFbGc70QgMq31ijRftV0R7vCm9co6rldCeOA==", + "license": "MIT" + }, "node_modules/@vueuse/components": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/@vueuse/components/-/components-11.1.0.tgz", diff --git a/package.json b/package.json index f86d59f55d1..a44b085f6f2 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "@nextcloud/upload": "^1.9.1", "@nextcloud/vue": "^8.24.0", "@simplewebauthn/browser": "^12.0.0", + "@vue/web-component-wrapper": "^1.3.0", "@vueuse/components": "^11.1.0", "@vueuse/core": "^11.0.1", "@vueuse/integrations": "^11.3.0",