|
@@ -22,6 +22,8 @@ withDefaults(
|
|
|
)
|
|
|
const emits = defineEmits(['submit'])
|
|
|
const form = ref<InstanceType<typeof WdForm>>()
|
|
|
+const action = ref(`${import.meta.env.VITE_SERVER_BASEURL}/app-api/infra/file/upload`)
|
|
|
+
|
|
|
const types = {
|
|
|
TextField: WdInput,
|
|
|
Submit: WdButton,
|
|
@@ -54,12 +56,14 @@ const verticalDefaultProps = {
|
|
|
}
|
|
|
const horizontalDefaultProps = {
|
|
|
TextField: {
|
|
|
- customClass: 'text-red! bg-[#f5f7f9]! h-10',
|
|
|
+ customClass: 'text-red! bg-[#f5f7f9]! py-2 px-4 rounded-lg',
|
|
|
placeholderClass: 'text-black/30',
|
|
|
noBorder: true,
|
|
|
},
|
|
|
Select: {
|
|
|
- customClass: 'text-black/30! border-b-1 border-b-[#e1e1e1] border-b-solid',
|
|
|
+ customClass: 'text-black/30! bg-[#f5f7f9]! py-.75 px-4 rounded-lg!',
|
|
|
+ noBorder: true,
|
|
|
+ cell: false,
|
|
|
},
|
|
|
Radio: {
|
|
|
customClass: 'my--4!',
|
|
@@ -68,7 +72,7 @@ const horizontalDefaultProps = {
|
|
|
customClass: 'my--4!',
|
|
|
},
|
|
|
TimePick: {
|
|
|
- customClass: 'm-0!',
|
|
|
+ customClass: 'm-0! bg-[#f5f7f9]! py-.75 px-4 rounded-lg!',
|
|
|
},
|
|
|
}
|
|
|
const themeVars: ConfigProviderThemeVars = {
|
|
@@ -112,12 +116,16 @@ defineExpose({
|
|
|
<label
|
|
|
v-if="type !== 'Submit' && !hiddenLabel"
|
|
|
class="text-sm font-normal leading-relaxed"
|
|
|
- :class="[direction === 'horizontal' ? 'text-black/60' : 'mb-1 text-black/40']"
|
|
|
+ :class="[
|
|
|
+ direction === 'horizontal'
|
|
|
+ ? 'text-black/60 h-10 flex items-center'
|
|
|
+ : 'mb-1 text-black/40',
|
|
|
+ ]"
|
|
|
:for="prop"
|
|
|
>
|
|
|
<span
|
|
|
- v-if="required"
|
|
|
class="text-[#ef4343] text-base font-normal font-['PingFang_SC'] leading-normal"
|
|
|
+ :class="required ? 'visible' : 'invisible'"
|
|
|
>
|
|
|
*
|
|
|
</span>
|
|
@@ -200,6 +208,26 @@ defineExpose({
|
|
|
<wd-checkbox custom-class="mr-4!" :modelValue="value">{{ label }}</wd-checkbox>
|
|
|
</template>
|
|
|
</wd-checkbox-group>
|
|
|
+ <wd-upload
|
|
|
+ v-if="type === 'ImageUploader'"
|
|
|
+ v-bind="{
|
|
|
+ ...(direction === 'vertical'
|
|
|
+ ? verticalDefaultProps[type]
|
|
|
+ : horizontalDefaultProps[type]),
|
|
|
+ ...props,
|
|
|
+ action,
|
|
|
+ fileList:
|
|
|
+ (modelValue[prop] ?? '') === ''
|
|
|
+ ? []
|
|
|
+ : modelValue[prop]?.split(',').map((it) => ({ url: it })),
|
|
|
+ }"
|
|
|
+ @change="
|
|
|
+ ({ fileList }) =>
|
|
|
+ (modelValue[prop] = fileList
|
|
|
+ .map(({ response }) => JSON.parse(response).data)
|
|
|
+ .join(','))
|
|
|
+ "
|
|
|
+ ></wd-upload>
|
|
|
<wd-button
|
|
|
v-if="type === 'Submit'"
|
|
|
v-bind="{
|