chore: rename useParentField to useLinkField

This commit is contained in:
chenjiahan 2020-09-26 11:24:42 +08:00
parent 7bf95d4bcf
commit 9010a0edf1
9 changed files with 17 additions and 17 deletions

View File

@ -3,7 +3,7 @@ import { createNamespace } from '../utils';
import { CHECKBOX_KEY } from '../checkbox';
import { useExpose } from '../composition/use-expose';
import { useChildren } from '../composition/use-relation';
import { useParentField } from '../composition/use-parent-field';
import { useLinkField } from '../composition/use-link-field';
const [createComponent, bem] = createNamespace('checkbox-group');
@ -44,7 +44,7 @@ export default createComponent({
);
useExpose({ toggleAll });
useParentField(() => props.modelValue);
useLinkField(() => props.modelValue);
linkChildren({ emit, props });
return () => <div class={bem([props.direction])}>{slots.default?.()}</div>;

View File

@ -1,7 +1,7 @@
import { computed, watch } from 'vue';
import { createNamespace, pick } from '../utils';
import { useExpose } from '../composition/use-expose';
import { useParentField } from '../composition/use-parent-field';
import { useLinkField } from '../composition/use-link-field';
import { useParent } from '../composition/use-relation';
import Checker, { checkerProps } from './Checker';
@ -81,7 +81,7 @@ export default createComponent({
);
useExpose({ toggle, checked });
useParentField(() => props.modelValue);
useLinkField(() => props.modelValue);
return () => (
<Checker

View File

@ -1,7 +1,7 @@
import { watch, inject } from 'vue';
import { FIELD_KEY } from '../field';
export function useParentField(getValue: () => unknown) {
export function useLinkField(getValue: () => unknown) {
const field = inject(FIELD_KEY, null) as any;
if (field && !field.childFieldValue.value) {

View File

@ -1,7 +1,7 @@
import { watch } from 'vue';
import { createNamespace } from '../utils';
import { useChildren } from '../composition/use-relation';
import { useParentField } from '../composition/use-parent-field';
import { useLinkField } from '../composition/use-link-field';
const [createComponent, bem] = createNamespace('radio-group');
@ -29,7 +29,7 @@ export default createComponent({
);
linkChildren({ emit, props });
useParentField(() => props.modelValue);
useLinkField(() => props.modelValue);
return () => (
<div class={bem([props.direction])} role="radiogroup">

View File

@ -7,7 +7,7 @@ import { preventDefault } from '../utils/dom/event';
// Composition
import { useRefs } from '../composition/use-refs';
import { useTouch } from '../composition/use-touch';
import { useParentField } from '../composition/use-parent-field';
import { useLinkField } from '../composition/use-link-field';
// Components
import Icon from '../icon';
@ -193,7 +193,7 @@ export default createComponent({
);
};
useParentField(() => props.modelValue);
useLinkField(() => props.modelValue);
return () => (
<div

View File

@ -8,7 +8,7 @@ import { preventDefault } from '../utils/dom/event';
// Composition
import { useRect } from '../composition/use-rect';
import { useTouch } from '../composition/use-touch';
import { useParentField } from '../composition/use-parent-field';
import { useLinkField } from '../composition/use-link-field';
const [createComponent, bem] = createNamespace('slider');
@ -249,7 +249,7 @@ export default createComponent({
// format initial value
updateValue(props.modelValue);
useParentField(() => props.modelValue);
useLinkField(() => props.modelValue);
return () => (
<div

View File

@ -8,7 +8,7 @@ import { preventDefault } from '../utils/dom/event';
import { createNamespace, isDef, addUnit, getSizeStyle } from '../utils';
// Composition
import { useParentField } from '../composition/use-parent-field';
import { useLinkField } from '../composition/use-link-field';
const [createComponent, bem] = createNamespace('stepper');
@ -270,7 +270,7 @@ export default createComponent({
emit('change', value, { name: props.name });
});
useParentField(() => props.modelValue);
useLinkField(() => props.modelValue);
return () => (
<div class={bem([props.theme])}>

View File

@ -1,5 +1,5 @@
import { createNamespace, addUnit } from '../utils';
import { useParentField } from '../composition/use-parent-field';
import { useLinkField } from '../composition/use-link-field';
import Loading from '../loading';
const [createComponent, bem] = createNamespace('switch');
@ -42,7 +42,7 @@ export default createComponent({
}
};
useParentField(() => props.modelValue);
useLinkField(() => props.modelValue);
return () => {
const { size, loading, disabled, activeColor, inactiveColor } = props;

View File

@ -13,7 +13,7 @@ import {
// Composition
import { useExpose } from '../composition/use-expose';
import { useParentField } from '../composition/use-parent-field';
import { useLinkField } from '../composition/use-link-field';
// Components
import Icon from '../icon';
@ -313,7 +313,7 @@ export default createComponent({
closeImagePreview,
});
useParentField(() => props.modelValue);
useLinkField(() => props.modelValue);
return () => (
<div class={bem()}>