"use strict";

var _interopRequireDefault = require("E:/T/git/\u5965\u666ETeam/opu-components-vue/node_modules/@babel/runtime/helpers/interopRequireDefault.js").default;

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

require("regenerator-runtime/runtime.js");

require("core-js/modules/es.array.map.js");

require("core-js/modules/es.object.to-string.js");

require("core-js/modules/es.string.iterator.js");

require("core-js/modules/web.dom-collections.iterator.js");

require("core-js/modules/web.dom-collections.for-each.js");

require("core-js/modules/es.regexp.exec.js");

require("core-js/modules/es.string.replace.js");

require("core-js/modules/es.array.slice.js");

require("core-js/modules/es.array.filter.js");

require("core-js/modules/es.function.name.js");

require("core-js/modules/es.array.includes.js");

require("core-js/modules/es.string.includes.js");

require("core-js/modules/es.array.concat.js");

var _babelHelperVueJsxMergeProps = _interopRequireDefault(require("@vue/babel-helper-vue-jsx-merge-props"));

var _objectSpread2 = _interopRequireDefault(require("E:/T/git/\u5965\u666ETeam/opu-components-vue/node_modules/@babel/runtime/helpers/esm/objectSpread2.js"));

var _typeof2 = _interopRequireDefault(require("E:/T/git/\u5965\u666ETeam/opu-components-vue/node_modules/@babel/runtime/helpers/esm/typeof.js"));

var _defineProperty2 = _interopRequireDefault(require("E:/T/git/\u5965\u666ETeam/opu-components-vue/node_modules/@babel/runtime/helpers/esm/defineProperty.js"));

var _asyncToGenerator2 = _interopRequireDefault(require("E:/T/git/\u5965\u666ETeam/opu-components-vue/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js"));

var _moment = _interopRequireDefault(require("moment"));

var _lodash = require("lodash");

var _utils = _interopRequireDefault(require("../../../utils"));

var _conf = _interopRequireDefault(require("../../conf"));

var _select = _interopRequireDefault(require("../../../dataForm/src/select"));

var _datePicker = _interopRequireDefault(require("../../../dataForm/src/datePicker"));

var _timePicker = _interopRequireDefault(require("../../../dataForm/src/timePicker"));

var _autoComplete = _interopRequireDefault(require("../../../dataForm/src/autoComplete"));

// 请求表单项可选数据
var fetchItemPropsOptionsApiList = /*#__PURE__*/function () {
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_vm) {
    var that, onEditOptionsLoadBefore, editApiList, optionDataRender, list, beforeRes, promises;
    return regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            that = _vm;
            onEditOptionsLoadBefore = that.onEditOptionsLoadBefore, editApiList = that.editApiList, optionDataRender = that.optionDataRender;
            list = editApiList;

            if (!onEditOptionsLoadBefore) {
              _context.next = 10;
              break;
            }

            beforeRes = onEditOptionsLoadBefore(list);

            if (!(beforeRes === false)) {
              _context.next = 9;
              break;
            }

            return _context.abrupt("return", false);

          case 9:
            if (beforeRes) {
              list = beforeRes;
            }

          case 10:
            promises = list.map(function (p) {
              return p.api(p.param);
            });
            Promise.all(promises).then(function (res) {
              var editOptions = that.editOptions,
                  editDefaultOption = that.editDefaultOption,
                  onOptionsLoadAfter = that.onOptionsLoadAfter;
              list.forEach(function (item, index) {
                var defaultField = item.defaultField,
                    field = item.field,
                    fields = item.fields;
                var data = res[index];

                if (fields && fields.length) {
                  fields.forEach(function (p) {
                    var optionsData = handlefieldOptionsDataField(p, data, that);
                    field = p.field;
                    editOptions[field] = optionsData.map(function (o) {
                      o = optionDataRender(o, field);

                      if (o[defaultField]) {
                        editDefaultOption[field] = o.value;
                      }

                      return o;
                    });
                  });
                } else {
                  // 字段单独配置api的可选数据的处理
                  var optionsData = handlefieldOptionsDataField(item, data, that);
                  editOptions[field] = optionsData.map(function (p) {
                    p = optionDataRender(p, field);

                    if (p[defaultField]) {
                      editDefaultOption[field] = p.value;
                    }

                    return p;
                  });
                }
              });

              if (that.onOptionsAllLoad) {
                editOptions = that.onOptionsAllLoad(editOptions);
              }

              that.editOptions = editOptions;
              that.editDefaultOption = editDefaultOption;

              if (onOptionsLoadAfter) {
                onOptionsLoadAfter(editOptions, editDefaultOption);
              }

              that.$refs.dataGrid.updateData();
            });

          case 12:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));

  return function fetchItemPropsOptionsApiList(_x) {
    return _ref.apply(this, arguments);
  };
}(); // 驼峰转换下划线


function toLine(name) {
  name = name.replace(/([A-Z])/g, "-$1").toLowerCase();
  return name[0] == "-" ? name.slice(1) : name;
} //根据路径参数 查找对应数据


function handlefieldOptionsDataField(item, json) {
  var optionData = json;

  if (item) {
    var dataField = item.dataField != undefined ? item.dataField : _conf.default.getSelectOptions.dataField;
    optionData = _utils.default.getObjData(dataField, json);
  }

  return optionData;
} //插槽class  style 等重写


function editSlotItemRender(name, e) {
  if (typeof name == "function") {
    return name(e);
  } else {
    return name;
  }
} //查询对应属性 根据属性类型做对应处理


function editSlotPropInit(row, props, key, field) {
  var defaultKey = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  return !props[key] && props[key] != 0 ? defaultKey : typeof props[key] == "function" ? props[key](row, field) : props[key];
}

var editRender = {
  components: {
    OpuSelect: _select.default,
    OpuDatePicker: _datePicker.default,
    OpuTimePicker: _timePicker.default,
    OpuAutoComplete: _autoComplete.default
  },
  props: {
    onEditOptionsLoadBefore: {
      type: Function,
      default: null
    },
    editSize: {
      type: String,
      default: ""
    },
    onOptionsLoadAfter: {
      type: Function,
      default: null
    },
    onOptionsAllLoad: {
      type: Function,
      default: null
    }
  },
  data: function data() {
    return {
      editType: ["a-input", "a-input-number", "a-select", "a-auto-complete", "a-date-picker", "a-time-picker", "a-switch", "a-checkbox", "pulldown-table"],
      componentsFocusItemTypes: ["a-input", "a-input-number", "a-select", "a-auto-complete", "a-date-picker", "a-time-picker", "pulldown-table"],
      pressEnterItemIndexs: [],
      editOptions: {},
      editApiList: [],
      editDefaultOption: {},
      editFieldList: {}
    };
  },
  computed: {
    editItemSize: function editItemSize() {
      var editSize = this.editSize;

      if (editSize === "") {
        editSize = _conf.default.editSize;
      }

      return editSize;
    }
  },
  methods: {
    /**
     * @description: 设置下拉数据
     * @param {*} data
     * @return {*}
     */
    setFieldsOptions: function setFieldsOptions(data) {
      var _this = this;

      var editOptions = this.editOptions,
          editFieldList = this.editFieldList;

      var _loop = function _loop(key) {
        var item = data[key];

        if (editFieldList[key]) {
          // editOptions[key] = item;
          editOptions[key] = item.map(function (p) {
            return _this.optionDataRender(p, key);
          });
        }
      };

      for (var key in data) {
        _loop(key);
      }

      this.editOptions = editOptions;
      this.$refs.dataGrid.updateData();
    },

    /**
     * @description: 获取下拉数据
     * @param {*}
     * @return {*}
     */
    getFieldsOptions: function getFieldsOptions() {
      return this.editOptions;
    },

    /**
     * @description: 获取默认数据
     * @param {*}
     * @return {*}
     */
    getEditDefaultOption: function getEditDefaultOption() {
      return this.editDefaultOption;
    },

    /**
     * @description: 重构下拉数据option
     * @param {*} o
     * @param {*} field
     * @param {*} pValue
     * @param {*} editFieldList
     * @return {*}
     */
    optionDataRender: function optionDataRender(o, field) {
      var _this2 = this;

      var pValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
      var editFieldList = arguments.length > 3 ? arguments[3] : undefined;
      if (!editFieldList) editFieldList = this.editFieldList;

      if (editFieldList[field]) {
        var _editFieldList$field = editFieldList[field],
            labelField = _editFieldList$field.labelField,
            valueField = _editFieldList$field.valueField,
            childrenField = _editFieldList$field.childrenField;

        if ((o.value || o.value == 0) && !o[_conf.default.originalValueKey]) {
          o[_conf.default.originalValueKey || "originalValueKey"] = o.value;
        }

        if (labelField != "label") {
          o.label = o[labelField];
        }

        if (valueField != "value") {
          o.value = o[valueField];
        }

        if (pValue) {
          o._pValue = pValue;
        }

        if (childrenField != "children" && o[childrenField].length > 0) {
          o.children = o[childrenField].map(function (p) {
            return _this2.optionDataRender(p, field, o.value);
          });
        }
      }

      return o;
    },

    /**
     * @description: 表格列重构
     * @param {*} data
     * @param {*} filterCallback
     * @return {*}
     */
    editColumnsRender: function editColumnsRender(data, filterCallback) {
      var _this3 = this;

      var h = this.$createElement;
      var editType = this.editType,
          editOptions = this.editOptions,
          editDefaultOption = this.editDefaultOption,
          editFieldList = this.editFieldList;
      var otherApiList = [];
      var pressEnterItemIndexs = [];
      var getSelectOptions = _conf.default.getSelectOptions;
      var unifyApiList = {
        api: getSelectOptions && getSelectOptions.api ? getSelectOptions.api : _conf.default.getSelectOptions.api,
        param: {},
        fields: []
      };
      data = data.filter(function (p) {
        if (filterCallback && !filterCallback(p)) {
          return false;
        }

        if (p.itemRender) {
          var name = toLine(p.itemRender.name || editType[0]);

          if (editType.includes(name)) {
            if (!p.slots) p.slots = {};

            p.slots.default = function (e) {
              return [h("div", {
                "style": "display:flex;align-items: center;"
              }, [p.itemRender.before && p.itemRender.before(e), h("div", {
                "style": "flex:1"
              }, [_this3.editSlotRender(name)(e)]), p.itemRender.after && p.itemRender.after(e)])];
            };

            pressEnterItemIndexs.push(p.field);
            if (name == "a-switch" || name == "a-checkbox") p.align = "center";
            var props = p.itemRender.props || {};

            if (["a-select", "a-auto-complete"].includes(name) && props) {
              var field = p.field;
              var valueField = props.valueField || getSelectOptions.valueField;
              var labelField = props.labelField || getSelectOptions.labelField;
              var childrenField = props.childrenField || getSelectOptions.childrenField;
              var dataField = props.dataField || getSelectOptions.dataField;
              var defaultField = props.defaultField || getSelectOptions.defaultField;
              var searchFields = props.searchFields || _conf.default.defaultProps.select.searchFields || [];

              if (!(editFieldList[field] && props.api == editFieldList[field].api && _utils.default.isEqual(editFieldList[field].param, props.param))) {
                editFieldList[field] = {
                  valueField: valueField,
                  labelField: labelField,
                  childrenField: childrenField,
                  defaultField: defaultField,
                  searchFields: searchFields,
                  api: props.api,
                  param: props.param
                };

                if (props.options) {
                  editOptions[field] = (0, _lodash.cloneDeep)(props.options).map(function (o) {
                    o = _this3.optionDataRender(o, field, "", (0, _defineProperty2.default)({}, field, {
                      valueField: valueField,
                      labelField: labelField,
                      childrenField: childrenField
                    }));

                    if (o[defaultField]) {
                      editDefaultOption[field] = p.value;
                    }

                    return o;
                  });
                } else if (!props.optionsField && (props.api || props.dataField || props.param) && !editOptions[field]) {
                  var item = {
                    field: field,
                    api: props.api,
                    valueField: valueField,
                    labelField: labelField,
                    childrenField: childrenField,
                    dataField: dataField,
                    defaultField: defaultField,
                    param: props.param || {}
                  };

                  if (props.api) {
                    otherApiList.push(item);
                  } else {
                    for (var key in props.param) {
                      if (unifyApiList.param[key] && _utils.default.isArray(unifyApiList.param[key])) {
                        unifyApiList.param[key].push(props.param[key]);
                      } else {
                        unifyApiList.param[key] = [props.param[key]];
                      }
                    }

                    unifyApiList.fields.push(item);
                  }
                }
              }
            }
          }
        }

        return true;
      });

      if (unifyApiList.fields.length > 0) {
        otherApiList = otherApiList.concat(unifyApiList);
      }

      this.editDefaultOption = editDefaultOption;
      this.pressEnterItemIndexs = pressEnterItemIndexs;
      this.editOptions = editOptions;
      this.editApiList = otherApiList;
      this.editFieldList = editFieldList;

      if (editFieldList.length > 0) {
        this.loadOptionsData();
      }

      return data;
    },
    loadOptionsData: function loadOptionsData(isAll) {
      if (isAll) {
        this.setTableColumns(this.columns);
      } else {
        fetchItemPropsOptionsApiList(this);
      }
    },

    /**
     * @description: 选中下一个
     * @param {*}
     * @return {*}
     */
    nextItemFocus: function nextItemFocus(event) {
      console.log(event, "enter-----------------------------------");
    },
    editSlotRender: function editSlotRender(name) {
      var _this4 = this;

      var h = this.$createElement;
      return function (event) {
        var that = _this4;
        var currentCell = that.currentCell;
        currentCell = false;
        var columnIndex = event.columnIndex,
            rowIndex = event.rowIndex,
            row = event.row;
        var item = that.tableColumns[columnIndex];
        var itemRender = item.itemRender || {};
        var props = itemRender.props || {};
        var disabled = editSlotPropInit(row, props, "disabled", item.field);
        var element;

        if ((0, _typeof2.default)(disabled) == "object") {
          return [disabled];
        } else if (currentCell && currentCell.rowIndex != rowIndex) {
          return [_utils.default.getObjData(item.field, row) || ""];
        } else {
          var field = item.field;
          event.field = field;
          props = (0, _objectSpread2.default)((0, _objectSpread2.default)({
            size: that.editItemSize
          }, props), {}, {
            value: _utils.default.getObjData(field, row),
            disabled: disabled
          });
          var attr = {
            class: editSlotItemRender(itemRender.class, event),
            style: editSlotItemRender(itemRender.style, event)
          };
          var optionsField, options, trueValue, falseValue;
          var ons = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemRender.on), {}, {
            change: function change(e) {
              _utils.default.setObjData(field, row, e);

              row.ISEDIT = true;

              if (itemRender.on && itemRender.on.change) {
                itemRender.on.change(e, event);
              }
            },
            blur: function blur(e) {
              if (itemRender.on && itemRender.on.blur) {
                itemRender.on.blur(e, event);
              }
            }
          });

          switch (name) {
            case "a-input":
              element = h("a-input", (0, _babelHelperVueJsxMergeProps.default)([{}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, attr), {}, {
                props: props,
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ons), {}, {
                  change: function change(e) {
                    var value = e.target.value;

                    _utils.default.setObjData(field, row, value);

                    row.ISEDIT = true;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(e, event);
                    }
                  },
                  keydown: function () {
                    var _keydown = (0, _asyncToGenerator2.default)( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(e) {
                      var res;
                      return regeneratorRuntime.wrap(function _callee2$(_context2) {
                        while (1) {
                          switch (_context2.prev = _context2.next) {
                            case 0:
                              res = true;

                              if (!(itemRender.on && itemRender.on.keydown)) {
                                _context2.next = 5;
                                break;
                              }

                              _context2.next = 4;
                              return itemRender.on.keydown(e, event);

                            case 4:
                              res = _context2.sent;

                            case 5:
                              if (res && e.keyCode == 13) {
                                that.nextItemFocus(event);
                              }

                            case 6:
                            case "end":
                              return _context2.stop();
                          }
                        }
                      }, _callee2);
                    }));

                    function keydown(_x2) {
                      return _keydown.apply(this, arguments);
                    }

                    return keydown;
                  }()
                })
              })]));
              break;

            case "a-input-number":
              element = h("a-input-number", (0, _babelHelperVueJsxMergeProps.default)([{}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, attr), {}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
                  max: editSlotPropInit(row, props, "max", field, Infinity),
                  min: editSlotPropInit(row, props, "min", field, -Infinity)
                }),
                style: (0, _objectSpread2.default)({
                  width: "100%"
                }, attr.style),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ons), {}, {
                  change: function change(e) {
                    var value = e;

                    _utils.default.setObjData(field, row, value);

                    row.ISEDIT = true;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(value, event);
                    }
                  },
                  pressEnter: function () {
                    var _pressEnter = (0, _asyncToGenerator2.default)( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(e) {
                      var res;
                      return regeneratorRuntime.wrap(function _callee3$(_context3) {
                        while (1) {
                          switch (_context3.prev = _context3.next) {
                            case 0:
                              res = true;

                              if (!(itemRender.on && itemRender.on.keydown)) {
                                _context3.next = 5;
                                break;
                              }

                              _context3.next = 4;
                              return itemRender.on.pressEnter(e, event);

                            case 4:
                              res = _context3.sent;

                            case 5:
                              if (res) {
                                that.nextItemFocus(event);
                              }

                            case 6:
                            case "end":
                              return _context3.stop();
                          }
                        }
                      }, _callee3);
                    }));

                    function pressEnter(_x3) {
                      return _pressEnter.apply(this, arguments);
                    }

                    return pressEnter;
                  }()
                })
              })]));
              break;

            case "a-select":
              optionsField = props && props.optionsField || "";
              options = optionsField ? row[optionsField] : that.editOptions[field];

              if (props.optionsFilter) {
                options = props.optionsFilter((0, _lodash.cloneDeep)(options), props.value, event);
                delete props.optionsFilter;
              }

              element = h(_select.default, (0, _babelHelperVueJsxMergeProps.default)([{}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, attr), {}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({
                  showSearch: true
                }, props), {}, {
                  options: options
                }),
                style: (0, _objectSpread2.default)({
                  width: "100%"
                }, attr.style),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ons), {}, {
                  change: function change(value, option, pOption) {
                    _utils.default.setObjData(field, row, value);

                    row.ISEDIT = true;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(value, option, event, pOption);
                    }
                  },
                  inputKeydown: function () {
                    var _inputKeydown = (0, _asyncToGenerator2.default)( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(e) {
                      var res;
                      return regeneratorRuntime.wrap(function _callee4$(_context4) {
                        while (1) {
                          switch (_context4.prev = _context4.next) {
                            case 0:
                              res = true;

                              if (!(itemRender.on && itemRender.on.keydown)) {
                                _context4.next = 5;
                                break;
                              }

                              _context4.next = 4;
                              return itemRender.on.inputKeydown(e, event);

                            case 4:
                              res = _context4.sent;

                            case 5:
                              if (res && e.keyCode == 13) {
                                that.nextItemFocus(event);
                              }

                            case 6:
                            case "end":
                              return _context4.stop();
                          }
                        }
                      }, _callee4);
                    }));

                    function inputKeydown(_x4) {
                      return _inputKeydown.apply(this, arguments);
                    }

                    return inputKeydown;
                  }()
                })
              })]));
              break;

            case "a-auto-complete":
              optionsField = props && props.optionsField || "";
              options = optionsField ? row[optionsField] : that.editOptions[field];

              if (props.optionsFilter) {
                options = props.optionsFilter((0, _lodash.cloneDeep)(options), props.value, event);
                delete props.optionsFilter;
              }

              element = h(_autoComplete.default, (0, _babelHelperVueJsxMergeProps.default)([{}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, attr), {}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
                  options: options
                }),
                style: (0, _objectSpread2.default)({
                  width: "100%"
                }, itemRender.style),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ons), {}, {
                  select: function select(value, optionRow) {
                    _utils.default.setObjData(field, row, props.valueField ? optionRow[props.valueField] : value);

                    row.ISEDIT = true;

                    if (itemRender.on && itemRender.on.select) {
                      itemRender.on.select(value, optionRow, event);
                    }
                  },
                  inputPressEnter: function () {
                    var _inputPressEnter = (0, _asyncToGenerator2.default)( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(e) {
                      var res;
                      return regeneratorRuntime.wrap(function _callee5$(_context5) {
                        while (1) {
                          switch (_context5.prev = _context5.next) {
                            case 0:
                              res = true;

                              if (!(itemRender.on && itemRender.on.keydown)) {
                                _context5.next = 5;
                                break;
                              }

                              _context5.next = 4;
                              return itemRender.on.inputPressEnter(e, event);

                            case 4:
                              res = _context5.sent;

                            case 5:
                              if (res) {
                                that.nextItemFocus(event);
                              }

                            case 6:
                            case "end":
                              return _context5.stop();
                          }
                        }
                      }, _callee5);
                    }));

                    function inputPressEnter(_x5) {
                      return _inputPressEnter.apply(this, arguments);
                    }

                    return inputPressEnter;
                  }()
                })
              })]));
              break;

            case "a-date-picker":
              var dateValue = !props.value ? null : props.value.format ? props.value : (0, _moment.default)(props.value);
              element = h(_datePicker.default, (0, _babelHelperVueJsxMergeProps.default)([{}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, attr), {}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
                  value: dateValue
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ons), {}, {
                  inputPressEnter: function () {
                    var _inputPressEnter2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(e) {
                      var res;
                      return regeneratorRuntime.wrap(function _callee6$(_context6) {
                        while (1) {
                          switch (_context6.prev = _context6.next) {
                            case 0:
                              res = true;

                              if (!(itemRender.on && itemRender.on.keydown)) {
                                _context6.next = 5;
                                break;
                              }

                              _context6.next = 4;
                              return itemRender.on.inputPressEnter(e, event);

                            case 4:
                              res = _context6.sent;

                            case 5:
                              if (res) {
                                that.nextItemFocus(event);
                              }

                            case 6:
                            case "end":
                              return _context6.stop();
                          }
                        }
                      }, _callee6);
                    }));

                    function inputPressEnter(_x6) {
                      return _inputPressEnter2.apply(this, arguments);
                    }

                    return inputPressEnter;
                  }()
                })
              })]));
              break;

            case "a-time-picker":
              element = h(_timePicker.default, (0, _babelHelperVueJsxMergeProps.default)([{}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, attr), {}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({
                  clearIcon: true
                }, props), {}, {
                  disabled: disabled
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ons), {}, {
                  inputPressEnter: function () {
                    var _inputPressEnter3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/regeneratorRuntime.mark(function _callee7(e) {
                      var res;
                      return regeneratorRuntime.wrap(function _callee7$(_context7) {
                        while (1) {
                          switch (_context7.prev = _context7.next) {
                            case 0:
                              res = true;

                              if (!(itemRender.on && itemRender.on.keydown)) {
                                _context7.next = 5;
                                break;
                              }

                              _context7.next = 4;
                              return itemRender.on.inputPressEnter(e, event);

                            case 4:
                              res = _context7.sent;

                            case 5:
                              if (res) {
                                that.nextItemFocus(event);
                              }

                            case 6:
                            case "end":
                              return _context7.stop();
                          }
                        }
                      }, _callee7);
                    }));

                    function inputPressEnter(_x7) {
                      return _inputPressEnter3.apply(this, arguments);
                    }

                    return inputPressEnter;
                  }()
                })
              })]));
              break;

            case "pulldown-table":
              element = h("pulldown-table", (0, _babelHelperVueJsxMergeProps.default)([{}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, attr), {}, {
                props: (0, _objectSpread2.default)({}, props),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ons), {}, {
                  inputPressEnter: function () {
                    var _inputPressEnter4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(e) {
                      var res;
                      return regeneratorRuntime.wrap(function _callee8$(_context8) {
                        while (1) {
                          switch (_context8.prev = _context8.next) {
                            case 0:
                              res = true;

                              if (!(itemRender.on && itemRender.on.keydown)) {
                                _context8.next = 5;
                                break;
                              }

                              _context8.next = 4;
                              return itemRender.on.inputPressEnter(e, event);

                            case 4:
                              res = _context8.sent;

                            case 5:
                              if (res) {
                                that.nextItemFocus(event);
                              }

                            case 6:
                            case "end":
                              return _context8.stop();
                          }
                        }
                      }, _callee8);
                    }));

                    function inputPressEnter(_x8) {
                      return _inputPressEnter4.apply(this, arguments);
                    }

                    return inputPressEnter;
                  }()
                })
              })]));
              break;

            case "a-switch":
              trueValue = props.trueValue ? props.trueValue : true;
              falseValue = props.falseValue ? props.falseValue : false;
              if (editSlotPropInit(row, props, "hidden", field)) return "";
              element = h("a-switch", (0, _babelHelperVueJsxMergeProps.default)([{}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, attr), {}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
                  checked: row[field] == trueValue
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ons), {}, {
                  change: function change(e) {
                    var value = e ? trueValue : falseValue;

                    _utils.default.setObjData(field, row, value);

                    row.ISEDIT = true;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(e, event);
                    }
                  }
                })
              })]));
              break;

            case "a-checkbox":
              trueValue = props.trueValue ? props.trueValue : true;
              falseValue = props.falseValue ? props.falseValue : false;
              if (editSlotPropInit(row, props, "hidden", field)) return "";
              element = h("a-checkbox", (0, _babelHelperVueJsxMergeProps.default)([{}, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, attr), {}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
                  checked: row[field] == trueValue
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, ons), {}, {
                  change: function change(e) {
                    var value = e.target.checked ? trueValue : falseValue;

                    _utils.default.setObjData(field, row, value);

                    row.ISEDIT = true;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(e, event);
                    }
                  }
                })
              })]));
              break;
          }
        }

        return [element];
      };
    }
  }
};
var _default = editRender;
exports.default = _default;