update ts.d
This commit is contained in:
@@ -11,7 +11,7 @@ const apis = [
|
||||
name: 'modelValue',
|
||||
descKey: 'app.api.checkbox.desc.value',
|
||||
version: '',
|
||||
type: 'any',
|
||||
type: 'string | number | boolean',
|
||||
enum: '',
|
||||
defVal: '',
|
||||
list: []
|
||||
@@ -69,6 +69,24 @@ const apis = [
|
||||
enum: '',
|
||||
defVal: 'false',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
name: 'checked-value',
|
||||
desc: '选中时的值',
|
||||
version: '4.0.21',
|
||||
type: 'string | number | boolean',
|
||||
enum: '',
|
||||
defVal: 'true',
|
||||
list: []
|
||||
},
|
||||
{
|
||||
name: 'unchecked-value',
|
||||
desc: '未选中时的值',
|
||||
version: '4.0.21',
|
||||
type: 'string | number | boolean',
|
||||
enum: '',
|
||||
defVal: 'false',
|
||||
list: []
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<p>
|
||||
<vxe-checkbox v-model="demo1.value9" content="复选1"></vxe-checkbox>
|
||||
<vxe-checkbox v-model="demo1.value10" content="复选2" disabled></vxe-checkbox>
|
||||
<vxe-checkbox v-model="demo1.value11" content="复选3"></vxe-checkbox>
|
||||
<vxe-checkbox v-model="demo1.value11" content="自定义值" checked-value="1" unchecked-value="0"></vxe-checkbox>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -63,7 +63,7 @@ export default defineComponent({
|
||||
value8: false,
|
||||
value9: true,
|
||||
value10: true,
|
||||
value11: false,
|
||||
value11: '1',
|
||||
value12: ['3']
|
||||
})
|
||||
return {
|
||||
@@ -84,7 +84,7 @@ export default defineComponent({
|
||||
<p>
|
||||
<vxe-checkbox v-model="demo1.value9" content="复选1"></vxe-checkbox>
|
||||
<vxe-checkbox v-model="demo1.value10" content="复选2" disabled></vxe-checkbox>
|
||||
<vxe-checkbox v-model="demo1.value11" content="复选3"></vxe-checkbox>
|
||||
<vxe-checkbox v-model="demo1.value11" content="自定义值" checked-value="1" unchecked-value="0"></vxe-checkbox>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
@@ -113,7 +113,7 @@ export default defineComponent({
|
||||
value8: false,
|
||||
value9: true,
|
||||
value10: true,
|
||||
value11: false,
|
||||
value11: '1',
|
||||
value12: ['3']
|
||||
})
|
||||
return {
|
||||
|
||||
@@ -1172,7 +1172,7 @@
|
||||
"description": "是否禁用"
|
||||
},
|
||||
"vxe-checkbox/model-value": {
|
||||
"type": "any",
|
||||
"type": "string | number | boolean",
|
||||
"description": "v-model 绑定值"
|
||||
},
|
||||
"vxe-checkbox/label": {
|
||||
@@ -1199,6 +1199,14 @@
|
||||
"type": "boolean",
|
||||
"description": "是否不确定状态"
|
||||
},
|
||||
"vxe-checkbox/checked-value": {
|
||||
"type": "string | number | boolean",
|
||||
"description": "选中时的值"
|
||||
},
|
||||
"vxe-checkbox/unchecked-value": {
|
||||
"type": "string | number | boolean",
|
||||
"description": "未选中时的值"
|
||||
},
|
||||
"vxe-checkbox-group/model-value": {
|
||||
"type": "any[]",
|
||||
"description": "v-model 绑定值"
|
||||
|
||||
@@ -371,7 +371,9 @@
|
||||
"size",
|
||||
"disabled",
|
||||
"title",
|
||||
"indeterminate"
|
||||
"indeterminate",
|
||||
"checked-value",
|
||||
"unchecked-value"
|
||||
],
|
||||
"description": "复选框"
|
||||
},
|
||||
|
||||
@@ -9,10 +9,12 @@ import { VxeCheckboxConstructor, VxeCheckboxGroupConstructor, VxeCheckboxEmits,
|
||||
export default defineComponent({
|
||||
name: 'VxeCheckbox',
|
||||
props: {
|
||||
modelValue: Boolean as PropType<VxeCheckboxPropTypes.ModelValue>,
|
||||
modelValue: [String, Number, Boolean] as PropType<VxeCheckboxPropTypes.ModelValue>,
|
||||
label: { type: [String, Number] as PropType<VxeCheckboxPropTypes.Label>, default: null },
|
||||
indeterminate: Boolean as PropType<VxeCheckboxPropTypes.Indeterminate>,
|
||||
title: [String, Number] as PropType<VxeCheckboxPropTypes.Title>,
|
||||
checkedValue: { type: [String, Number, Boolean] as PropType<VxeCheckboxPropTypes.CheckedValue>, default: true },
|
||||
uncheckedValue: { type: [String, Number, Boolean] as PropType<VxeCheckboxPropTypes.UncheckedValue>, default: false },
|
||||
content: [String, Number] as PropType<VxeCheckboxPropTypes.Content>,
|
||||
disabled: Boolean as PropType<VxeCheckboxPropTypes.Disabled>,
|
||||
size: { type: String as PropType<VxeCheckboxPropTypes.Size>, default: () => GlobalConfig.checkbox.size || GlobalConfig.size }
|
||||
@@ -43,18 +45,21 @@ export default defineComponent({
|
||||
})
|
||||
|
||||
const computeChecked = computed(() => {
|
||||
return $xecheckboxgroup ? XEUtils.includes($xecheckboxgroup.props.modelValue, props.label) : props.modelValue
|
||||
return $xecheckboxgroup ? XEUtils.includes($xecheckboxgroup.props.modelValue, props.label) : props.modelValue === props.checkedValue
|
||||
})
|
||||
|
||||
const changeEvent = (evnt: Event & { target: { checked: boolean } }) => {
|
||||
const { checkedValue, uncheckedValue } = props
|
||||
const isDisabled = computeDisabled.value
|
||||
if (!isDisabled) {
|
||||
const checked = evnt.target.checked
|
||||
const value = checked ? checkedValue : uncheckedValue
|
||||
const params = { checked, value, label: props.label }
|
||||
if ($xecheckboxgroup) {
|
||||
$xecheckboxgroup.handleChecked({ checked, label: props.label }, evnt)
|
||||
$xecheckboxgroup.handleChecked(params, evnt)
|
||||
} else {
|
||||
emit('update:modelValue', checked)
|
||||
checkboxMethods.dispatchEvent('change', { checked, label: props.label }, evnt)
|
||||
emit('update:modelValue', value)
|
||||
checkboxMethods.dispatchEvent('change', params, evnt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
8
types/checkbox-group.d.ts
vendored
8
types/checkbox-group.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
import { SetupContext, RenderFunction, ComponentPublicInstance } from 'vue'
|
||||
import { VXEComponent, VxeComponentBase, SizeType, VxeEvent, ValueOf } from './component'
|
||||
import { VxeCheckboxEvents } from './checkbox'
|
||||
import { VxeCheckboxEvents, VxeCheckboxPropTypes } from './checkbox'
|
||||
|
||||
/**
|
||||
* 组件 - 复选框组
|
||||
@@ -40,7 +40,11 @@ export interface CheckboxGroupMethods {
|
||||
export interface VxeCheckboxGroupMethods extends CheckboxGroupMethods { }
|
||||
|
||||
export interface CheckboxGroupPrivateMethods {
|
||||
handleChecked(params: { checked: boolean, label: any }, evnt: Event): void;
|
||||
handleChecked(params: {
|
||||
checked: boolean;
|
||||
value: VxeCheckboxPropTypes.ModelValue;
|
||||
label: VxeCheckboxPropTypes.Label;
|
||||
}, evnt: Event): void;
|
||||
}
|
||||
export interface VxeCheckboxGroupPrivateMethods extends CheckboxGroupPrivateMethods { }
|
||||
|
||||
|
||||
6
types/checkbox.d.ts
vendored
6
types/checkbox.d.ts
vendored
@@ -33,6 +33,8 @@ export type VxeCheckboxProps = {
|
||||
* 原生 title 属性
|
||||
*/
|
||||
title?: VxeCheckboxPropTypes.Title;
|
||||
checkedValue?: VxeCheckboxPropTypes.CheckedValue;
|
||||
uncheckedValue?: VxeCheckboxPropTypes.UncheckedValue;
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@@ -45,10 +47,12 @@ export type VxeCheckboxProps = {
|
||||
|
||||
export namespace VxeCheckboxPropTypes {
|
||||
export type Size = SizeType;
|
||||
export type ModelValue = boolean;
|
||||
export type ModelValue = string | number | boolean;
|
||||
export type Label = string | number;
|
||||
export type Indeterminate = boolean;
|
||||
export type Title = string | number;
|
||||
export type CheckedValue = string | number | boolean;
|
||||
export type UncheckedValue = string | number | boolean;
|
||||
export type Content = string | number;
|
||||
export type Disabled = boolean;
|
||||
}
|
||||
|
||||
14
types/grid.d.ts
vendored
14
types/grid.d.ts
vendored
@@ -148,6 +148,7 @@ export namespace VxeGridPropTypes {
|
||||
export interface PagerOpts extends PagerConfig { }
|
||||
|
||||
interface ProxyAjaxQueryPageParams {
|
||||
total: number;
|
||||
pageSize: number;
|
||||
currentPage: number;
|
||||
}
|
||||
@@ -159,17 +160,12 @@ export namespace VxeGridPropTypes {
|
||||
property: string;
|
||||
}
|
||||
|
||||
interface ProxyAjaxQueryFiltersParams {
|
||||
field: string;
|
||||
property: string;
|
||||
values: any[];
|
||||
}
|
||||
|
||||
interface ProxyAjaxQueryParams {
|
||||
$grid: VxeGridConstructor;
|
||||
page: ProxyAjaxQueryPageParams;
|
||||
sort: ProxyAjaxQuerySortCheckedParams;
|
||||
sorts: ProxyAjaxQuerySortCheckedParams[];
|
||||
filters: ProxyAjaxQueryFiltersParams[];
|
||||
filters: VxeTableDefines.FilterCheckedParams[];
|
||||
form: any;
|
||||
}
|
||||
|
||||
@@ -178,18 +174,20 @@ export namespace VxeGridPropTypes {
|
||||
$grid: VxeGridConstructor;
|
||||
sort: ProxyAjaxQuerySortCheckedParams;
|
||||
sorts: ProxyAjaxQuerySortCheckedParams[];
|
||||
filters: ProxyAjaxQueryFiltersParams[];
|
||||
filters: VxeTableDefines.FilterCheckedParams[];
|
||||
form: any;
|
||||
options: any;
|
||||
}
|
||||
|
||||
interface ProxyAjaxDeleteParams {
|
||||
$grid: VxeGridConstructor;
|
||||
body: {
|
||||
removeRecords: any[];
|
||||
}
|
||||
}
|
||||
|
||||
interface ProxyAjaxSaveParams {
|
||||
$grid: VxeGridConstructor;
|
||||
body: {
|
||||
insertRecords: any[];
|
||||
updateRecords: any[];
|
||||
|
||||
Reference in New Issue
Block a user