import snippets from "./snippets";

export default {
  snippets,
  componentName: "PisellAdjustPrice",
  title: "金额修改",
  category: "数据展示",
  docUrl: "",
  screenshot: "",
  devMode: "proCode",
  npm: {
    package: "@pisell/materials",
    version: "1.0.1",
    exportName: "PisellAdjustPrice",
    main: "src/index.tsx",
    destructuring: true,
    subName: "",
  },
  props: [
    {
      name: 'selectType',
      title: { label: '选择类型', tip: 'selectType | 选择类型' },
      setter: {
        componentName: 'RadioGroupSetter',
        props: {
          options: [
            { title: 'Light', value: 'light' },
            { title: 'Dark', value: 'dark' },
          ],
        },
      },
      defaultValue: 'light',
      extraProps: {
        onChange: (value: string, target: any) => {
          // 根据主题切换自动设置颜色
          const isLight = value === 'light';

          target.getProps().setPropValue('backgroundColor', isLight ? '#ffffff' : 'rgba(0, 0, 0, 0.70)');
          target.getProps().setPropValue('containerBackgroundColor', isLight ? '#d0d5dd' : 'rgba(0, 0, 0, 0.40)');
          target.getProps().setPropValue('buttonBackgroundColor', '#ffffff');
          target.getProps().setPropValue('textColor', "#000000");
          target.getProps().setPropValue('resetButtonBackgroundColor', '#ffffff');
          target.getProps().setPropValue('resetButtonTextColor', "#d92d20");
          target.getProps().setPropValue('doneButtonBackgroundColor', "#4ca30d");
          target.getProps().setPropValue('doneButtonTextColor', "#ffffff");
          target.getProps().setPropValue('isDoneButtonFollowTheme', true);
          target.getProps().setPropValue('isShowMainText', true);
          target.getProps().setPropValue('isShowSubText', true);
          target.getProps().setPropValue('mainTextColor', isLight ? '#101828' : '#ffffff');
          target.getProps().setPropValue('subTextColor', isLight ? '#667085' : '#d0d5dd');
        }
      }
    },
    {
      name: "backgroundColor",
      title: {
        label: "背景色",
        tip: "backgroundColor | 背景色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#ffffff",

    },
    {
      name: "containerBackgroundColor",
      title: {
        label: "容器背景色",
        tip: "containerBackgroundColor | 容器背景色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#d0d5dd",
    },
    {
      name: "buttonBackgroundColor",
      title: {
        label: "按钮背景色",
        tip: "buttonBackgroundColor | 按钮背景色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#ffffff",
    },
    {
      name: "textColor",
      title: {
        label: "文本颜色",
        tip: "textColor | 文本颜色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#000000",
    },
    {
      name: "resetButtonBackgroundColor",
      title: {
        label: "重置按钮背景色",
        tip: "resetButtonBackgroundColor | 重置按钮背景色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#ffffff",
    },
    {
      name: "resetButtonTextColor",
      title: {
        label: "重置按钮文本颜色",
        tip: "resetButtonTextColor | 重置按钮文本颜色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#d92d20",
    },
    {
      name: 'isDoneButtonFollowTheme',
      title: { label: 'Done按钮颜色跟随主题色', tip: 'isDoneButtonFollowTheme | Done按钮颜色跟随主题色' },
      propType: 'bool',
      defaultValue: true,
      setter: 'BoolSetter'
    },
    {
      name: "doneButtonBackgroundColor",
      title: {
        label: "Done按钮背景色",
        tip: "doneButtonBackgroundColor | Done按钮背景色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#4ca30d",
      condition(target: any) {
        return !target.getProps().getPropValue("isDoneButtonFollowTheme");
      },
    },
    {
      name: "doneButtonTextColor",
      title: {
        label: "Done按钮文本颜色",
        tip: "doneButtonTextColor | Done按钮文本颜色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#ffffff",
      condition(target: any) {
        return !target.getProps().getPropValue("isDoneButtonFollowTheme");
      },
    },
    {
      name: 'isShowMainText',
      title: { label: '显示主文案', tip: 'isShowMainText | 显示主文案' },
      propType: 'bool',
      defaultValue: true,
      setter: 'BoolSetter'
    },
    {
      name: "mainTextColor",
      title: {
        label: "主文案颜色",
        tip: "mainTextColor | 主文案颜色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#101828",
      condition(target: any) {
        return target.getProps().getPropValue("isShowMainText");
      },
    },
    {
      name: 'isShowSubText',
      title: { label: '显示副文案', tip: 'isShowSubText | 显示副文案' },
      propType: 'bool',
      defaultValue: true,
      setter: 'BoolSetter'
    },
    {
      name: "subTextColor",
      title: {
        label: "副文案颜色",
        tip: "subTextColor | 副文案颜色",
      },
      propType: "string",
      setter: "ColorSetter",
      defaultValue: "#667085",
      condition(target: any) {
        return target.getProps().getPropValue("isShowSubText");
      },
    },
    {
      name: 'defaultValue',
      title: { label: '默认值', tip: '默认值' },
      propType: 'number',
      setter: 'NumberSetter',
    },
    {
      name: 'max',
      title: { label: '最大值', tip: '最大值' },
      propType: 'number',
      setter: 'NumberSetter',
    },
    {
      name: 'min',
      title: { label: '最小值', tip: '最小值' },
      propType: 'number',
      setter: 'NumberSetter',
    },
    {
      name: 'value',
      title: { label: 'value', tip: 'value' },
      propType: 'number',
      setter: 'NumberSetter',
    },
  ],
  configure: {
    component: { isContainer: true },
    supports: {
      style: true,
      events: [
        {
          name: 'onChange',
          template:
            "onChange(value,${extParams}){\nconsole.log('onChange', value);}",
        },
      ],
    },
  },
};
