index.js 1.0 KB

1234567891011121314151617181920212223242526
  1. import { Component, triggerEvent, triggerEventValues, triggerEventOnly, getValueFromProps, } from '../../_util/simply';
  2. import { resolveEventValue, resolveEventValues } from '../../_util/platform';
  3. import { FormPickerDefaultProps } from './props';
  4. import { createForm } from '../form';
  5. Component(FormPickerDefaultProps, {
  6. onOk: function (value, column, e) {
  7. var v = resolveEventValues(value, column);
  8. this.emit('onChange', v[0]);
  9. triggerEventValues(this, 'ok', v, e);
  10. },
  11. onChange: function (value, column, e) {
  12. triggerEventValues(this, 'change', resolveEventValues(value, column), 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. handleFormat: function (value, column) {
  21. var onFormat = getValueFromProps(this, 'onFormat');
  22. if (onFormat) {
  23. return onFormat(value, column);
  24. }
  25. },
  26. }, {}, [createForm()], {});