Skip to content

Commit

Permalink
releases 4.0.25
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Jun 20, 2024
1 parent d9c5fb2 commit 6d5245a
Show file tree
Hide file tree
Showing 10 changed files with 178 additions and 46 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.24",
"version": "4.0.25",
"description": "A vue based PC component library",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down
32 changes: 26 additions & 6 deletions packages/button/src/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getAbsolutePos, getEventTargetNode } from '../../ui/src/dom'
import { getFuncText, getLastZIndex, nextZIndex } from '../../ui/src/utils'
import { warnLog } from '../../ui/src/log'

import type { VxeButtonConstructor, VxeButtonPropTypes, VxeButtonEmits, ButtonReactData, ButtonMethods, ButtonPrivateRef, ButtonInternalData, VxeButtonGroupConstructor, VxeButtonGroupPrivateMethods } from '../../../types'
import type { VxeButtonConstructor, VxeButtonPropTypes, VxeButtonEmits, ButtonReactData, ButtonMethods, ButtonPrivateRef, ButtonInternalData, VxeButtonGroupConstructor, VxeButtonGroupPrivateMethods, VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'

export default defineComponent({
name: 'VxeButton',
Expand Down Expand Up @@ -68,7 +68,10 @@ export default defineComponent({
/**
* 是否将弹框容器插入于 body 内
*/
transfer: { type: Boolean as PropType<VxeButtonPropTypes.Transfer>, default: () => getConfig().button.transfer }
transfer: {
type: Boolean as PropType<VxeButtonPropTypes.Transfer>,
default: null
}
},
emits: [
'click',
Expand All @@ -79,6 +82,9 @@ export default defineComponent({
setup (props, context) {
const { slots, emit } = context

const $xeTable = inject<VxeTableConstructor & VxeTablePrivateMethods | null>('$xeTable', null)
const $xeButtonGroup = inject<(VxeButtonGroupConstructor & VxeButtonGroupPrivateMethods) | null>('$xeButtonGroup', null)

const xID = XEUtils.uniqueId()

const { computeSize } = useSize(props)
Expand Down Expand Up @@ -113,10 +119,22 @@ export default defineComponent({
getRefMaps: () => refMaps
} as unknown as VxeButtonConstructor

const $xeButtonGroup = inject<(VxeButtonGroupConstructor & VxeButtonGroupPrivateMethods) | null>('$xeButtonGroup', null)

let buttonMethods = {} as ButtonMethods

const compTransfer = computed(() => {
const { transfer } = props
if (transfer === null) {
const globalTransfer = getConfig().button.transfer
if (XEUtils.isBoolean(globalTransfer)) {
return globalTransfer
}
if ($xeTable) {
return true
}
}
return transfer
})

const computeIsFormBtn = computed(() => {
const { type } = props
if (type) {
Expand Down Expand Up @@ -174,10 +192,11 @@ export default defineComponent({

const updatePlacement = () => {
return nextTick().then(() => {
const { transfer, placement } = props
const { placement } = props
const { panelIndex } = reactData
const targetElem = refButton.value
const panelElem = refBtnPanel.value
const transfer = compTransfer.value
if (panelElem && targetElem) {
const targetHeight = targetElem.offsetHeight
const targetWidth = targetElem.offsetWidth
Expand Down Expand Up @@ -428,13 +447,14 @@ export default defineComponent({
})

const renderVN = () => {
const { className, popupClassName, transfer, title, type, destroyOnClose, name, disabled, loading } = props
const { className, popupClassName, title, type, destroyOnClose, name, disabled, loading } = props
const { inited, showPanel } = reactData
const isFormBtn = computeIsFormBtn.value
const btnMode = computeBtnMode.value
const btnStatus = computeBtnStatus.value
const btnRound = computeBtnRound.value
const btnCircle = computeBtnCircle.value
const transfer = compTransfer.value
const vSize = computeSize.value
if (slots.dropdowns) {
return h('div', {
Expand Down
51 changes: 36 additions & 15 deletions packages/date-picker/src/date-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getFuncText, getLastZIndex, nextZIndex } from '../../ui/src/utils'
import { getAbsolutePos, getEventTargetNode } from '../../ui/src/dom'
import { getSlotVNs } from '../..//ui/src/vn'

import type { VxeDatePickerConstructor, VxeDatePickerEmits, DatePickerReactData, DatePickerMethods, VxeDatePickerPropTypes, DatePickerPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types'
import type { VxeDatePickerConstructor, VxeDatePickerEmits, DatePickerReactData, DatePickerMethods, VxeDatePickerPropTypes, DatePickerPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'

interface DateYearItem {
date: Date;
Expand Down Expand Up @@ -99,42 +99,45 @@ export default defineComponent({
immediate: { type: Boolean as PropType<VxeDatePickerPropTypes.Immediate>, default: true },
name: String as PropType<VxeDatePickerPropTypes.Name>,
type: { type: String as PropType<VxeDatePickerPropTypes.Type>, default: 'text' },
clearable: { type: Boolean as PropType<VxeDatePickerPropTypes.Clearable>, default: () => getConfig().input.clearable },
clearable: { type: Boolean as PropType<VxeDatePickerPropTypes.Clearable>, default: () => getConfig().datePicker.clearable },
readonly: Boolean as PropType<VxeDatePickerPropTypes.Readonly>,
disabled: Boolean as PropType<VxeDatePickerPropTypes.Disabled>,
placeholder: {
type: String as PropType<VxeDatePickerPropTypes.Placeholder>,
default: () => XEUtils.eqNull(getConfig().input.placeholder) ? getI18n('vxe.base.pleaseSelect') : getConfig().input.placeholder
default: () => XEUtils.eqNull(getConfig().datePicker.placeholder) ? getI18n('vxe.base.pleaseSelect') : getConfig().datePicker.placeholder
},
maxlength: [String, Number] as PropType<VxeDatePickerPropTypes.Maxlength>,
autocomplete: { type: String as PropType<VxeDatePickerPropTypes.Autocomplete>, default: 'off' },
align: String as PropType<VxeDatePickerPropTypes.Align>,
form: String as PropType<VxeDatePickerPropTypes.Form>,
className: String as PropType<VxeDatePickerPropTypes.ClassName>,
size: { type: String as PropType<VxeDatePickerPropTypes.Size>, default: () => getConfig().input.size || getConfig().size },
size: { type: String as PropType<VxeDatePickerPropTypes.Size>, default: () => getConfig().datePicker.size || getConfig().size },
multiple: Boolean as PropType<VxeDatePickerPropTypes.Multiple>,

// date、week、month、quarter、year
startDate: { type: [String, Number, Date] as PropType<VxeDatePickerPropTypes.MinDate>, default: () => getConfig().input.startDate },
endDate: { type: [String, Number, Date] as PropType<VxeDatePickerPropTypes.MaxDate>, default: () => getConfig().input.endDate },
startDate: { type: [String, Number, Date] as PropType<VxeDatePickerPropTypes.MinDate>, default: () => getConfig().datePicker.startDate },
endDate: { type: [String, Number, Date] as PropType<VxeDatePickerPropTypes.MaxDate>, default: () => getConfig().datePicker.endDate },
minDate: [String, Number, Date] as PropType<VxeDatePickerPropTypes.MinDate>,
maxDate: [String, Number, Date] as PropType<VxeDatePickerPropTypes.MaxDate>,
// 已废弃 startWeek,被 startDay 替换
startWeek: Number as PropType<VxeDatePickerPropTypes.StartDay>,
startDay: { type: [String, Number] as PropType<VxeDatePickerPropTypes.StartDay>, default: () => getConfig().input.startDay },
labelFormat: { type: String as PropType<VxeDatePickerPropTypes.LabelFormat>, default: () => getConfig().input.labelFormat },
valueFormat: { type: String as PropType<VxeDatePickerPropTypes.ValueFormat>, default: () => getConfig().input.valueFormat },
startDay: { type: [String, Number] as PropType<VxeDatePickerPropTypes.StartDay>, default: () => getConfig().datePicker.startDay },
labelFormat: { type: String as PropType<VxeDatePickerPropTypes.LabelFormat>, default: () => getConfig().datePicker.labelFormat },
valueFormat: { type: String as PropType<VxeDatePickerPropTypes.ValueFormat>, default: () => getConfig().datePicker.valueFormat },
editable: { type: Boolean as PropType<VxeDatePickerPropTypes.Editable>, default: true },
festivalMethod: { type: Function as PropType<VxeDatePickerPropTypes.FestivalMethod>, default: () => getConfig().input.festivalMethod },
disabledMethod: { type: Function as PropType<VxeDatePickerPropTypes.DisabledMethod>, default: () => getConfig().input.disabledMethod },
festivalMethod: { type: Function as PropType<VxeDatePickerPropTypes.FestivalMethod>, default: () => getConfig().datePicker.festivalMethod },
disabledMethod: { type: Function as PropType<VxeDatePickerPropTypes.DisabledMethod>, default: () => getConfig().datePicker.disabledMethod },

// week
selectDay: { type: [String, Number] as PropType<VxeDatePickerPropTypes.SelectDay>, default: () => getConfig().input.selectDay },
selectDay: { type: [String, Number] as PropType<VxeDatePickerPropTypes.SelectDay>, default: () => getConfig().datePicker.selectDay },

prefixIcon: String as PropType<VxeDatePickerPropTypes.PrefixIcon>,
suffixIcon: String as PropType<VxeDatePickerPropTypes.SuffixIcon>,
placement: String as PropType<VxeDatePickerPropTypes.Placement>,
transfer: { type: Boolean as PropType<VxeDatePickerPropTypes.Transfer>, default: () => getConfig().input.transfer }
transfer: {
type: Boolean as PropType<VxeDatePickerPropTypes.Transfer>,
default: null
}
},
emits: [
'update:modelValue',
Expand All @@ -155,6 +158,8 @@ export default defineComponent({
] as VxeDatePickerEmits,
setup (props, context) {
const { slots, emit } = context

const $xeTable = inject<VxeTableConstructor & VxeTablePrivateMethods | null>('$xeTable', null)
const $xeForm = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeForm', null)
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)

Expand Down Expand Up @@ -208,6 +213,20 @@ export default defineComponent({
return XEUtils.toStringDate(value, format)
}

const compTransfer = computed(() => {
const { transfer } = props
if (transfer === null) {
const globalTransfer = getConfig().datePicker.transfer
if (XEUtils.isBoolean(globalTransfer)) {
return globalTransfer
}
if ($xeTable) {
return true
}
}
return transfer
})

const computeIsDateTimeType = computed(() => {
const { type } = props
return type === 'time' || type === 'datetime'
Expand Down Expand Up @@ -1239,10 +1258,11 @@ export default defineComponent({

const updatePlacement = () => {
return nextTick().then(() => {
const { transfer, placement } = props
const { placement } = props
const { panelIndex } = reactData
const targetElem = refInputTarget.value
const panelElem = refDatePickerPanel.value
const transfer = compTransfer.value
if (targetElem && panelElem) {
const targetHeight = targetElem.offsetHeight
const targetWidth = targetElem.offsetWidth
Expand Down Expand Up @@ -1841,10 +1861,11 @@ export default defineComponent({
}

const renderPanel = () => {
const { type, transfer } = props
const { type } = props
const { inited, animatVisible, visiblePanel, panelPlacement, panelStyle } = reactData
const vSize = computeSize.value
const isDatePickerType = computeIsDatePickerType.value
const transfer = compTransfer.value
const renders = []
if (isDatePickerType) {
if (type === 'datetime') {
Expand Down
29 changes: 25 additions & 4 deletions packages/input/src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { toStringTimeDate, getDateQuarter } from './date'
import { handleNumber, toFloatValueFixed } from './number'
import { getSlotVNs } from '../..//ui/src/vn'

import type { VxeInputConstructor, VxeInputEmits, InputReactData, InputMethods, VxeInputPropTypes, InputPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines } from '../../../types'
import type { VxeInputConstructor, VxeInputEmits, InputReactData, InputMethods, VxeInputPropTypes, InputPrivateRef, VxeFormConstructor, VxeFormPrivateMethods, VxeFormDefines, VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'

interface DateYearItem {
date: Date;
Expand Down Expand Up @@ -113,7 +113,10 @@ export default defineComponent({
prefixIcon: String as PropType<VxeInputPropTypes.PrefixIcon>,
suffixIcon: String as PropType<VxeInputPropTypes.SuffixIcon>,
placement: String as PropType<VxeInputPropTypes.Placement>,
transfer: { type: Boolean as PropType<VxeInputPropTypes.Transfer>, default: () => getConfig().input.transfer }
transfer: {
type: Boolean as PropType<VxeInputPropTypes.Transfer>,
default: null
}
},
emits: [
'update:modelValue',
Expand All @@ -138,6 +141,8 @@ export default defineComponent({
] as VxeInputEmits,
setup (props, context) {
const { slots, emit } = context

const $xeTable = inject<VxeTableConstructor & VxeTablePrivateMethods | null>('$xeTable', null)
const $xeForm = inject<VxeFormConstructor & VxeFormPrivateMethods | null>('$xeForm', null)
const formItemInfo = inject<VxeFormDefines.ProvideItemInfo | null>('xeFormItemInfo', null)

Expand Down Expand Up @@ -191,6 +196,20 @@ export default defineComponent({
return XEUtils.toStringDate(value, format)
}

const compTransfer = computed(() => {
const { transfer } = props
if (transfer === null) {
const globalTransfer = getConfig().input.transfer
if (XEUtils.isBoolean(globalTransfer)) {
return globalTransfer
}
if ($xeTable) {
return true
}
}
return transfer
})

const computeIsDateTimeType = computed(() => {
const { type } = props
return type === 'time' || type === 'datetime'
Expand Down Expand Up @@ -1501,10 +1520,11 @@ export default defineComponent({

const updatePlacement = () => {
return nextTick().then(() => {
const { transfer, placement } = props
const { placement } = props
const { panelIndex } = reactData
const targetElem = refInputTarget.value
const panelElem = refInputPanel.value
const transfer = compTransfer.value
if (targetElem && panelElem) {
const targetHeight = targetElem.offsetHeight
const targetWidth = targetElem.offsetWidth
Expand Down Expand Up @@ -2103,9 +2123,10 @@ export default defineComponent({
}

const renderPanel = () => {
const { type, transfer } = props
const { type } = props
const { inited, animatVisible, visiblePanel, panelPlacement, panelStyle } = reactData
const vSize = computeSize.value
const transfer = compTransfer.value
const isDatePickerType = computeIsDatePickerType.value
const renders = []
if (isDatePickerType) {
Expand Down
12 changes: 6 additions & 6 deletions packages/number-input/src/number-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,32 @@ export default defineComponent({
immediate: { type: Boolean as PropType<VxeNumberInputPropTypes.Immediate>, default: true },
name: String as PropType<VxeNumberInputPropTypes.Name>,
type: { type: String as PropType<VxeNumberInputPropTypes.Type>, default: 'number' },
clearable: { type: Boolean as PropType<VxeNumberInputPropTypes.Clearable>, default: () => getConfig().input.clearable },
clearable: { type: Boolean as PropType<VxeNumberInputPropTypes.Clearable>, default: () => getConfig().numberInput.clearable },
readonly: Boolean as PropType<VxeNumberInputPropTypes.Readonly>,
disabled: Boolean as PropType<VxeNumberInputPropTypes.Disabled>,
placeholder: {
type: String as PropType<VxeNumberInputPropTypes.Placeholder>,
default: () => XEUtils.eqNull(getConfig().input.placeholder) ? getI18n('vxe.base.pleaseInput') : getConfig().input.placeholder
default: () => XEUtils.eqNull(getConfig().numberInput.placeholder) ? getI18n('vxe.base.pleaseInput') : getConfig().numberInput.placeholder
},
maxlength: [String, Number] as PropType<VxeNumberInputPropTypes.Maxlength>,
autocomplete: { type: String as PropType<VxeNumberInputPropTypes.Autocomplete>, default: 'off' },
align: String as PropType<VxeNumberInputPropTypes.Align>,
form: String as PropType<VxeNumberInputPropTypes.Form>,
className: String as PropType<VxeNumberInputPropTypes.ClassName>,
size: { type: String as PropType<VxeNumberInputPropTypes.Size>, default: () => getConfig().input.size || getConfig().size },
size: { type: String as PropType<VxeNumberInputPropTypes.Size>, default: () => getConfig().numberInput.size || getConfig().size },
multiple: Boolean as PropType<VxeNumberInputPropTypes.Multiple>,

// number、integer、float
min: { type: [String, Number] as PropType<VxeNumberInputPropTypes.Min>, default: null },
max: { type: [String, Number] as PropType<VxeNumberInputPropTypes.Max>, default: null },
step: [String, Number] as PropType<VxeNumberInputPropTypes.Step>,
exponential: { type: Boolean as PropType<VxeNumberInputPropTypes.Exponential>, default: () => getConfig().input.exponential },
exponential: { type: Boolean as PropType<VxeNumberInputPropTypes.Exponential>, default: () => getConfig().numberInput.exponential },

// number、integer、float
controls: { type: Boolean as PropType<VxeNumberInputPropTypes.Controls>, default: () => getConfig().input.controls },
controls: { type: Boolean as PropType<VxeNumberInputPropTypes.Controls>, default: () => getConfig().numberInput.controls },

// float
digits: { type: [String, Number] as PropType<VxeNumberInputPropTypes.Digits>, default: () => getConfig().input.digits },
digits: { type: [String, Number] as PropType<VxeNumberInputPropTypes.Digits>, default: () => getConfig().numberInput.digits },

prefixIcon: String as PropType<VxeNumberInputPropTypes.PrefixIcon>,
suffixIcon: String as PropType<VxeNumberInputPropTypes.SuffixIcon>
Expand Down
6 changes: 3 additions & 3 deletions packages/password-input/src/password-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ export default defineComponent({
props: {
modelValue: String as PropType<VxePasswordInputPropTypes.ModelValue>,
name: String as PropType<VxePasswordInputPropTypes.Name>,
clearable: { type: Boolean as PropType<VxePasswordInputPropTypes.Clearable>, default: () => getConfig().input.clearable },
clearable: { type: Boolean as PropType<VxePasswordInputPropTypes.Clearable>, default: () => getConfig().passwordInput.clearable },
readonly: Boolean as PropType<VxePasswordInputPropTypes.Readonly>,
disabled: Boolean as PropType<VxePasswordInputPropTypes.Disabled>,
placeholder: {
type: String as PropType<VxePasswordInputPropTypes.Placeholder>,
default: () => XEUtils.eqNull(getConfig().input.placeholder) ? getI18n('vxe.base.pleaseInput') : getConfig().input.placeholder
default: () => XEUtils.eqNull(getConfig().passwordInput.placeholder) ? getI18n('vxe.base.pleaseInput') : getConfig().passwordInput.placeholder
},
autocomplete: { type: String as PropType<VxePasswordInputPropTypes.Autocomplete>, default: 'off' },
className: String as PropType<VxePasswordInputPropTypes.ClassName>,
size: { type: String as PropType<VxePasswordInputPropTypes.Size>, default: () => getConfig().input.size || getConfig().size },
size: { type: String as PropType<VxePasswordInputPropTypes.Size>, default: () => getConfig().passwordInput.size || getConfig().size },
prefixIcon: String as PropType<VxePasswordInputPropTypes.PrefixIcon>,
suffixIcon: String as PropType<VxePasswordInputPropTypes.SuffixIcon>
},
Expand Down
Loading

0 comments on commit 6d5245a

Please sign in to comment.