|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<el-col
|
|
|
v-if="!schema?.hide && schema.valueType !== 'dependency'"
|
|
|
- :span="schema?.componentProps?.span ?? 24"
|
|
|
+ :span="componentProps?.span ?? 24"
|
|
|
>
|
|
|
<el-form-item
|
|
|
v-if="isFormItem"
|
|
|
@@ -18,7 +18,7 @@
|
|
|
:type="schema?.slots ? 'text' : 'textarea'"
|
|
|
:rows="1"
|
|
|
resize="none"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
>
|
|
|
<template #prefix>
|
|
|
{{ schema?.slots?.prefix }}
|
|
|
@@ -33,7 +33,7 @@
|
|
|
v-model="value"
|
|
|
controls-position="right"
|
|
|
style="width: 100%"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
>
|
|
|
<template #prefix>
|
|
|
{{ schema?.slots?.prefix }}
|
|
|
@@ -45,9 +45,9 @@
|
|
|
<!-- 选择框 -->
|
|
|
<el-select-v2
|
|
|
v-if="schema.valueType === 'select'"
|
|
|
- :options="schema?.componentProps?.options || []"
|
|
|
+ :options="componentProps?.options || []"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
>
|
|
|
<template #prefix>
|
|
|
{{ schema?.slots?.prefix }}
|
|
|
@@ -58,12 +58,12 @@
|
|
|
</el-select-v2>
|
|
|
<!-- 开关 -->
|
|
|
<div v-if="schema.valueType === 'switch'" class="w-full flex justify-end">
|
|
|
- <el-switch v-model="value" v-bind="schema?.componentProps" />
|
|
|
+ <el-switch v-model="value" v-bind="componentProps" />
|
|
|
</div>
|
|
|
|
|
|
<!-- 滑动条 -->
|
|
|
<div v-if="schema.valueType === 'slider'" class="w-full flex gap-20px items-center">
|
|
|
- <el-slider v-model="value" v-bind="schema?.componentProps" style="flex: 1"></el-slider>
|
|
|
+ <el-slider v-model="value" v-bind="componentProps" style="flex: 1"></el-slider>
|
|
|
<span class="text-text-active inline w-30px cursor-pointer">
|
|
|
{{ value }}
|
|
|
</span>
|
|
|
@@ -72,25 +72,25 @@
|
|
|
<CusTextarea
|
|
|
v-if="schema.valueType === 'textarea'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 图片选择 -->
|
|
|
<ImageSelect
|
|
|
v-if="schema.valueType === 'image'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 文件选择 -->
|
|
|
<FileSelect
|
|
|
v-if="schema.valueType === 'file'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 图标选择 -->
|
|
|
<SymbolSelect
|
|
|
v-if="schema.valueType === 'symbol'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 颜色选择 -->
|
|
|
<div class="flex" v-if="schema.valueType === 'color'">
|
|
|
@@ -99,7 +99,7 @@
|
|
|
use-type="pure"
|
|
|
picker-type="chrome"
|
|
|
format="hex8"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<span class="text-text-active">{{ value }}</span>
|
|
|
</div>
|
|
|
@@ -109,7 +109,7 @@
|
|
|
v-if="schema.valueType === 'code'"
|
|
|
class="w-full relative border border-solid border-border rounded-4px overflow-hidden"
|
|
|
>
|
|
|
- <MonacoEditor v-model="value" v-bind="schema?.componentProps" />
|
|
|
+ <MonacoEditor v-model="value" v-bind="componentProps" />
|
|
|
</div>
|
|
|
|
|
|
<!-- 日期 -->
|
|
|
@@ -117,7 +117,7 @@
|
|
|
v-if="schema.valueType === 'date'"
|
|
|
v-model="value"
|
|
|
style="width: 100%"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
|
|
|
<!-- 时间 -->
|
|
|
@@ -125,14 +125,14 @@
|
|
|
v-if="schema.valueType === 'time'"
|
|
|
v-model="value"
|
|
|
style="width: 100%"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
|
|
|
<!-- 分组 -->
|
|
|
<el-collapse
|
|
|
v-if="!isFormItem && !schema?.render && !isStyle && schema.field !== 'part'"
|
|
|
- :model-value="schema.componentProps?.defaultCollapsed ? [] : [key]"
|
|
|
+ :model-value="componentProps?.defaultCollapsed ? [] : [key]"
|
|
|
>
|
|
|
<el-collapse-item :title="schema.label" :name="key" style="margin-bottom: 12px">
|
|
|
<el-card body-class="p-4px! pt-12px!" class="mb-8px!">
|
|
|
@@ -146,7 +146,7 @@
|
|
|
<!-- 平铺多选 -->
|
|
|
<CusCheckbox
|
|
|
v-if="schema.valueType === 'checkbox'"
|
|
|
- :options="schema?.componentProps?.options"
|
|
|
+ :options="componentProps?.options"
|
|
|
v-model="value"
|
|
|
/>
|
|
|
</el-row>
|
|
|
@@ -177,79 +177,79 @@
|
|
|
<StyleBackground
|
|
|
v-if="schema.valueType === 'background'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 边框 -->
|
|
|
<StyleBorder
|
|
|
v-if="schema.valueType === 'border'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 字体 -->
|
|
|
<StyleFont
|
|
|
v-if="schema.valueType === 'font'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 外边距 -->
|
|
|
<StyleMargin
|
|
|
v-if="schema.valueType === 'margin'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 内边距 -->
|
|
|
<StylePadding
|
|
|
v-if="schema.valueType === 'padding'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 阴影 -->
|
|
|
<StyleShadow
|
|
|
v-if="schema.valueType === 'shadow'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 间距 -->
|
|
|
<StyleSpace
|
|
|
v-if="schema.valueType === 'spacer'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 线段 -->
|
|
|
<StyleLine
|
|
|
v-if="schema.valueType === 'line'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 外边框 -->
|
|
|
<StyleOutline
|
|
|
v-if="schema.valueType === 'outline'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 图像样式 -->
|
|
|
<StyleImage
|
|
|
v-if="schema.valueType === 'imageStyle'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 变换样式 -->
|
|
|
<StyleTransform
|
|
|
v-if="schema.valueType === 'transform'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 动画样式 -->
|
|
|
<StyleAnimation
|
|
|
v-if="schema.valueType === 'animation'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
<!-- 其他 -->
|
|
|
<StyleOther
|
|
|
v-if="schema.valueType === 'other'"
|
|
|
v-model="value"
|
|
|
- v-bind="schema?.componentProps"
|
|
|
+ v-bind="componentProps"
|
|
|
/>
|
|
|
</template>
|
|
|
</el-card>
|
|
|
@@ -314,6 +314,10 @@ const props = defineProps<{
|
|
|
widgetData?: Record<string, any>
|
|
|
}>()
|
|
|
const key = v4()
|
|
|
+const componentProps = computed(() => {
|
|
|
+ const { onValueChange: _onValueChange, ...rest } = props.schema?.componentProps || {}
|
|
|
+ return rest
|
|
|
+})
|
|
|
|
|
|
// 绑定数据
|
|
|
const value = computed({
|