easybill-ui 1.2.23 → 1.2.25
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.
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
:class="getFormItemStyle(formItem)"
|
|
11
11
|
v-bind="getFormItemProps(formItem)"
|
|
12
12
|
>
|
|
13
|
-
<template v-for="(item, key) in formItem
|
|
13
|
+
<template v-for="(item, key) in getFormItemProps(formItem)?.slots || {}" :key="key" #[key]="row">
|
|
14
14
|
<component :is="item" v-bind="row" />
|
|
15
15
|
</template>
|
|
16
16
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<component :is="componentName" v-bind="containerProps">
|
|
3
3
|
<el-steps v-if="stepSchemaList.length > 1" :active="step" align-center style="margin-bottom: 20px; position: sticky; top: 0; z-index: 2000; background: var(--el-bg-color)" v-bind="stepProps">
|
|
4
4
|
<el-step v-for="(item, i) in stepSchemaList" :key="i" :title="item.name" :description="item.description" />
|
|
5
5
|
</el-steps>
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
<el-button v-if="step >= stepSchemaList.length - 1" :disabled="confirmLoading" type="primary" :loading="confirmLoading" @click="onOk">{{ confirmBtnTextLabel }}</el-button>
|
|
17
17
|
</span>
|
|
18
18
|
</template>
|
|
19
|
-
</
|
|
19
|
+
</component>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script lang="ts">
|
|
23
23
|
import { useLocale } from "easybill-ui"
|
|
24
|
-
import { computed, defineComponent, type PropType, provide, reactive, ref, type Ref, shallowRef, toRefs } from "vue"
|
|
24
|
+
import { computed, defineComponent, type PropType, provide, reactive, ref, type Ref, shallowRef, toRefs, useAttrs } from "vue"
|
|
25
25
|
import { type Fields, type FormSchema } from "../../CurdForm"
|
|
26
26
|
export default defineComponent({
|
|
27
27
|
name: "FormDialog",
|
|
@@ -79,8 +79,14 @@ export default defineComponent({
|
|
|
79
79
|
type: String,
|
|
80
80
|
default: "",
|
|
81
81
|
},
|
|
82
|
+
mode: {
|
|
83
|
+
// 容器组件类型: 'dialog' | 'drawer'
|
|
84
|
+
type: String as PropType<"dialog" | "drawer">,
|
|
85
|
+
default: "dialog",
|
|
86
|
+
},
|
|
82
87
|
},
|
|
83
88
|
setup(props) {
|
|
89
|
+
const attrs = useAttrs()
|
|
84
90
|
const curdFormRef = ref()
|
|
85
91
|
const form = ref<Fields>({})
|
|
86
92
|
const state = reactive({
|
|
@@ -156,6 +162,27 @@ export default defineComponent({
|
|
|
156
162
|
}
|
|
157
163
|
const confirmBtnTextLabel = computed(() => props.confirmBtnText || t("el.formDialog.confirm"))
|
|
158
164
|
const cancelBtnTextLabel = computed(() => props.cancelBtnText || t("el.formDialog.cancel"))
|
|
165
|
+
const componentName = computed(() => (props.mode === "drawer" ? "el-drawer" : "el-dialog"))
|
|
166
|
+
const containerProps = computed(() => {
|
|
167
|
+
const baseProps = {
|
|
168
|
+
modelValue: state.visible,
|
|
169
|
+
title: props.title,
|
|
170
|
+
"close-on-click-modal": false,
|
|
171
|
+
"before-close": onBeforeClose,
|
|
172
|
+
...attrs,
|
|
173
|
+
}
|
|
174
|
+
if (props.mode === "drawer") {
|
|
175
|
+
return {
|
|
176
|
+
...baseProps,
|
|
177
|
+
size: attrs.size || attrs.width || "60%",
|
|
178
|
+
direction: attrs.direction || "rtl",
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
...baseProps,
|
|
183
|
+
width: attrs.width || "60%",
|
|
184
|
+
}
|
|
185
|
+
})
|
|
159
186
|
const formDialogContext = reactive({
|
|
160
187
|
form,
|
|
161
188
|
state,
|
|
@@ -180,6 +207,8 @@ export default defineComponent({
|
|
|
180
207
|
extendContexts,
|
|
181
208
|
confirmBtnTextLabel,
|
|
182
209
|
cancelBtnTextLabel,
|
|
210
|
+
componentName,
|
|
211
|
+
containerProps,
|
|
183
212
|
}
|
|
184
213
|
},
|
|
185
214
|
})
|