"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _locale = require("../../src/locale");
var _loopData = _interopRequireDefault(require("../_com-props/loopData"));
var _setters = require("../_setters");
var _snippets = _interopRequireDefault(require("./snippets"));
var _formKeyType = require("../_utils/formKeyType");
var _schemaService = require("../_utils/schemaService");
var _componentKey = _interopRequireDefault(require("../_com-props/componentKey"));
var _componentName = _interopRequireDefault(require("../_com-props/componentName"));
var _type = require("../_setters/cGroupManage-setter/type");
var schemaService = new _schemaService.SchemaService();
var _default = exports["default"] = {
  snippets: _snippets["default"],
  componentName: 'LoopBox',
  group: (0, _locale.t)('loop-box.key_s5YrGwKlmn9K'),
  title: (0, _locale.t)('loop-box.key_siQx85hXtMfC'),
  category: (0, _locale.t)('loop-box.key_bn4LnpfQBhcX'),
  props: [_loopData["default"], _componentKey["default"], _componentName["default"], {
    name: "moveUpChildrenStyle",
    title: {
      label: (0, _locale.t)("loop-box.key_s5YrGwKlmn1K"),
      tip: (0, _locale.t)("loop-box.key_s5YrGwKlmn2K")
    },
    propType: "bool",
    setter: "BoolSetter",
    defaultValue: false
  }, {
    name: "noWalletConnect",
    title: {
      label: (0, _locale.t)("loop-box.key_s5YrGwKlmn8K"),
      tip: (0, _locale.t)("loop-box.key_s5YrGwKlmn7K")
    },
    propType: "bool",
    setter: "BoolSetter",
    defaultValue: false
  }, {
    name: "hiddenScroll",
    title: {
      label: (0, _locale.t)('loop-box.hiddenScroll'),
      tip: (0, _locale.t)('loop-box.hiddenScroll')
    },
    setter: 'BoolSetter',
    defaultValue: false
  }, {
    name: 'mode',
    title: {
      label: (0, _locale.t)('loop-box.mode'),
      tip: (0, _locale.t)('loop-box.modeTip')
    },
    propType: {
      type: 'oneOf',
      value: [_type.groupModeType.none, _type.groupModeType.single, _type.groupModeType.multipleChoice]
    },
    defaultValue: _type.groupModeType.none,
    setter: [{
      componentName: 'RadioGroupSetter',
      props: {
        options: [{
          title: (0, _locale.t)('loop-box.none'),
          value: _type.groupModeType.none
        }, {
          title: (0, _locale.t)('loop-box.single'),
          value: _type.groupModeType.single
        }, {
          title: (0, _locale.t)('loop-box.multipleChoice'),
          value: _type.groupModeType.multipleChoice
        }]
      }
    }, 'VariableSetter']
  }, {
    name: 'multipleNumber',
    title: {
      label: (0, _locale.t)('loop-box.multipleNumber'),
      tip: (0, _locale.t)('loop-box.multipleNumberTip')
    },
    setter: [{
      componentName: 'NumberSetter',
      initialValue: 10,
      props: {
        min: 0,
        placeholder: "请输入"
      }
    }],
    condition: function condition(target) {
      return target.getProps().getPropValue('mode') === _type.groupModeType.multipleChoice;
    }
  }, {
    name: 'selectFirst',
    title: {
      label: (0, _locale.t)('loop-box.selectFirst'),
      tip: (0, _locale.t)('loop-box.selectFirstTip')
    },
    propType: 'bool',
    setter: 'BoolSetter',
    defaultValue: false,
    condition: function condition(target) {
      var mode = target.getProps().getPropValue('mode');
      return mode === _type.groupModeType.multipleChoice || mode === _type.groupModeType.single;
    }
  }, {
    name: 'dataSourceConfig',
    title: (0, _locale.t)('loop-box.key_PLbJownRQiBE'),
    display: 'accordion',
    setter: _setters.CLoopDataSetter,
    supportVariable: true
  }, {
    type: 'field',
    name: 'paginationProps',
    title: (0, _locale.t)('loop-box.key_nP1VFMVjGr9K'),
    condition: function condition(target) {
      var dataSourceConfig = target.getProps().getPropValue('dataSourceConfig');
      return dataSourceConfig && dataSourceConfig.type === _formKeyType.DataSourceType.dataSourceType;
    },
    extraProps: {
      display: 'accordion',
      defaultCollapsed: true
    },
    setter: {
      componentName: 'ObjectSetter',
      display: 'inline',
      props: {
        config: {
          items: [{
            type: 'field',
            name: 'visible',
            title: (0, _locale.t)('loop-box.key_9Ko0HL10R0ac'),
            setter: [{
              componentName: 'RadioGroupSetter',
              props: {
                defaultValue: false,
                options: [{
                  label: (0, _locale.t)('loop-box.key_x6cA8g037R4i'),
                  value: false
                }, {
                  label: (0, _locale.t)('loop-box.key_56Q97e9u6U3z'),
                  value: 'page'
                }, {
                  label: (0, _locale.t)('loop-box.key_5r6542t5e3Q'),
                  value: 'foot'
                }]
              }
            }]
          }, {
            name: 'pageSize',
            title: (0, _locale.t)('loop-box.key_hS5USP97nIJw'),
            setter: [{
              componentName: 'NumberSetter',
              initialValue: 10,
              props: {
                min: 1
              }
            }]
          }, {
            name: 'size',
            title: (0, _locale.t)('loop-box.key_lXlsoPbI5NCH'),
            setter: [{
              componentName: 'SelectSetter',
              initialValue: "medium",
              props: {
                options: [{
                  title: 'small',
                  value: "small"
                }, {
                  title: 'medium',
                  value: 'medium'
                }, {
                  title: 'large',
                  value: 'large'
                }]
              }
            }],
            condition: function condition(target) {
              var paginationProps = target.getProps().getPropValue('paginationProps');
              return paginationProps.visible === 'page';
            }
          }, {
            name: 'type',
            title: (0, _locale.t)('loop-box.key_vDtn7DD6I0Im'),
            setter: [{
              componentName: 'SelectSetter',
              initialValue: "normal",
              props: {
                options: [{
                  title: 'normal',
                  value: 'normal'
                }, {
                  title: 'simple',
                  value: "simple"
                }, {
                  title: 'mini',
                  value: "mini"
                }]
              }
            }],
            condition: function condition(target) {
              var paginationProps = target.getProps().getPropValue('paginationProps');
              return paginationProps.visible === 'page';
            }
          }]
        }
      }
    }
  }, {
    type: 'field',
    name: 'paginationStyle',
    title: (0, _locale.t)('loop-box.key_jh7laTfw9qyG'),
    extraProps: {
      display: 'accordion',
      defaultCollapsed: true
    },
    condition: function condition(target) {
      var paginationProps = target.getProps().getPropValue('paginationProps');
      var dataSourceConfig = target.getProps().getPropValue('dataSourceConfig');
      return paginationProps.visible === 'page' && dataSourceConfig && dataSourceConfig.type === _formKeyType.DataSourceType.dataSourceType;
    },
    setter: {
      componentName: 'ObjectSetter',
      display: 'inline',
      props: {
        config: {
          items: [{
            name: 'itemBg',
            title: {
              label: (0, _locale.t)('loop-box.key_V6nWBfpJMEOu'),
              tip: (0, _locale.t)('loop-box.key_eilnd7S8NwVq')
            },
            setter: 'ColorSetter'
          }, {
            name: 'itemBc',
            title: {
              label: (0, _locale.t)('loop-box.key_jomU17pshIdC'),
              tip: (0, _locale.t)('loop-box.key_HXRFoZC8jynH')
            },
            setter: 'ColorSetter'
          }, {
            name: 'itemText',
            title: {
              label: (0, _locale.t)('loop-box.key_4VkdQBRJgbta'),
              tip: (0, _locale.t)('loop-box.key_csSEyuLr7yMC')
            },
            setter: 'ColorSetter'
          }, {
            name: 'itemActiveBg',
            title: {
              label: (0, _locale.t)('loop-box.key_9ggfzlAaj6Lw'),
              tip: (0, _locale.t)('loop-box.key_nu3P44dXVW3E')
            },
            setter: 'ColorSetter'
          }, {
            name: 'itemActiveBc',
            title: {
              label: (0, _locale.t)('loop-box.key_p9ht6lQknozO'),
              tip: (0, _locale.t)('loop-box.key_kyDGloaHor5n')
            },
            setter: 'ColorSetter'
          }, {
            name: 'itemActiveText',
            title: {
              label: (0, _locale.t)('loop-box.key_E2grVtzHSHIq'),
              tip: (0, _locale.t)('loop-box.key_TI6BDsW0gMYb')
            },
            setter: 'ColorSetter'
          }]
        }
      }
    }
  }, {
    name: 'paginationBoxStyle',
    title: (0, _locale.t)('loop-box.key_H4vJ2CVaV5fi'),
    type: 'group',
    extraProps: {
      display: 'entry'
    },
    condition: function condition(target) {
      var paginationProps = target.getProps().getPropValue('paginationProps');
      var dataSourceConfig = target.getProps().getPropValue('dataSourceConfig');
      return paginationProps.visible === 'page' && dataSourceConfig && dataSourceConfig.type === _formKeyType.DataSourceType.dataSourceType;
    },
    items: [{
      name: 'paginationBoxStyle',
      title: {
        label: (0, _locale.t)('loop-box.key_YioMrF8yW7JK'),
        tip: 'paginationBoxStyle | paginationBoxStyle'
      },
      setter: 'CStyleSetter',
      extraProps: {
        display: 'block'
      }
    }]
  }, {
    name: 'noDataContent',
    title: {
      label: (0, _locale.t)('loop-box.noDataContext'),
      tip: (0, _locale.t)('loop-box.noDataContext')
    },
    isRequired: true,
    propType: 'string',
    setter: 'StringSetter',
    defaultValue: function defaultValue() {
      return "No Data";
    },
    supportVariable: false
  }, {
    name: 'noDataContentBoxStyle',
    title: (0, _locale.t)('loop-box.noDataContextBoxStyle'),
    type: 'group',
    extraProps: {
      display: 'entry'
    },
    items: [{
      name: 'noDataContentBoxStyle',
      title: {
        label: (0, _locale.t)('loop-box.noDataContextBoxStyle'),
        tip: 'noDataContextBoxStyle | noDataContextBoxStyle'
      },
      setter: 'CStyleSetter',
      extraProps: {
        display: 'block'
      }
    }]
  }],
  configure: {
    component: {
      isContainer: true
    },
    supports: {
      events: false,
      style: true,
      "loop": false,
      "condition": false
    },
    advanced: {
      callbacks: {
        // onNodeAdd: (dragNode: any, currentNode: any) => {
        //   setTimeout(() => {
        //     schemaService.handleLoopBoxComponent(dragNode, currentNode)
        //   }, 1)
        // },
      }
    }
  }
};