0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-04-14 13:29:21 +00:00

fix(workflowengine): adapt check operator FileSystemTag to use web component

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2025-03-13 18:45:37 +01:00
parent 3e03793e61
commit 492fa1e24c
No known key found for this signature in database
GPG key ID: 7424F1874854DF23
4 changed files with 34 additions and 6 deletions
apps/workflowengine/src/components/Checks
package-lock.jsonpackage.json

View file

@ -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 || '')
},
},
}

View file

@ -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

7
package-lock.json generated
View file

@ -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",

View file

@ -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",