index.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { __assign } from "tslib";
  2. import { Component, triggerEvent } from '../../_util/simply';
  3. import { resolveEventValue } from '../../_util/platform';
  4. import { FormTextareaDefaultProps } from './props';
  5. import { createForm } from '../form';
  6. Component(FormTextareaDefaultProps, {
  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. onClear: function (value, e) {
  24. this.emit('onChange', '');
  25. triggerEvent(this, 'change', resolveEventValue(value), e);
  26. },
  27. }, null, [
  28. createForm({
  29. methods: {
  30. setFormData: function (values) {
  31. this.setData(__assign(__assign({}, this.data), { formData: __assign(__assign({}, this.data.formData), values) }));
  32. this.input && this.input.update(this.data.formData.value);
  33. },
  34. },
  35. }),
  36. ]);