import snippets from './snippets';

export default {
  snippets,
  componentName: 'PisellCountdown',
  title: '倒计时',
  category: '数据展示',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: '@pisell/materials',
    version: '1.0.1',
    exportName: 'PisellCountdown',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  props: [
    {
      name: 'format',
      title: { label: '格式化倒计时展示', tip: '格式化倒计时展示，参考 dayjs | format' },
      propType: 'string',
    },
    {
      name: 'leftTime',
      title: {
        label: '剩余时间',
        tip: '剩余时间（毫秒）| leftTime',
      },
      propType: 'number',
    },
    {
      name: 'targetDate',
      title: {
        label: '目标时间',
        tip: '目标时间 | targetDate（如果同时传了 leftTime 和 targetDate，则会忽略 targetDate，以 leftTime 为主）',
      },
      propType: { type: "oneOfType", value: ["string", "number"] },
    },
    {
      name: 'interval',
      title: { label: '间隔', tip: '变化时间间隔（毫秒）| interval' },
      propType: 'number',
      defaultValue: 1000
    },
  ],
  configure: {
    supports: {
      style: true,
      className: true,
      events: [
        {
          name: 'onChange',
          template:
            "onChange(event,${extParams}){\n// 倒计时时间变化时触发\nconsole.log('onChange', event);}",
        },
        {
          name: 'onFinish',
          template:
            "onFinish(){\n// 倒计时完成时触发\nconsole.log('onFinish');}",
        },
        {
          name: "onClick",
          template:
            "onClick(event,${extParams}){\n// 点击按钮时的回调\nconsole.log('onClick', event);}",
        },
      ],
    },
  },
};
