@5minds/node-red-dashboard-2-processcube-dynamic-form 2.0.3-develop-27d397-mcchcyak → 2.0.3-develop-d8383e-mcd36cwv
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
// eslint-disable-next-line no-unused-vars
|
|
3
|
-
function requiredIf ({ value }, [targetField, expectedValue], node) {
|
|
4
|
-
const actual = node?.root?.value?.[targetField]
|
|
5
|
-
const isEmpty = value === '' || value === null || value === undefined
|
|
6
|
-
|
|
7
|
-
if (actual === expectedValue && isEmpty) {
|
|
8
|
-
return false // oder: `return "Dieses Feld ist erforderlich."`
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return true
|
|
12
|
-
}
|
|
13
|
-
</script>
|
|
14
1
|
<template>
|
|
15
2
|
<div className="ui-dynamic-form-external-sizing-wrapper" :style="props.card_size_styling">
|
|
16
3
|
<!-- Component must be wrapped in a block so props such as className and style can be passed in from parent -->
|
|
@@ -111,6 +98,19 @@ import { getCurrentInstance, markRaw, nextTick } from 'vue'
|
|
|
111
98
|
import '@formkit/themes/genesis'
|
|
112
99
|
import UIDynamicFormFooterAction from './FooterActions.vue'
|
|
113
100
|
import UIDynamicFormTitleText from './TitleText.vue'
|
|
101
|
+
import { rules } from 'eslint-plugin-vue'
|
|
102
|
+
|
|
103
|
+
// eslint-disable-next-line no-unused-vars
|
|
104
|
+
function requiredIf ({ value }, [targetField, expectedValue], node) {
|
|
105
|
+
const actual = node?.root?.value?.[targetField]
|
|
106
|
+
const isEmpty = value === '' || value === null || value === undefined
|
|
107
|
+
|
|
108
|
+
if (actual === expectedValue && isEmpty) {
|
|
109
|
+
return false // oder: `return "Dieses Feld ist erforderlich."`
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return true
|
|
113
|
+
}
|
|
114
114
|
|
|
115
115
|
export default {
|
|
116
116
|
name: 'UIDynamicForm',
|
|
@@ -139,10 +139,7 @@ export default {
|
|
|
139
139
|
const formkitConfig = defaultConfig({
|
|
140
140
|
theme: 'genesis',
|
|
141
141
|
locales: { de },
|
|
142
|
-
locale: 'de'
|
|
143
|
-
rules: {
|
|
144
|
-
requiredIf // ← Hier wird die Regel eingebunden
|
|
145
|
-
}
|
|
142
|
+
locale: 'de'
|
|
146
143
|
})
|
|
147
144
|
app.use(plugin, formkitConfig)
|
|
148
145
|
},
|