index.js 1.2 KB

1234567891011121314151617181920212223242526272829
  1. import { Component, triggerEvent, triggerEventValues, triggerEventOnly, getValueFromProps, } from '../../_util/simply';
  2. import { resolveEventValue, resolveEventValues } from '../../_util/platform';
  3. import { FormCascaderPickerDefaultProps } from './props';
  4. import { createForm } from '../form';
  5. Component(FormCascaderPickerDefaultProps, {
  6. onOk: function (value, option, e) {
  7. var v = resolveEventValues(value, option);
  8. this.emit('onChange', v[0]);
  9. triggerEventValues(this, 'ok', v, e);
  10. },
  11. onPickerChange: function (value, option, e) {
  12. triggerEventValues(this, 'pickerChange', resolveEventValues(value, option), e);
  13. },
  14. onVisibleChange: function (visible, e) {
  15. triggerEvent(this, 'visibleChange', resolveEventValue(visible), e);
  16. },
  17. onDismissPicker: function (e) {
  18. triggerEventOnly(this, 'cancel', e);
  19. },
  20. onChange: function (value, options, e) {
  21. triggerEventValues(this, 'change', resolveEventValues(value, options), e);
  22. },
  23. handleFormat: function (value, option) {
  24. var onFormat = getValueFromProps(this, 'onFormat');
  25. if (onFormat) {
  26. return onFormat(value, option);
  27. }
  28. },
  29. }, {}, [createForm()], {});