-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: RareWordsKeyboard 去掉hook相关实现 * feat: RareWordsKeyboard 去掉hook相关实现 * feat: Form 去掉hook相关实现,并适配微信 * feat: 部分form组件传入defaultValue * feat: formInput适配微信 * feat: 部分form组件传入defaultValue * feat: 部分form组件传入defaultValue * feat: form相关的fef判空 * feat: form相关的fef判空 * feat: form相关的fef判空
- Loading branch information
Showing
121 changed files
with
1,860 additions
and
2,250 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,48 @@ | ||
import { useEvent } from 'functional-mini/component'; | ||
import { mountComponent } from '../../_util/component'; | ||
import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; | ||
import { | ||
useHandleCustomEvent, | ||
useHandleCustomEventOnly, | ||
useMultipleValueHandleCustomEvent, | ||
} from '../../_util/hooks/useHandleCustomEvent'; | ||
import { useFormItem } from '../use-form-item'; | ||
import { | ||
Component, | ||
triggerEvent, | ||
triggerEventValues, | ||
triggerEventOnly, | ||
getValueFromProps, | ||
} from '../../_util/simply'; | ||
import { resolveEventValue, resolveEventValues } from '../../_util/platform'; | ||
import { FormCascaderPickerDefaultProps } from './props'; | ||
import { createForm } from '../form'; | ||
|
||
Component( | ||
FormCascaderPickerDefaultProps, | ||
FormCascaderPickerProps, | ||
} from './props'; | ||
|
||
const FormCascaderPicker = (props: FormCascaderPickerProps) => { | ||
const { formData, emit } = useFormItem(props); | ||
const { triggerEventValues, triggerEventOnly, triggerEvent } = | ||
useComponentEvent(props); | ||
|
||
useMultipleValueHandleCustomEvent('onOk', (value, option, e) => { | ||
emit('onChange', value); | ||
triggerEventValues('ok', [value, option], e); | ||
}); | ||
|
||
useMultipleValueHandleCustomEvent('onPickerChange', (value, option, e) => { | ||
triggerEventValues('pickerChange', [value, option], e); | ||
}); | ||
|
||
useHandleCustomEvent('onVisibleChange', (visible, e) => { | ||
triggerEvent('visibleChange', visible, e); | ||
}); | ||
|
||
useEvent( | ||
'handleFormat', | ||
(value, option) => { | ||
if (props.onFormat) { | ||
return props.onFormat(value, option); | ||
{ | ||
onOk(value, option, e) { | ||
const v = resolveEventValues(value, option); | ||
this.emit('onChange', v[0]); | ||
triggerEventValues(this, 'ok', v, e); | ||
}, | ||
onPickerChange(value, option, e) { | ||
triggerEventValues( | ||
this, | ||
'pickerChange', | ||
resolveEventValues(value, option), | ||
e | ||
); | ||
}, | ||
onVisibleChange(visible, e) { | ||
triggerEvent(this, 'visibleChange', resolveEventValue(visible), e); | ||
}, | ||
onDismissPicker(e) { | ||
triggerEventOnly(this, 'cancel', e); | ||
}, | ||
onChange(value, options, e) { | ||
triggerEventValues(this, 'change', resolveEventValues(value, options), e); | ||
}, | ||
handleFormat(value, option) { | ||
const onFormat = getValueFromProps(this, 'onFormat'); | ||
if (onFormat) { | ||
return onFormat(value, option); | ||
} | ||
}, | ||
{ handleResult: true } | ||
); | ||
|
||
useHandleCustomEventOnly('onDismissPicker', (e) => { | ||
triggerEventOnly('cancel', e); | ||
}); | ||
|
||
useMultipleValueHandleCustomEvent('onChange', (value, options, e) => { | ||
triggerEventValues('change', [value, options], e); | ||
}); | ||
|
||
return { | ||
formData, | ||
}; | ||
}; | ||
|
||
mountComponent(FormCascaderPicker, FormCascaderPickerDefaultProps); | ||
}, | ||
{}, | ||
[createForm()], | ||
{ | ||
} | ||
); |
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,21 +1,16 @@ | ||
import { mountComponent } from '../../_util/component'; | ||
import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; | ||
import { useHandleCustomEvent } from '../../_util/hooks/useHandleCustomEvent'; | ||
import { useFormItem } from '../use-form-item'; | ||
import { FormCheckboxGroupDefaultProps, FormCheckboxGroupProps } from './props'; | ||
import { Component, triggerEvent } from '../../_util/simply'; | ||
import { FormCheckboxGroupDefaultProps } from './props'; | ||
import { resolveEventValue } from '../../_util/platform'; | ||
import { createForm } from '../form'; | ||
|
||
const FormCheckboxGroup = (props: FormCheckboxGroupProps) => { | ||
const { formData, emit } = useFormItem(props); | ||
const { triggerEvent } = useComponentEvent(props); | ||
|
||
useHandleCustomEvent('onChange', (value, e) => { | ||
emit('onChange', value); | ||
triggerEvent('change', value, e); | ||
}); | ||
|
||
return { | ||
formData, | ||
}; | ||
}; | ||
|
||
mountComponent(FormCheckboxGroup, FormCheckboxGroupDefaultProps); | ||
Component( | ||
FormCheckboxGroupDefaultProps, | ||
{ | ||
onChange(value, e) { | ||
this.emit('onChange', resolveEventValue(value)); | ||
triggerEvent(this, 'change', resolveEventValue(value), e); | ||
}, | ||
}, | ||
null, | ||
[createForm()] | ||
); |
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,67 +1,52 @@ | ||
import { useEvent } from 'functional-mini/component'; | ||
import { mountComponent } from '../../_util/component'; | ||
import { useComponentEvent } from '../../_util/hooks/useComponentEvent'; | ||
import { | ||
useHandleCustomEvent, | ||
useHandleCustomEventOnly, | ||
useMultipleValueHandleCustomEvent, | ||
} from '../../_util/hooks/useHandleCustomEvent'; | ||
import { useFormItem } from '../use-form-item'; | ||
import { FormDatePickerDefaultProps, FormDatePickerProps } from './props'; | ||
import { platform } from '../../_util/platform'; | ||
|
||
const FormDatePicker = (props: FormDatePickerProps) => { | ||
const { formData, emit } = useFormItem(props); | ||
const { triggerEventValues, triggerEventOnly, triggerEvent } = | ||
useComponentEvent(props); | ||
|
||
useMultipleValueHandleCustomEvent('onOk', (date, dateStr, e) => { | ||
emit('onChange', platform() === 'wechat' ? date.getTime() : date); | ||
triggerEventValues('ok', [date, dateStr], e); | ||
}); | ||
|
||
useMultipleValueHandleCustomEvent('onPickerChange', (date, dateStr, e) => { | ||
triggerEventValues('pickerChange', [date, dateStr], e); | ||
}); | ||
|
||
useHandleCustomEvent('onVisibleChange', (visible, e) => { | ||
triggerEvent('visibleChange', visible, e); | ||
}); | ||
|
||
useHandleCustomEventOnly('onDismissPicker', (e) => { | ||
triggerEventOnly('dismissPicker', e); | ||
}); | ||
Component, | ||
triggerEvent, | ||
triggerEventValues, | ||
triggerEventOnly, | ||
getValueFromProps, | ||
} from '../../_util/simply'; | ||
import { resolveEventValue, resolveEventValues } from '../../_util/platform'; | ||
import { FormDatePickerDefaultProps } from './props'; | ||
import { createForm } from '../form'; | ||
|
||
Component( | ||
FormDatePickerDefaultProps, | ||
{ | ||
onOk(date, dateStr, e) { | ||
const v = resolveEventValues(date, dateStr); | ||
this.emit('onChange', v[0]); | ||
triggerEventValues(this, 'ok', v, e); | ||
}, | ||
onPickerChange(date, dateStr, e) { | ||
triggerEventValues( | ||
this, | ||
'pickerChange', | ||
resolveEventValues(date, dateStr), | ||
e | ||
); | ||
}, | ||
onVisibleChange(visible, e) { | ||
triggerEvent(this, 'visibleChange', resolveEventValue(visible), e); | ||
}, | ||
onDismissPicker(e) { | ||
triggerEventOnly(this, 'dismissPicker', e); | ||
}, | ||
|
||
useEvent( | ||
'handleFormat', | ||
(date, dateStr) => { | ||
if (props.onFormat) { | ||
return props.onFormat(date, dateStr); | ||
handleFormat(date, dateStr) { | ||
const onFormat = getValueFromProps(this, 'onFormat'); | ||
if (onFormat) { | ||
return onFormat(date, dateStr); | ||
} | ||
}, | ||
{ | ||
handleResult: true, | ||
} | ||
); | ||
|
||
useEvent( | ||
'handleFormatLabel', | ||
(type, value) => { | ||
if (props.onFormatLabel) { | ||
return props.onFormatLabel(type, value); | ||
handleFormatLabel(type, value) { | ||
const onFormatLabel = getValueFromProps(this, 'onFormatLabel'); | ||
if (onFormatLabel) { | ||
return onFormatLabel(type, value); | ||
} | ||
}, | ||
{ | ||
handleResult: true, | ||
} | ||
); | ||
|
||
return { | ||
formData, | ||
}; | ||
}; | ||
|
||
mountComponent( | ||
FormDatePicker, | ||
FormDatePickerDefaultProps as FormDatePickerProps | ||
}, | ||
{}, | ||
[createForm()], | ||
{ | ||
} | ||
); |
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
Oops, something went wrong.