Commit 099ab666be4e527fed85829ac9b60b57e00cc075

Authored by ww
1 parent c63ac5d2

feat: visual board can not select visual component

1 <script lang="ts" setup> 1 <script lang="ts" setup>
2 - import { RadioRecord } from '../../detail/config/util'; 2 + import { computed } from '@vue/reactivity';
  3 + import { DEFAULT_RADIO_RECORD, fontSize, RadioRecord } from '../../detail/config/util';
3 4
4 const props = defineProps<{ 5 const props = defineProps<{
5 value?: boolean; 6 value?: boolean;
@@ -14,10 +15,20 @@ @@ -14,10 +15,20 @@
14 emit('update:value', _value); 15 emit('update:value', _value);
15 emit('change', _value); 16 emit('change', _value);
16 }; 17 };
  18 +
  19 + const getRadio = computed(() => {
  20 + return props.radio! || DEFAULT_RADIO_RECORD;
  21 + });
17 </script> 22 </script>
18 23
19 <template> 24 <template>
20 - <div class="toggle-switch"> 25 + <div
  26 + class="toggle-switch"
  27 + :style="{
  28 + width: fontSize({ radioRecord: getRadio, basic: 75, max: 75, min: 60 }),
  29 + height: fontSize({ radioRecord: getRadio, basic: 97.5, max: 97.5, min: 80 }),
  30 + }"
  31 + >
21 <label class="switch"> 32 <label class="switch">
22 <input :value="props.value" type="checkbox" :checked="props.value" @change="handleChange" /> 33 <input :value="props.value" type="checkbox" :checked="props.value" @change="handleChange" />
23 <div class="button"> 34 <div class="button">
@@ -33,9 +44,10 @@ @@ -33,9 +44,10 @@
33 44
34 <style scoped> 45 <style scoped>
35 .toggle-switch { 46 .toggle-switch {
36 - flex: 1 1 auto; 47 + /* flex: 1 1 auto; */
37 max-width: 75px; 48 max-width: 75px;
38 - height: 97.5px; 49 +
  50 + /* height: 97.5px; */
39 display: flex; 51 display: flex;
40 } 52 }
41 53
  1 +import { ComponentConfig } from '../help';
  2 +
  3 +export const transfromMapComponentConfig: ComponentConfig['transformConfig'] = (
  4 + _componentConfig,
  5 + _record,
  6 + _dataSourceRecord
  7 +) => {
  8 + return {};
  9 +};
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 <section class="widget"> 18 <section class="widget">
19 <slot name="header"></slot> 19 <slot name="header"></slot>
20 20
21 - <div class="widget-content" :style="{ height: slot.header ? 'calc(100% - 22px)' : '100%' }"> 21 + <div class="widget-content">
22 <div 22 <div
23 v-for="item in props.dataSource" 23 v-for="item in props.dataSource"
24 :key="item.id" 24 :key="item.id"
@@ -28,6 +28,7 @@ import ToggleSwitch from './ControlComponent/ToggleSwitch.vue'; @@ -28,6 +28,7 @@ import ToggleSwitch from './ControlComponent/ToggleSwitch.vue';
28 import SlidingSwitch from './ControlComponent/SlidingSwitch.vue'; 28 import SlidingSwitch from './ControlComponent/SlidingSwitch.vue';
29 import SwitchWithIcon from './ControlComponent/SwitchWithIcon.vue'; 29 import SwitchWithIcon from './ControlComponent/SwitchWithIcon.vue';
30 import MapComponent from './MapComponent/MapComponent.vue'; 30 import MapComponent from './MapComponent/MapComponent.vue';
  31 +import { transfromMapComponentConfig } from './MapComponent/map.config';
31 32
32 export enum FrontComponentCategory { 33 export enum FrontComponentCategory {
33 TEXT = 'text', 34 TEXT = 'text',
@@ -170,7 +171,7 @@ frontComponentMap.set(FrontComponent.MAP_COMPONENT_TRACK, { @@ -170,7 +171,7 @@ frontComponentMap.set(FrontComponent.MAP_COMPONENT_TRACK, {
170 Component: MapComponent, 171 Component: MapComponent,
171 ComponentKey: FrontComponent.MAP_COMPONENT_TRACK, 172 ComponentKey: FrontComponent.MAP_COMPONENT_TRACK,
172 ComponentCategory: FrontComponentCategory.MAP, 173 ComponentCategory: FrontComponentCategory.MAP,
173 - transformConfig: () => {}, 174 + transformConfig: transfromMapComponentConfig,
174 }); 175 });
175 176
176 frontComponentDefaultConfigMap.set(FrontComponent.TEXT_COMPONENT_1, TextComponentDefaultConfig); 177 frontComponentDefaultConfigMap.set(FrontComponent.TEXT_COMPONENT_1, TextComponentDefaultConfig);