-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Radio, Checkbox): 修复在 Group 组件内无法触发 change 事件的问题
- Loading branch information
Showing
25 changed files
with
254 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,10 @@ | ||
import type { ComponentObjectPropsOptions, PropType } from 'vue'; | ||
import type { Option } from '../_util/interface'; | ||
import type { ExtractPublicPropTypes } from '../_util/interface'; | ||
import { type InjectionKey } from 'vue'; | ||
import { type ParentGroupInjection } from '../_util/use/useSelect'; | ||
import { type CheckboxValue } from '../checkbox/props'; | ||
import { type CheckboxGroupInnerProps } from './props'; | ||
|
||
export const checkboxGroupKey = Symbol('FCheckboxGroup'); | ||
export const name = 'FCheckboxGroup'; | ||
export const COMPONENT_NAME = 'FCheckboxGroup'; | ||
|
||
export type OptionValue = Option['value']; | ||
|
||
export const checkboxGroupProps = { | ||
modelValue: { | ||
type: Array as PropType<OptionValue[]>, | ||
default: () => [] as OptionValue[], | ||
}, | ||
vertical: Boolean, | ||
disabled: Boolean, | ||
options: { | ||
type: Array as PropType<Option[] | null>, | ||
default: () => [] as Option[], | ||
}, | ||
valueField: { | ||
type: String, | ||
default: 'value', | ||
}, | ||
labelField: { | ||
type: String, | ||
default: 'label', | ||
}, | ||
} as const satisfies ComponentObjectPropsOptions; | ||
|
||
export type CheckboxGroupProps = ExtractPublicPropTypes< | ||
typeof checkboxGroupProps | ||
>; | ||
export const checkboxGroupKey: InjectionKey< | ||
ParentGroupInjection<CheckboxValue, CheckboxGroupInnerProps> | ||
> = Symbol('FCheckboxGroup'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import type { ComponentObjectPropsOptions, PropType } from 'vue'; | ||
import type { OptionValue } from './interface'; | ||
import type { | ||
ComponentInnerProps, | ||
ExtractPublicPropTypes, | ||
Option, | ||
} from '../_util/interface'; | ||
|
||
export const checkboxGroupProps = { | ||
modelValue: { | ||
type: Array as PropType<OptionValue[]>, | ||
default: () => [] as OptionValue[], | ||
}, | ||
vertical: Boolean, | ||
disabled: Boolean, | ||
options: { | ||
type: Array as PropType<Option[] | null>, | ||
default: () => [] as Option[], | ||
}, | ||
valueField: { | ||
type: String, | ||
default: 'value', | ||
}, | ||
labelField: { | ||
type: String, | ||
default: 'label', | ||
}, | ||
} as const satisfies ComponentObjectPropsOptions; | ||
|
||
export type CheckboxGroupProps = ExtractPublicPropTypes< | ||
typeof checkboxGroupProps | ||
>; | ||
|
||
export type CheckboxGroupInnerProps = ComponentInnerProps< | ||
typeof checkboxGroupProps | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { type PropType, type ComponentObjectPropsOptions } from 'vue'; | ||
import type { ExtractPublicPropTypes } from '../_util/interface'; | ||
|
||
export type CheckboxValue = string | number | boolean; | ||
|
||
export const checkboxProps = { | ||
modelValue: Boolean, | ||
indeterminate: Boolean, | ||
value: [String, Number, Boolean] as PropType<CheckboxValue>, | ||
label: [String, Number] as PropType<string | number>, | ||
disabled: Boolean, | ||
} as const satisfies ComponentObjectPropsOptions; | ||
|
||
export type CheckboxProps = ExtractPublicPropTypes<typeof checkboxProps>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { type ComponentObjectPropsOptions, type PropType } from 'vue'; | ||
import { type RadioValue } from '../radio/props'; | ||
import type { ExtractPublicPropTypes } from '../_util/interface'; | ||
|
||
export const radioButtonProps = { | ||
disabled: { | ||
type: Boolean, | ||
}, | ||
value: { | ||
type: [String, Number, Boolean] as PropType<RadioValue>, | ||
}, | ||
label: { | ||
type: [String, Number] as PropType<string | number>, | ||
}, | ||
} as const satisfies ComponentObjectPropsOptions; | ||
|
||
export type RadioButtonProps = ExtractPublicPropTypes<typeof radioButtonProps>; |
Oops, something went wrong.