index.js 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. import { __assign } from "tslib";
  2. import { Component, triggerEvent } from '../../_util/simply';
  3. import { resolveEventValue } from '../../_util/platform';
  4. import { FormInputDefaultProps } from './props';
  5. import { createForm } from '../form';
  6. Component(FormInputDefaultProps, {
  7. handleRef: function (input) {
  8. this.input = input;
  9. },
  10. onChange: function (value, e) {
  11. this.emit('onChange', resolveEventValue(value));
  12. triggerEvent(this, 'change', resolveEventValue(value), e);
  13. },
  14. onBlur: function (value, e) {
  15. triggerEvent(this, 'blur', resolveEventValue(value), e);
  16. },
  17. onFocus: function (value, e) {
  18. triggerEvent(this, 'focus', resolveEventValue(value), e);
  19. },
  20. onConfirm: function (value, e) {
  21. triggerEvent(this, 'confirm', resolveEventValue(value), e);
  22. },
  23. }, null, [
  24. createForm({
  25. methods: {
  26. setFormData: function (values) {
  27. this.setData(__assign(__assign({}, this.data), { formData: __assign(__assign({}, this.data.formData), values) }));
  28. this.input && this.input.update(this.data.formData.value);
  29. },
  30. },
  31. }),
  32. ]);