"use strict";

var _interopRequireDefault = require("E:/OPU/\u524D\u7AEF\u5F00\u53D1\u9879\u76EE/opu-components-vue/node_modules/@babel/runtime/helpers/interopRequireDefault").default;

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

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

var _objectSpread2 = _interopRequireDefault(require("E:/OPU/\u524D\u7AEF\u5F00\u53D1\u9879\u76EE/opu-components-vue/node_modules/@babel/runtime/helpers/esm/objectSpread2"));

var _typeof2 = _interopRequireDefault(require("E:/OPU/\u524D\u7AEF\u5F00\u53D1\u9879\u76EE/opu-components-vue/node_modules/@babel/runtime/helpers/esm/typeof"));

var _toConsumableArray2 = _interopRequireDefault(require("E:/OPU/\u524D\u7AEF\u5F00\u53D1\u9879\u76EE/opu-components-vue/node_modules/@babel/runtime/helpers/esm/toConsumableArray"));

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.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.array.find-index.js");

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

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

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

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

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

var _lodash = require("lodash");

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

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

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

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

  return optionData;
} //编辑插槽 是否禁用


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: {},
  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: ["AInput", "AInputNumber", "ASelect", "AAutoComplete", "ADatePicker", "ATimePicker", "ASwitch", "ACheckbox"],
      editOptions: {},
      editApiList: [],
      editDefaultOption: {}
    };
  },
  computed: {
    editItemSize: function editItemSize() {
      var editSize = this.editSize;

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

      return editSize;
    }
  },
  methods: {
    // 下划线转换驼峰
    toHump: function toHump(name) {
      // eslint-disable-next-line no-useless-escape
      name = name.replace(/\-(\w)/g, function (all, letter) {
        return letter.toUpperCase();
      });
      return name.charAt(0).toUpperCase() + name.slice(1);
    },
    // 驼峰转换下划线
    toLine: function toLine(name) {
      return name.replace(/([A-Z])/g, "-$1").toLowerCase();
    },
    setEditOptions: function setEditOptions(data) {
      var editOptions = this.editOptions;

      for (var key in data) {
        var item = data[key];
        editOptions[key] = item;
      }

      this.editOptions = editOptions;
      this.$refs.dataGrid.updateData();
    },
    getEditOptions: function getEditOptions() {
      return this.editOptions;
    },
    getEditDefaultOption: function getEditDefaultOption() {
      return this.editDefaultOption;
    },
    editColumnsRender: function editColumnsRender(data, filterCallback) {
      var _this = this;

      var h = this.$createElement;
      var editType = this.editType,
          editOptions = this.editOptions,
          toHump = this.toHump,
          editDefaultOption = this.editDefaultOption;
      var apiList = [];
      var getSelectOptions = _conf.default.getSelectOptions;
      data = data.filter(function (p) {
        if (filterCallback && !filterCallback(p)) {
          return false;
        }

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

          if (editType.indexOf(toHump(p.itemRender.name || editType[0])) > -1) {
            if (!p.slots) p.slots = {};

            p.slots.default = function (_ref) {
              var row = _ref.row,
                  rowIndex = _ref.rowIndex,
                  $columnIndex = _ref.$columnIndex;
              return [h("div", {
                "style": "display:flex;align-items: center;"
              }, [p.itemRender.before && p.itemRender.before({
                row: row,
                rowIndex: rowIndex,
                $columnIndex: $columnIndex
              }), h("div", {
                "style": "flex:1"
              }, [_this.editSlotRender(name)({
                row: row,
                rowIndex: rowIndex,
                $columnIndex: $columnIndex
              })]), p.itemRender.after && p.itemRender.after({
                row: row,
                rowIndex: rowIndex,
                $columnIndex: $columnIndex
              })])];
            };

            if (name == "ASwitch" || name == "ACheckbox") p.align = "center";
            var props = p.itemRender.props || {};

            if (["ASelect", "AAutoComplete"].includes(name) && p.itemRender.props) {
              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;

              if (p.itemRender.props.options) {
                editOptions[p.field] = (0, _lodash.cloneDeep)(p.itemRender.props.options).map(function (o) {
                  if (o.value && !o[_conf.default.originalValueKey]) {
                    o[_conf.default.originalValueKey] = o.value;
                  }

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

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

                  if (o[childrenField] != "children") {
                    o.children = o[childrenField];
                  }

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

                  return o;
                });
              } else if (!p.itemRender.props.optionsField && !editOptions[p.field] && (props.api || props.dataField || props.param)) {
                apiList.push({
                  field: p.field,
                  api: props.api || getSelectOptions.api,
                  valueField: valueField,
                  labelField: labelField,
                  childrenField: childrenField,
                  dataField: dataField,
                  defaultField: defaultField,
                  param: props.param || {}
                });
              }
            }
          }
        }

        return true;
      });
      this.editDefaultOption = editDefaultOption;
      this.editOptions = editOptions;
      this.editApiList = apiList;
      this.fetchItemPropsOptionsApiList();
      return data;
    },
    fetchItemPropsOptionsApiList: function fetchItemPropsOptionsApiList() {
      var that = this;
      var onEditOptionsLoadBefore = that.onEditOptionsLoadBefore,
          list = that.editApiList;

      if (onEditOptionsLoadBefore) {
        var beforeRes = onEditOptionsLoadBefore(list);

        if (beforeRes === false) {
          return false;
        } else if (beforeRes) {
          list = beforeRes;
        }
      }

      var 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 valueField = item.valueField,
              labelField = item.labelField,
              childrenField = item.childrenField,
              defaultField = item.defaultField; // 字段单独配置api的可选数据的处理

          var optionsData = handlefieldOptionsDataField(item, res[index], that);
          editOptions[item.field] = optionsData.map(function (p) {
            if (p.value && !p[_conf.default.originalValueKey]) {
              p[_conf.default.originalValueKey] = p.value;
            }

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

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

            if (p[childrenField] != "children") {
              p.children = p[childrenField];
            }

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

            return p;
          });
        });

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

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

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

        that.$refs.dataGrid.updateData();
      }).catch(function () {});
    },
    selectFilterRender: function selectFilterRender(props) {
      var getSelectOptions = _conf.default.getSelectOptions;
      var valueField = props.valueField || getSelectOptions.valueField;
      var labelField = props.labelField || getSelectOptions.labelField;
      var searchFields = props.searchFields || _conf.default.defaultProps.select.searchFields || [];

      if (props.showSearch && !props.filterOption) {
        var optionsData = props.options || [];

        props.filterOption = function (input, option) {
          var value = option.componentOptions.propsData.value;
          var objIndex = optionsData.findIndex(function (p) {
            return p[valueField].toString() === value;
          });
          var obj = optionsData[objIndex];
          var is = false;
          var searchFieldList = [labelField].concat((0, _toConsumableArray2.default)(searchFields)); // vF,

          for (var i = 0; i < searchFieldList.length; i++) {
            var key = searchFieldList[i];

            if (obj[key]) {
              if (obj[key].toString().toLowerCase().indexOf(input.toLowerCase()) >= 0) {
                is = true;
                break;
              }
            }
          }

          return is;
        };
      }

      return props;
    },
    autoCompleteFilterRender: function autoCompleteFilterRender(props, row) {
      var h = this.$createElement;
      var getSelectOptions = _conf.default.getSelectOptions;
      var value = props.value;
      var dataSource = props.dataSource;
      delete props.dataSource;
      var valueField = props.valueField || getSelectOptions.labelField;
      var labelField = props.labelField || getSelectOptions.labelField;

      if (props.search) {
        dataSource = props.search(value, dataSource, row);
      } else {
        var searchFields = props.searchFields || [];
        dataSource = dataSource.filter(function (p) {
          if (!value) return true;
          var is = false;

          if (Object.prototype.toString.call(p) === "[object Object]") {
            var searchFieldList = [labelField].concat((0, _toConsumableArray2.default)(searchFields)); // vF,

            for (var i = 0; i < searchFieldList.length; i++) {
              var key = searchFieldList[i];
              var optionValue = p[key] || p;

              if (value) {
                if (optionValue.toString().toLowerCase().indexOf(value.toLowerCase()) >= 0) {
                  is = true;
                  break;
                }
              }
            }
          } else if (p.toString().toLowerCase().indexOf(value.toLowerCase()) >= 0) {
            is = true;
          }

          return is;
        });
      }

      var selectOptions = dataSource.map(function (p) {
        return h("a-select-option", {
          "key": p[valueField] || p
        }, [p[labelField] || p]);
      });
      return {
        props: props,
        selectOptions: selectOptions,
        dataSource: dataSource,
        valueField: valueField,
        labelField: labelField
      };
    },
    findOptionRow: function findOptionRow(options, value, valueField) {
      return options.find(function (p) {
        return p[valueField] == value;
      }) || {};
    },
    editSlotRender: function editSlotRender(name) {
      var _this2 = this;

      var h = this.$createElement;
      var slot;

      switch (name) {
        case "AInput":
          slot = function slot(_ref2) {
            var row = _ref2.row,
                rowIndex = _ref2.rowIndex,
                $columnIndex = _ref2.$columnIndex;
            var item = _this2.tableColumns[$columnIndex];
            var itemRender = item.itemRender || {};
            var props = item.itemRender.props || {};
            var disabled = editSlotPropInit(row, props, "disabled", item.field);

            if ((0, _typeof2.default)(disabled) == "object") {
              return [disabled];
            } else {
              return [h("a-input", (0, _babelHelperVueJsxMergeProps.default)([{}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({
                  size: _this2.editItemSize
                }, props), {}, {
                  value: row[item.field],
                  disabled: disabled
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemRender.on), {}, {
                  change: function change(e) {
                    var value = e.target.value;
                    row[item.field] = value;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  },
                  blur: function blur(e) {
                    if (itemRender.on && itemRender.on.blur) {
                      itemRender.on.blur(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  },
                  keydown: function keydown(e) {
                    if (itemRender.on && itemRender.on.keydown) {
                      itemRender.on.keydown(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  }
                }),
                style: (0, _objectSpread2.default)({}, itemRender.style)
              }]))];
            }
          };

          break;

        case "AInputNumber":
          slot = function slot(_ref3) {
            var row = _ref3.row,
                rowIndex = _ref3.rowIndex,
                $columnIndex = _ref3.$columnIndex;
            var item = _this2.tableColumns[$columnIndex];
            var itemRender = item.itemRender || {};
            var props = item.itemRender.props || {};
            var disabled = editSlotPropInit(row, props, "disabled", item.field);

            if ((0, _typeof2.default)(disabled) == "object") {
              return [disabled];
            } else {
              return [h("a-input-number", (0, _babelHelperVueJsxMergeProps.default)([{}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({
                  size: _this2.editItemSize
                }, props), {}, {
                  value: row[item.field],
                  disabled: disabled,
                  max: editSlotPropInit(row, props, "max", item.field, Infinity),
                  min: editSlotPropInit(row, props, "min", item.field, -Infinity)
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemRender.on), {}, {
                  change: function change(e) {
                    var value = e;
                    row[item.field] = value;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(value, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  },
                  blur: function blur(e) {
                    if (itemRender.on && itemRender.on.blur) {
                      itemRender.on.blur(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  }
                }),
                style: (0, _objectSpread2.default)({}, itemRender.style)
              }]))];
            }
          };

          break;

        case "ASelect":
          slot = function slot(_ref4) {
            var row = _ref4.row,
                rowIndex = _ref4.rowIndex,
                $columnIndex = _ref4.$columnIndex;
            var item = _this2.tableColumns[$columnIndex];
            var itemRender = item.itemRender || {};
            var props = item.itemRender.props || {};
            var optionsField = props && props.optionsField || "";
            var disabled = editSlotPropInit(row, props, "disabled", item.field);

            if ((0, _typeof2.default)(disabled) == "object") {
              return [disabled];
            } else {
              var value = row[item.field];
              var options = optionsField ? row[optionsField] : _this2.editOptions[item.field];

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

              props = _this2.selectFilterRender((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
                size: _this2.editItemSize
              }, _conf.default.defaultProps.select), itemRender.props), {}, {
                value: value,
                options: options,
                disabled: disabled
              }));
              return [h("a-select", (0, _babelHelperVueJsxMergeProps.default)([{}, {
                props: props,
                style: (0, _objectSpread2.default)({
                  width: "100%"
                }, itemRender.style),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemRender.on), {}, {
                  change: function change(value, option) {
                    row[item.field] = value;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(value, option, {
                        row: row,
                        rowIndex: rowIndex,
                        options: options,
                        field: item.field
                      });
                    }
                  },
                  blur: function blur(e) {
                    if (itemRender.on && itemRender.on.blur) {
                      itemRender.on.blur(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  }
                })
              }]))];
            }
          };

          break;

        case "AAutoComplete":
          slot = function slot(_ref5) {
            var row = _ref5.row,
                rowIndex = _ref5.rowIndex,
                $columnIndex = _ref5.$columnIndex;
            var item = _this2.tableColumns[$columnIndex];
            var itemRender = item.itemRender || {};
            var props = item.itemRender.props || {};
            var optionsField = props && props.optionsField || "";
            var options = optionsField ? row[optionsField] : _this2.editOptions[item.field];
            var disabled = editSlotPropInit(row, props, "disabled", item.field);

            if ((0, _typeof2.default)(disabled) == "object") {
              return [disabled];
            } else {
              var value = row[item.field];

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

              var filterData = _this2.autoCompleteFilterRender((0, _objectSpread2.default)((0, _objectSpread2.default)({
                size: _this2.editItemSize
              }, itemRender.props), {}, {
                value: value,
                dataSource: options || [],
                disabled: disabled
              }), row);

              var selectOptions = filterData.selectOptions;
              var dataSource = filterData.dataSource;
              props = filterData.props;
              return [h("a-auto-complete", (0, _babelHelperVueJsxMergeProps.default)([{}, {
                props: props,
                style: (0, _objectSpread2.default)({
                  width: "100%"
                }, itemRender.style),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemRender.on), {}, {
                  change: function change(value) {
                    row[item.field] = value;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(value, row, item.field);
                    }
                  },
                  select: function select(value) {
                    var optionRow = _this2.findOptionRow(dataSource, value, filterData.valueField);

                    row[item.field] = optionRow[filterData.labelField] || value;

                    if (itemRender.on && itemRender.on.select) {
                      itemRender.on.select(value, optionRow, {
                        row: row,
                        rowIndex: rowIndex,
                        dataSource: dataSource,
                        field: item.field
                      });
                    }
                  },
                  blur: function blur(e) {
                    if (itemRender.on && itemRender.on.blur) {
                      itemRender.on.blur(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  }
                })
              }]), [h("template", (0, _babelHelperVueJsxMergeProps.default)([{}, {
                slot: "dataSource"
              }]), [selectOptions])])];
            }
          };

          break;

        case "ADatePicker":
          slot = function slot(_ref6) {
            var row = _ref6.row,
                rowIndex = _ref6.rowIndex,
                $columnIndex = _ref6.$columnIndex;
            var item = _this2.tableColumns[$columnIndex];
            var itemRender = item.itemRender || {};
            var props = item.itemRender.props || {};
            var disabled = editSlotPropInit(row, props, "disabled", item.field);

            if ((0, _typeof2.default)(disabled) == "object") {
              return [disabled];
            } else {
              return [h("a-date-picker", (0, _babelHelperVueJsxMergeProps.default)([{}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({
                  size: _this2.editItemSize
                }, itemRender.props), {}, {
                  value: !row[item.field] ? null : row[item.field].format ? row[item.field] : (0, _moment.default)(row[item.field]),
                  disabled: disabled
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemRender.on), {}, {
                  change: function change(e) {
                    var value = e;
                    row[item.field] = value;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  },
                  blur: function blur(e) {
                    if (itemRender.on && itemRender.on.blur) {
                      itemRender.on.blur(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  }
                }),
                style: (0, _objectSpread2.default)({}, itemRender.style)
              }]))];
            }
          };

          break;

        case "ATimePicker":
          slot = function slot(_ref7) {
            var row = _ref7.row,
                rowIndex = _ref7.rowIndex,
                $columnIndex = _ref7.$columnIndex;
            var item = _this2.tableColumns[$columnIndex];
            var itemRender = item.itemRender || {};
            var props = item.itemRender.props || {};
            var disabled = editSlotPropInit(row, props, "disabled", item.field);

            if ((0, _typeof2.default)(disabled) == "object") {
              return [disabled];
            } else {
              return [h("a-time-picker", (0, _babelHelperVueJsxMergeProps.default)([{}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({
                  size: _this2.editItemSize,
                  clearIcon: true
                }, itemRender.props), {}, {
                  value: row[item.field],
                  disabled: disabled
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item.on), {}, {
                  change: function change(e) {
                    var value = e;
                    row[item.field] = value;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  },
                  blur: function blur(e) {
                    if (itemRender.on && itemRender.on.blur) {
                      itemRender.on.blur(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  }
                }),
                style: (0, _objectSpread2.default)({}, itemRender.style)
              }]))];
            }
          };

          break;

        case "ASwitch":
          slot = function slot(_ref8) {
            var row = _ref8.row,
                rowIndex = _ref8.rowIndex,
                $columnIndex = _ref8.$columnIndex;
            var item = _this2.tableColumns[$columnIndex];
            var itemRender = item.itemRender || {};
            var props = item.itemRender.props || {};
            var trueValue = props.trueValue ? props.trueValue : true;
            var falseValue = props.falseValue ? props.falseValue : false;
            if (editSlotPropInit(row, props, "hidden", item.field)) return "";
            var disabled = editSlotPropInit(row, props, "disabled", item.field);

            if ((0, _typeof2.default)(disabled) == "object") {
              return [disabled];
            } else {
              return [h("a-switch", (0, _babelHelperVueJsxMergeProps.default)([{}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({
                  size: _this2.editItemSize
                }, itemRender.props), {}, {
                  checked: row[item.field] == trueValue,
                  disabled: disabled
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item.on), {}, {
                  change: function change(e) {
                    var value = e ? trueValue : falseValue;
                    row[item.field] = value;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  },
                  blur: function blur(e) {
                    if (itemRender.on && itemRender.on.blur) {
                      itemRender.on.blur(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  }
                }),
                style: (0, _objectSpread2.default)({}, itemRender.style)
              }]))];
            }
          };

          break;

        case "ACheckbox":
          slot = function slot(_ref9) {
            var row = _ref9.row,
                rowIndex = _ref9.rowIndex,
                $columnIndex = _ref9.$columnIndex;
            var item = _this2.tableColumns[$columnIndex];
            var itemRender = item.itemRender || {};
            var props = item.itemRender.props || {};
            var trueValue = props.trueValue ? props.trueValue : true;
            var falseValue = props.falseValue ? props.falseValue : false;
            if (editSlotPropInit(row, props, "hidden", item.field)) return "";
            var disabled = editSlotPropInit(row, props, "disabled", item.field);

            if ((0, _typeof2.default)(disabled) == "object") {
              return [disabled];
            } else {
              return [h("a-checkbox", (0, _babelHelperVueJsxMergeProps.default)([{}, {
                props: (0, _objectSpread2.default)((0, _objectSpread2.default)({
                  size: _this2.editItemSize
                }, itemRender.props), {}, {
                  checked: row[item.field] == trueValue,
                  disabled: disabled
                }),
                on: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item.on), {}, {
                  change: function change(e) {
                    var value = e.target.checked ? trueValue : falseValue;
                    row[item.field] = value;

                    if (itemRender.on && itemRender.on.change) {
                      itemRender.on.change(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  },
                  blur: function blur(e) {
                    if (itemRender.on && itemRender.on.blur) {
                      itemRender.on.blur(e, {
                        row: row,
                        rowIndex: rowIndex,
                        field: item.field
                      });
                    }
                  }
                }),
                style: (0, _objectSpread2.default)({}, itemRender.style)
              }]))];
            }
          };

          break;
      }

      return slot;
    }
  }
};
var _default = editRender;
exports.default = _default;