Skip to content

Commit

Permalink
releases 4.0.36
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Jun 26, 2024
1 parent 5fbe5a4 commit c44e95d
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vxe-pc-ui",
"version": "4.0.35",
"version": "4.0.36",
"description": "A vue based PC component library",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down
8 changes: 8 additions & 0 deletions packages/form-design/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { App } from 'vue'
import { VxeUI } from '@vxe-ui/core'
import VxeFormDesignComponent from './src/form-design'
import { useWidgetView } from './src/use'
import { dynamicApp } from '../dynamics'
import './render'

import { FormDesignExport } from '../../types'

export const VxeFormDesign = Object.assign({}, VxeFormDesignComponent, {
install (app: App) {
app.component(VxeFormDesignComponent.name as string, VxeFormDesignComponent)
}
})

const formDesign: FormDesignExport = {
useWidgetView
}

dynamicApp.component(VxeFormDesignComponent.name as string, VxeFormDesignComponent)
VxeUI.component(VxeFormDesignComponent)
VxeUI.formDesign = formDesign

export const FormDesign = VxeFormDesign
export default VxeFormDesign
33 changes: 33 additions & 0 deletions packages/form-design/src/use.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { computed } from 'vue'

import type { VxeFormDesignDefines } from '../../../types'

export function useWidgetView <T = any> (props: {
renderOpts: any
renderParams: any
}) {
const currWidget = computed<VxeFormDesignDefines.WidgetObjItem<T>>(() => {
const { renderParams } = props
return renderParams.widget
})

const widgetModel = computed({
get () {
const { renderParams } = props
const { $formView, widget } = renderParams
return $formView ? $formView.getItemValue(widget) : null
},
set (value) {
const { renderParams } = props
const { $formView, widget } = renderParams
if ($formView) {
$formView.setItemValue(widget, value)
}
}
})

return {
currWidget,
widgetModel
}
}
60 changes: 29 additions & 31 deletions packages/number-input/src/number-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,37 +583,35 @@ export default defineComponent({
const { inputValue } = reactData
const suffixSlot = slots.suffix
const isClearable = computeIsClearable.value
return isClearable || suffixSlot || suffixIcon
? h('div', {
class: ['vxe-number-input--suffix', {
'is--clear': isClearable && !disabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
}]
}, [
isClearable
? h('div', {
class: 'vxe-number-input--clear-icon',
onClick: clearValueEvent
}, [
h('i', {
class: getIcon().INPUT_CLEAR
})
])
: createCommentVNode(),
renderExtraSuffixIcon(),
suffixSlot || suffixIcon
? h('div', {
class: 'vxe-number-input--suffix-icon',
onClick: clickSuffixEvent
}, suffixSlot
? getSlotVNs(suffixSlot({}))
: [
h('i', {
class: suffixIcon
})
])
: createCommentVNode()
])
: null
return h('div', {
class: ['vxe-number-input--suffix', {
'is--clear': isClearable && !disabled && !(inputValue === '' || XEUtils.eqNull(inputValue))
}]
}, [
isClearable
? h('div', {
class: 'vxe-number-input--clear-icon',
onClick: clearValueEvent
}, [
h('i', {
class: getIcon().INPUT_CLEAR
})
])
: createCommentVNode(),
renderExtraSuffixIcon(),
suffixSlot || suffixIcon
? h('div', {
class: 'vxe-number-input--suffix-icon',
onClick: clickSuffixEvent
}, suffixSlot
? getSlotVNs(suffixSlot({}))
: [
h('i', {
class: suffixIcon
})
])
: createCommentVNode()
])
}

const renderExtraSuffixIcon = () => {
Expand Down
5 changes: 5 additions & 0 deletions packages/textarea/src/textarea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ export default defineComponent({
updateAutoTxt()
})

watch(computeSizeOpts, () => {
updateAutoTxt()
handleResize()
})

nextTick(() => {
const { autosize } = props
if (autosize) {
Expand Down
14 changes: 12 additions & 2 deletions types/components/form-design.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RenderFunction, SetupContext, Ref, ComponentPublicInstance, DefineComponent, UnwrapNestedRefs } from 'vue'
import { defineVxeComponent, VxeComponentBaseOptions, VxeComponentEventParams, VxeComponentSizeType, ValueOf } from '@vxe-ui/core'
import { RenderFunction, SetupContext, Ref, ComputedRef, WritableComputedRef, ComponentPublicInstance, DefineComponent, UnwrapNestedRefs } from 'vue'
import { defineVxeComponent, VxeComponentBaseOptions, VxeComponentEventParams, VxeComponentSizeType, ValueOf, VxeGlobalRendererHandles } from '@vxe-ui/core'
import { VxeFormPropTypes } from '../components/form'

/* eslint-disable no-use-before-define,@typescript-eslint/ban-types */
Expand Down Expand Up @@ -176,5 +176,15 @@ export namespace VxeFormDesignSlotTypes {}
export interface VxeFormDesignSlots {
}

export interface FormDesignExport {
useWidgetView<T = any>(props: {
renderOpts: any
renderParams: any
}): {
currWidget: ComputedRef<VxeFormDesignDefines.WidgetObjItem<T>>,
widgetModel: WritableComputedRef<any>
}
}

export const FormDesign: typeof VxeFormDesign
export default VxeFormDesign
4 changes: 4 additions & 0 deletions types/ui/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { DrawerController } from '../components/drawer'
import { VxePrintDefines } from '../components/print'
import { VxeUploadDefines } from '../components/upload'
import { VxeImageDefines } from '../components/image'
import { FormDesignExport } from '../components/form-design'

/**
* 已废弃,请使用 setConfig
Expand Down Expand Up @@ -48,6 +49,9 @@ declare module '@vxe-ui/core' {
modal: ModalController
drawer: DrawerController
dynamicApp: App<Element>

formDesign: FormDesignExport

print: VxePrintDefines.PrintFunction
saveFile: VxeUploadDefines.SaveFileFunction
readFile: VxeUploadDefines.ReadFileFunction
Expand Down

0 comments on commit c44e95d

Please sign in to comment.