File tree Expand file tree Collapse file tree 5 files changed +80
-15
lines changed
src/components/graph/vueWidgets Expand file tree Collapse file tree 5 files changed +80
-15
lines changed Original file line number Diff line number Diff line change 5
5
widget.name
6
6
}}</label >
7
7
<ColorPicker
8
- v-model =" value "
8
+ v-model =" localValue "
9
9
v-bind =" filteredProps"
10
10
:disabled =" readonly"
11
11
inline
12
+ @update:model-value =" onChange"
12
13
/>
13
14
</div >
14
15
</template >
17
18
import ColorPicker from ' primevue/colorpicker'
18
19
import { computed } from ' vue'
19
20
21
+ import { useWidgetValue } from ' @/composables/graph/useWidgetValue'
20
22
import type { SimplifiedWidget } from ' @/types/simplifiedWidget'
21
23
import {
22
24
PANEL_EXCLUDED_PROPS ,
23
25
filterWidgetProps
24
26
} from ' @/utils/widgetPropFilter'
25
27
26
- const value = defineModel <string >({ required: true })
27
-
28
28
const props = defineProps <{
29
29
widget: SimplifiedWidget <string >
30
+ modelValue: string
30
31
readonly? : boolean
31
32
}>()
32
33
34
+ const emit = defineEmits <{
35
+ ' update:modelValue' : [value : string ]
36
+ }>()
37
+
38
+ // Use the composable for consistent widget value handling
39
+ const { localValue, onChange } = useWidgetValue ({
40
+ widget: props .widget ,
41
+ modelValue: props .modelValue ,
42
+ defaultValue: ' #000000' ,
43
+ emit
44
+ })
45
+
33
46
// ColorPicker specific excluded props include panel/overlay classes
34
47
const COLOR_PICKER_EXCLUDED_PROPS = [... PANEL_EXCLUDED_PROPS ] as const
35
48
Original file line number Diff line number Diff line change 4
4
widget.name
5
5
}}</label >
6
6
<MultiSelect
7
- v-model =" value "
7
+ v-model =" localValue "
8
8
v-bind =" filteredProps"
9
9
:disabled =" readonly"
10
10
class =" flex-grow min-w-[8em] max-w-[20em] text-xs"
11
11
size =" small"
12
12
:pt =" {
13
13
option: 'text-xs'
14
14
}"
15
+ @update:model-value =" onChange"
15
16
/>
16
17
</div >
17
18
</template >
20
21
import MultiSelect from ' primevue/multiselect'
21
22
import { computed } from ' vue'
22
23
24
+ import { useWidgetValue } from ' @/composables/graph/useWidgetValue'
23
25
import type { SimplifiedWidget } from ' @/types/simplifiedWidget'
24
26
import {
25
27
PANEL_EXCLUDED_PROPS ,
26
28
filterWidgetProps
27
29
} from ' @/utils/widgetPropFilter'
28
30
29
- const value = defineModel <any []>({ required: true })
30
-
31
31
const props = defineProps <{
32
32
widget: SimplifiedWidget <any []>
33
+ modelValue: any []
33
34
readonly? : boolean
34
35
}>()
35
36
37
+ const emit = defineEmits <{
38
+ ' update:modelValue' : [value : any []]
39
+ }>()
40
+
41
+ // Use the composable for consistent widget value handling
42
+ const { localValue, onChange } = useWidgetValue ({
43
+ widget: props .widget ,
44
+ modelValue: props .modelValue ,
45
+ defaultValue: [],
46
+ emit
47
+ })
48
+
36
49
// MultiSelect specific excluded props include overlay styles
37
50
const MULTISELECT_EXCLUDED_PROPS = [
38
51
... PANEL_EXCLUDED_PROPS ,
Original file line number Diff line number Diff line change 4
4
widget.name
5
5
}}</label >
6
6
<SelectButton
7
- v-model =" value "
7
+ v-model =" localValue "
8
8
v-bind =" filteredProps"
9
9
:disabled =" readonly"
10
10
class =" flex-grow min-w-[8em] max-w-[20em] text-xs"
13
13
label: 'text-xs'
14
14
}
15
15
}"
16
+ @update:model-value =" onChange"
16
17
/>
17
18
</div >
18
19
</template >
21
22
import SelectButton from ' primevue/selectbutton'
22
23
import { computed } from ' vue'
23
24
25
+ import { useWidgetValue } from ' @/composables/graph/useWidgetValue'
24
26
import type { SimplifiedWidget } from ' @/types/simplifiedWidget'
25
27
import {
26
28
STANDARD_EXCLUDED_PROPS ,
27
29
filterWidgetProps
28
30
} from ' @/utils/widgetPropFilter'
29
31
30
- const value = defineModel <any >({ required: true })
31
-
32
32
const props = defineProps <{
33
33
widget: SimplifiedWidget <any >
34
+ modelValue: any
34
35
readonly? : boolean
35
36
}>()
36
37
38
+ const emit = defineEmits <{
39
+ ' update:modelValue' : [value : any ]
40
+ }>()
41
+
42
+ // Use the composable for consistent widget value handling
43
+ const { localValue, onChange } = useWidgetValue ({
44
+ widget: props .widget ,
45
+ modelValue: props .modelValue ,
46
+ defaultValue: null ,
47
+ emit
48
+ })
49
+
37
50
const filteredProps = computed (() =>
38
51
filterWidgetProps (props .widget .options , STANDARD_EXCLUDED_PROPS )
39
52
)
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<Textarea
3
- v-model =" value "
3
+ v-model =" localValue "
4
4
v-bind =" filteredProps"
5
5
:disabled =" readonly"
6
6
class =" w-full text-xs"
7
7
size =" small"
8
8
rows =" 3"
9
+ @update:model-value =" onChange"
9
10
/>
10
11
</template >
11
12
12
13
<script setup lang="ts">
13
14
import Textarea from ' primevue/textarea'
14
15
import { computed } from ' vue'
15
16
17
+ import { useWidgetValue } from ' @/composables/graph/useWidgetValue'
16
18
import type { SimplifiedWidget } from ' @/types/simplifiedWidget'
17
19
import {
18
20
INPUT_EXCLUDED_PROPS ,
19
21
filterWidgetProps
20
22
} from ' @/utils/widgetPropFilter'
21
23
22
- const value = defineModel <string >({ required: true })
23
-
24
24
const props = defineProps <{
25
25
widget: SimplifiedWidget <string >
26
+ modelValue: string
26
27
readonly? : boolean
27
28
}>()
28
29
30
+ const emit = defineEmits <{
31
+ ' update:modelValue' : [value : string ]
32
+ }>()
33
+
34
+ // Use the composable for consistent widget value handling
35
+ const { localValue, onChange } = useWidgetValue ({
36
+ widget: props .widget ,
37
+ modelValue: props .modelValue ,
38
+ defaultValue: ' ' ,
39
+ emit
40
+ })
41
+
29
42
const filteredProps = computed (() =>
30
43
filterWidgetProps (props .widget .options , INPUT_EXCLUDED_PROPS )
31
44
)
Original file line number Diff line number Diff line change 4
4
widget.name
5
5
}}</label >
6
6
<TreeSelect
7
- v-model =" value "
7
+ v-model =" localValue "
8
8
v-bind =" filteredProps"
9
9
:disabled =" readonly"
10
10
class =" flex-grow min-w-[8em] max-w-[20em] text-xs"
11
11
size =" small"
12
+ @update:model-value =" onChange"
12
13
/>
13
14
</div >
14
15
</template >
17
18
import TreeSelect from ' primevue/treeselect'
18
19
import { computed } from ' vue'
19
20
21
+ import { useWidgetValue } from ' @/composables/graph/useWidgetValue'
20
22
import type { SimplifiedWidget } from ' @/types/simplifiedWidget'
21
23
import {
22
24
PANEL_EXCLUDED_PROPS ,
23
25
filterWidgetProps
24
26
} from ' @/utils/widgetPropFilter'
25
27
26
- const value = defineModel <any >({ required: true })
27
-
28
28
const props = defineProps <{
29
29
widget: SimplifiedWidget <any >
30
+ modelValue: any
30
31
readonly? : boolean
31
32
}>()
32
33
34
+ const emit = defineEmits <{
35
+ ' update:modelValue' : [value : any ]
36
+ }>()
37
+
38
+ // Use the composable for consistent widget value handling
39
+ const { localValue, onChange } = useWidgetValue ({
40
+ widget: props .widget ,
41
+ modelValue: props .modelValue ,
42
+ defaultValue: null ,
43
+ emit
44
+ })
45
+
33
46
// TreeSelect specific excluded props
34
47
const TREE_SELECT_EXCLUDED_PROPS = [
35
48
... PANEL_EXCLUDED_PROPS ,
You can’t perform that action at this time.
0 commit comments