"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.initMap = exports.getTextInitJson = exports.getBannerNodeJson = exports.getBannerJson = void 0;

var _uuid = require("uuid");

var __assign = void 0 && (void 0).__assign || function () {
  __assign = Object.assign || function (t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];

      for (var p in s) {
        if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
    }

    return t;
  };

  return __assign.apply(this, arguments);
};

/**
 * 获取 text 元组件json
 */
var getMetaTextJson = function getMetaTextJson() {
  return {
    open: false,
    type: 'TEXT',
    text: 'Title',
    specialContent: [],
    content: {
      fontFamily: '',
      size: '',
      fontSize: '',
      width: '' // 文本区域宽度

    },
    underline: {
      open: false,
      borderBottomColor: '',
      borderBottomStyle: '',
      borderBottomWidth: ''
    },
    vertical: {
      open: false,
      lineHeight: '' // 行间距

    }
  };
};
/**
 *
 * 获取 image 元组件json
 */


var getMetaImageJson = function getMetaImageJson() {
  return {
    open: true,
    type: 'IMAGE',
    content: {
      pcImgSrc: '',
      h5ImgSrc: '',
      name: 'image name',
      clickUrl: '' // 图片跳转链接

    },
    hover: {
      open: false,
      backgroundType: 'enlarge',
      magnification: 1,
      pcImgHoverUrl: '',
      h5ImgHoverUrl: ''
    }
  };
};
/**
 *
 * 获取 button 元组件json
 */


var getMetaButtonJson = function getMetaButtonJson() {
  return {
    open: false,
    type: 'BUTTON',
    name: 'Button',
    text: 'Button',
    content: {
      url: '',
      backgroundColor: '#2F54EB' // 按钮颜色

    },
    buttonText: {
      fontFamily: 'st',
      fontStyles: {
        fontStyle: 'normal',
        color: '#fff',
        textAlign: 'left' // 文本对齐方式

      }
    },
    buttonBorder: {
      open: false,
      borderColor: '',
      borderRadius: 0 // 边框圆角

    },
    buttonIcon: {
      iconUrl: '',
      layout: 'right' // 图标位置

    },
    hover: {
      open: false,
      content: {
        backgroundColor: '#051c7b'
      },
      buttonText: {
        fontFamily: 'st',
        fontStyles: {
          fontStyle: 'normal',
          color: '#fff',
          textAlign: 'left'
        }
      },
      buttonBorder: {
        open: false,
        borderColor: '',
        borderRadius: 0
      },
      buttonIcon: {
        iconUrl: '',
        layout: 'right'
      }
    }
  };
};
/**
 * 获取banner组件的初始化json
 */


var getBannerJson = function getBannerJson() {
  return {
    id: (0, _uuid.v4)(),
    type: 'BANNER',
    setting: {
      // 自动轮播
      autoplay: {
        open: false,
        interval: 4 // 滚动事件

      },
      // 切换按钮
      navigation: {
        open: false,
        size: 16,
        hoverSize: 16,
        color: '#384966',
        hoverColor: '#384966' // 悬浮颜色

      },
      // 面板指示点
      dots: {
        open: false,
        color: '#ff',
        hoverColor: '#fff',
        size: 16,
        hoverSize: 16 // 悬浮大小

      }
    },
    groupSource: []
  };
};
/**
 *  获取banner组件节点json, 用于存入banner 的 groupSource中
 */


exports.getBannerJson = getBannerJson;

var getBannerNodeJson = function getBannerNodeJson() {
  return {
    id: (0, _uuid.v4)(),
    image: __assign({}, getMetaImageJson()),
    title: __assign({}, getMetaTextJson()),
    text: __assign({}, getMetaTextJson()),
    button: __assign({}, getMetaButtonJson()),
    secondButton: __assign({}, getMetaButtonJson()),
    customize: {
      layout: 1,
      align: 'left' // 布局对齐方式

    },
    background: {
      opacity: 100,
      color: '#232F46',
      image: '' // 背景图片

    }
  };
};
/**
 * 获取text组件的初始化json
 */


exports.getBannerNodeJson = getBannerNodeJson;

var getTextInitJson = function getTextInitJson() {
  return {
    id: (0, _uuid.v4)(),
    type: 'TEXT',
    setting: {
      layout: 'left',
      title: __assign({
        open: false,
        type: 'TEXT'
      }, getMetaTextJson()),
      subtitle: __assign({
        open: false,
        type: 'TEXT'
      }, getMetaTextJson())
    },
    source: [{
      title: {
        type: 'TEXT'
      },
      content: {
        type: 'TEXT'
      }
    }],
    style: {
      align: 'left',
      backgroundColor: 'red',
      backgroundImage: '../image.png'
    }
  };
};

exports.getTextInitJson = getTextInitJson;
var initMap = {
  TEXT: getTextInitJson,
  BANNER: getBannerJson
};
exports.initMap = initMap;