Skip to content

Commit

Permalink
releases 4.3.23
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Dec 9, 2024
1 parent c52d0ef commit 57b0ec1
Show file tree
Hide file tree
Showing 20 changed files with 62 additions and 31 deletions.
6 changes: 5 additions & 1 deletion examples/views/number-input/NumberInputTest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<p>
<vxe-number-input v-model="demo1.value700" readonly></vxe-number-input>
</p>
<p>
<vxe-number-input v-model="demo1.value800" type="amount"></vxe-number-input>
</p>
</div>
</template>

Expand All @@ -70,7 +73,8 @@ const demo1 = reactive({
value601: null,
value602: null,
value603: null,
value700: 1234
value700: 1234,
value800: null
})
</script>

Expand Down
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.3.22",
"version": "4.3.23",
"description": "A vue based PC component library",
"scripts": {
"update": "npm install --legacy-peer-deps",
Expand Down
2 changes: 1 addition & 1 deletion packages/language/ar-EG.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '导入失败,请检查字段名和数据格式是否正确',
treeNotImp: '树表格不支持导入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/de-DE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '导入失败,请检查字段名和数据格式是否正确',
treeNotImp: '树表格不支持导入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
4 changes: 2 additions & 2 deletions packages/language/es-ES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export default {
notExp: 'El navegador no es compatible con la importación / exportación.',
impFields: 'Error de importación, por favor revise que el nombre del campo y el formato de datos sean correctos.',
treeNotImp: 'La tabla de árbol no soporta importación.',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeCrossDrag: 'Only the first level of data can be dragged',
treeDragChild: 'Parent data cannot be dragged into its own child',
reqPlugin: 'Optional extension "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/fr-FR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '导入失败,请检查字段名和数据格式是否正确',
treeNotImp: '树表格不支持导入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/hu-HU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: 'Az importálás nem sikerült, ellenőrizze, hogy a mezőnév és az adatformátum helyes-e',
treeNotImp: 'A fatáblák nem támogatják az importálást',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/hy-AM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '导入失败,请检查字段名和数据格式是否正确',
treeNotImp: '树表格不支持导入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/ja-JP.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: 'インポートに失敗しました。フィールド名とデータ形式を確認してください',
treeNotImp: 'ツリーテーブルはインポートをサポートしていません',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/ko-KR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '导入失败,请检查字段名和数据格式是否正确',
treeNotImp: '树表格不支持导入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/nb-NO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '导入失败,请检查字段名和数据格式是否正确',
treeNotImp: '树表格不支持导入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: 'Falha na importação, verifique se o nome do campo e o formato dos dados estão corretos.',
treeNotImp: 'A tabela de árvore não suporta importação.',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/ru-RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: 'Не удалось выполнить импорт. Проверьте правильность имени поля и формата данных.',
treeNotImp: 'Древовидные таблицы не поддерживают импорт.',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/ug-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: 'ئەكىرىشى مەغلۇپ بولدى،سۆز ھەم ئۇچۇر فورماتىنى تەكشۈرۈڭ',
treeNotImp: 'دەرەخ شەكىللىك جەدىۋەلنى ئەكىرىشنى قوللىمايدۇ',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/uk-UA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '导入失败,请检查字段名和数据格式是否正确',
treeNotImp: '树表格不支持导入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/vi-VN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '导入失败,请检查字段名和数据格式是否正确',
treeNotImp: '树表格不支持导入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/zh-CHT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '匯入失敗,請檢查欄位名稱和資料格式是否正確',
treeNotImp: '樹表格不支援導入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可選擴展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
2 changes: 1 addition & 1 deletion packages/language/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
impFields: '导入失败,请检查字段名和数据格式是否正确',
treeNotImp: '树表格不支持导入',
treeCrossDrag: '只能拖拽第一层级的数据',
treeDragChild: '父级数据不能拖拽到子级中',
treeDragChild: '父级数据不能拖拽到自己的子级中',
reqPlugin: '可选扩展插件 "{1}" https://vxeui.com/other{0}/#/{1}/install'
},
table: {
Expand Down
48 changes: 37 additions & 11 deletions packages/number-input/src/number-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default defineComponent({
// float
digits: {
type: [String, Number] as PropType<VxeNumberInputPropTypes.Digits>,
default: () => getConfig().numberInput.digits
default: null
},

prefixIcon: String as PropType<VxeNumberInputPropTypes.PrefixIcon>,
Expand Down Expand Up @@ -110,6 +110,7 @@ export default defineComponent({
const { computeSize } = useSize(props)

const reactData = reactive<NumberInputReactData>({
isFocus: false,
isActivated: false,
inputValue: props.modelValue
})
Expand Down Expand Up @@ -161,16 +162,32 @@ export default defineComponent({
})

const computeDigitsValue = computed(() => {
return XEUtils.toInteger(props.digits) || 1
const { type, digits } = props
let defDigits: any = digits
if (defDigits === null) {
defDigits = getConfig().numberInput.digits
if (defDigits === null) {
if (type === 'amount') {
defDigits = 2
}
}
}
return XEUtils.toInteger(defDigits) || 1
})

const computeDecimalsType = computed(() => {
const { type } = props
return type === 'float' || type === 'amount'
})

const computeStepValue = computed(() => {
const { type } = props
const digitsValue = computeDigitsValue.value
const decimalsType = computeDecimalsType.value
const step = props.step
if (type === 'integer') {
return XEUtils.toInteger(step) || 1
} else if (type === 'float') {
} else if (decimalsType) {
return XEUtils.toNumber(step) || (1 / Math.pow(10, digitsValue))
}
return XEUtils.toNumber(step) || 1
Expand Down Expand Up @@ -205,8 +222,8 @@ export default defineComponent({
})

const computeInpImmediate = computed(() => {
const { type, immediate } = props
return immediate || !(type === 'number' || type === 'integer' || type === 'float')
const { immediate } = props
return immediate
})

const computeNumValue = computed(() => {
Expand All @@ -216,7 +233,12 @@ export default defineComponent({
})

const computeNumLabel = computed(() => {
const { type } = props
const { inputValue } = reactData
const digitsValue = computeDigitsValue.value
if (type === 'amount') {
return XEUtils.commafy(XEUtils.toNumber(inputValue), { digits: digitsValue })
}
return XEUtils.toString(inputValue)
})

Expand Down Expand Up @@ -250,10 +272,11 @@ export default defineComponent({
}

const getNumberValue = (val: any) => {
const { type, exponential } = props
const { exponential } = props
const inpMaxLength = computeInpMaxLength.value
const digitsValue = computeDigitsValue.value
const restVal = (type === 'float' ? toFloatValueFixed(val, digitsValue) : handleNumberString(val))
const decimalsType = computeDecimalsType.value
const restVal = (decimalsType ? toFloatValueFixed(val, digitsValue) : handleNumberString(val))
if (exponential && (val === restVal || handleNumberString(val).toLowerCase() === XEUtils.toNumber(restVal).toExponential())) {
return val
}
Expand Down Expand Up @@ -311,6 +334,7 @@ export default defineComponent({
}

const focusEvent = (evnt: Event & { type: 'focus' }) => {
reactData.isFocus = true
reactData.isActivated = true
triggerEvent(evnt)
}
Expand Down Expand Up @@ -341,10 +365,10 @@ export default defineComponent({
* 检查初始值
*/
const initValue = () => {
const { type } = props
const { inputValue } = reactData
const digitsValue = computeDigitsValue.value
if (type === 'float') {
const decimalsType = computeDecimalsType.value
if (decimalsType) {
if (inputValue) {
let textValue = ''
let validValue: number | null = null
Expand Down Expand Up @@ -409,6 +433,7 @@ export default defineComponent({
handleChange(value, handleNumberString(inputValue), evnt)
}
afterCheckValue()
reactData.isFocus = false
reactData.isActivated = false
numberInputMethods.dispatchEvent('blur', { value }, evnt)
// 自动更新校验状态
Expand Down Expand Up @@ -738,7 +763,7 @@ export default defineComponent({

const renderVN = () => {
const { className, controls, type, align, name, autocomplete, autoComplete } = props
const { inputValue, isActivated } = reactData
const { inputValue, isFocus, isActivated } = reactData
const vSize = computeSize.value
const isDisabled = computeIsDisabled.value
const formReadonly = computeFormReadonly.value
Expand Down Expand Up @@ -776,7 +801,7 @@ export default defineComponent({
h('input', {
ref: refInputTarget,
class: 'vxe-number-input--inner',
value: inputValue,
value: !isFocus && type === 'amount' ? numLabel : inputValue,
name,
type: 'text',
placeholder: inpPlaceholder,
Expand Down Expand Up @@ -819,6 +844,7 @@ export default defineComponent({
})

onBeforeUnmount(() => {
reactData.isFocus = false
numberStopDown()
afterCheckValue()
globalEvents.off($xeNumberInput, 'mousedown')
Expand Down
3 changes: 2 additions & 1 deletion types/components/number-input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export namespace VxeNumberInputPropTypes {
export type ClassName = string
export type Immediate = boolean
export type Name = string
export type Type = 'number' | 'integer' | 'float'
export type Type = 'number' | 'integer' | 'float' | 'amount'
export type Clearable = boolean
export type Readonly = boolean
export type Disabled = boolean
Expand Down Expand Up @@ -108,6 +108,7 @@ export interface NumberInputPrivateComputed {
export interface VxeNumberInputPrivateComputed extends NumberInputPrivateComputed { }

export interface NumberInputReactData {
isFocus: boolean
isActivated: boolean
inputValue: VxeNumberInputPropTypes.ModelValue | undefined
}
Expand Down

0 comments on commit 57b0ec1

Please sign in to comment.