import _extends from "@babel/runtime/helpers/extends";
// function clamp(value, min, max) {
//   return Math.max(min, Math.min(max, value));
// }

var ColMeta = {
  componentName: 'Col',
  title: '栅格-列',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  group: '基础组件',
  category: '布局类',
  npm: {
    "package": 'kernelsoft-lowcode-material',
    version: '0.1.1-alpha',
    exportName: 'Col',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [{}],
  configure: {
    props: [{
      name: 'span',
      title: {
        label: '占位格数',
        tip: '栅格占位格数'
      },
      propType: 'number',
      setter: {
        componentName: 'NumberSetter',
        props: {
          min: 0,
          max: 24
        }
      }
    }, {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'offset',
          'zh-CN': '偏移量'
        },
        tip: '栅格往左移动格数'
      },
      name: 'offset',
      setter: {
        componentName: 'MixedSetter',
        props: {
          setters: {
            componentName: 'NumberSetter',
            isRequired: false
          }
        },
        isRequired: true
      }
    }, {
      title: {
        label: {
          type: 'i18n',
          'en-US': 'content',
          'zh-CN': '内容'
        }
      },
      name: 'children',
      setter: {
        componentName: 'SlotSetter',
        // props: {
        //   mode: 'node',
        // },
        isRequired: false
      }
    }],
    supports: {
      style: true
    },
    component: {
      isContainer: true,
      nestingRule: {
        // 允许此组件被拖入哪些父组件
        // parentWhitelist: ['Row'],
      }
    }
    // advanced: {
    //   getResizingHandlers: () => {
    //     return ['e'];
    //   },
    //   callbacks: {
    //     onResizeStart: (e, currentNode) => {
    //       const parent = currentNode.parent;
    //       if (parent) {
    //         const parentNode = parent.getDOMNode();
    //         if (parentNode) {
    //           currentNode.parentRect = parentNode.getBoundingClientRect();
    //         }
    //       }
    //       currentNode.beforeSpan = currentNode.getPropValue('span') || 24;
    //       currentNode.startRect = currentNode.getRect();
    //     },
    //     onResize: (e, currentNode) => {
    //       const { deltaX } = e;
    //       const startWidth = currentNode.startRect
    //         ? currentNode.startRect.width
    //         : currentNode.beforeSpan * (currentNode.parentRect.width / 24);
    //       let width = startWidth + deltaX;
    //       if (!currentNode.startRect) {
    //         currentNode.startRect = { width };
    //       }
    //       width = clamp(width, 0, currentNode.parentRect.width);
    //       const allowMoveX = Math.round(width - startWidth); // 实际被允许的x轴移动
    //       currentNode.moveColumn = Math.round(allowMoveX / (currentNode.parentRect.width / 24)); // 计算移动距离所占的列
    //       if (allowMoveX > 0) {
    //         currentNode.moveColumn++;
    //       } else {
    //         currentNode.moveColumn--;
    //       }
    //       currentNode.targetColumn = clamp(currentNode.beforeSpan + currentNode.moveColumn, 1, 24);
    //       // currentNode.setPropValue('span', currentNode.targetColumn);
    //       const dom = currentNode.getDOMNode();
    //       dom.style.width = `${Math.round(width)}px`;
    //       dom.style.flex = 'none';
    //       dom.style.maxWidth = '100%';
    //     },
    //     onResizeEnd: (e, currentNode) => {
    //       currentNode.getDOMNode().style.cssText = '';
    //       currentNode.targetColumn = clamp(currentNode.targetColumn, 1, 24);
    //       currentNode.setPropValue('span', currentNode.targetColumn);
    //     },
    //   },
    // },
  }
};
export default _extends({}, ColMeta);