import { t } from "../../src/locale";
import { CComputedSetter, CDefaultValueSetter } from "../_setters";
import componentKey from "../_com-props/componentKey";
import componentName from "../_com-props/componentName";
import snippets from "./snippets";
import { ConditionRenderService } from "../_utils/conditionRenderService";
export default {
  snippets: snippets,
  componentName: 'Typography.Text',
  "group": t('typographyText.key_jnFqOXPdrwvl'),
  title: t('typographyText.key_PA8NkBplsjCA'),
  category: t('typographyText.key_W4klQGYu2IME'),
  props: [componentKey, componentName, {
    name: 'dictionaryKey',
    title: {
      label: t('typographyText.key_kbMeuiEtQtNa'),
      tip: t('typographyText.key_kbMeuiEtQtNb')
    },
    setter: 'DictionarySetter',
    props: {
      type: 'text'
    }
  }, {
    name: 'children',
    title: {
      label: t('typographyText.key_kbMeuiEtQtNq'),
      tip: t('typographyText.key_T0lMb6m2oioH')
    },
    propType: 'string',
    defaultValue: '',
    supportVariable: true
  }, {
    name: 'defaultValue',
    title: {
      label: t('typographyText.key_SROzXrgNf3Ya'),
      tip: t('typographyText.key_eFrnZcYXzg5J')
    },
    propType: 'string',
    defaultValue: '',
    setter: CComputedSetter,
    extraProps: {
      setValue: function setValue(target, value) {
        if (value !== undefined && value !== '') {
          var conditionRenderService = new ConditionRenderService();
          conditionRenderService.load(value.data);
          var exp = conditionRenderService.getConditionExpression();
          target.parent.setPropValue('children', exp);
        }
      }
    }
  }, {
    name: 'openPrecision',
    title: {
      label: t('typographyText.openPrecision'),
      tip: t('typographyText.openPrecisionTip')
    },
    propType: 'bool',
    setter: 'BoolSetter',
    defaultValue: false
  }, {
    name: 'showRule',
    title: t('typographyText.key_7pYhGvcVjrOp'),
    display: 'accordion',
    setter: {
      componentName: 'ObjectSetter',
      props: {
        config: {
          items: [{
            name: 'type',
            title: {
              label: t('typographyText.key_IrNMKZtH0OR6'),
              tip: t('typographyText.key_NlQnbupasWgL')
            },
            mode: 'tag',
            defaultValue: function defaultValue() {
              return 'text';
            },
            setter: {
              componentName: 'SelectSetter',
              props: {
                options: [{
                  title: t('typographyText.key_ko0dyvHsw5P7'),
                  value: 'text'
                }, {
                  title: t('typographyText.key_DUFD2hu1dc7U'),
                  value: 'number'
                }, {
                  title: t('typographyText.key_DUFD2hu1dc8U'),
                  value: 'format'
                }, {
                  title: t('typographyText.key_DUFD2hu1dc9U'),
                  value: 'money'
                }]
              },
              initialValue: 'text'
            }
          }, {
            name: 'startNumber',
            title: {
              label: t('typographyText.key_ThG1wfJfCKwa'),
              tip: t('typographyText.key_WwUtrfrw1ABd')
            },
            setter: {
              componentName: 'NumberSetter',
              props: {
                step: 1,
                min: 0
              }
            },
            condition: function condition(target) {
              var type = target.parent.getPropValue('type');
              return type === 'text';
            }
          }, {
            name: 'endNumber',
            title: {
              label: t('typographyText.key_PYSb3sqgmvBG'),
              tip: t('typographyText.key_hZvNQDuhYhpa')
            },
            setter: {
              componentName: 'NumberSetter',
              props: {
                step: 1,
                min: 0
              }
            },
            condition: function condition(target) {
              var type = target.parent.getPropValue('type');
              return type === 'text';
            }
          }, {
            name: 'ellipsisFlag',
            title: t('typographyText.key_HmuraNC7fGJy'),
            setter: 'StringSetter',
            defaultValue: '...',
            condition: function condition(target) {
              var type = target.parent.getPropValue('type');
              return type === 'text';
            }
          }, {
            name: 'decimals',
            title: {
              label: t('typographyText.key_a0m3CmTLuR1D'),
              tip: t('typographyText.key_ByL1f08ZZZdJ')
            },
            setter: CDefaultValueSetter,
            condition: function condition(target) {
              var type = target.parent.getPropValue('type');
              return type === 'number';
            }
          }, {
            name: 'toFixed',
            title: {
              label: t('typographyText.key_vbwX1NPtg3E1'),
              tip: t('typographyText.key_sZMLtABQA5OS')
            },
            setter: {
              componentName: 'NumberSetter',
              props: {
                step: 1,
                min: 0
              }
            },
            condition: function condition(target) {
              var type = target.parent.getPropValue('type');
              return type === 'number';
            }
          }, {
            name: 'toFixedType',
            title: {
              label: t('typographyText.key_vbwX1NPtg3E2'),
              tip: t('typographyText.key_sZMLtABQA51S')
            },
            defaultValue: 'toFixed',
            setter: {
              componentName: 'SelectSetter',
              props: {
                options: [{
                  title: t('typographyText.key_vbwX1NPtg3E3'),
                  value: 'toFixed'
                }, {
                  title: t('typographyText.key_vbwX1NPtg3E4'),
                  value: 'ceil'
                }, {
                  title: t('typographyText.key_vbwX1NPtg3E5'),
                  value: 'floor'
                }]
              }
            },
            condition: function condition(target) {
              var type = target.parent.getPropValue('type');
              var toFixed = target.parent.getPropValue('toFixed');
              return type === 'number' && toFixed > -1;
            }
          }, {
            name: 'formatType',
            title: {
              label: t('typographyText.key_abwX1NPtg3E2'),
              tip: t('typographyText.key_abwX1NPtg3E2')
            },
            defaultValue: 'YYYY-MM-DD',
            setter: {
              componentName: 'SelectSetter',
              props: {
                options: [{
                  title: 'YYYY-MM-DD',
                  value: 'YYYY-MM-DD'
                }, {
                  title: 'HH:mm:ss',
                  value: 'HH:mm:ss'
                }, {
                  title: 'YYYY-MM-DD HH:mm:ss',
                  value: 'YYYY-MM-DD HH:mm:ss'
                }]
              }
            },
            condition: function condition(target) {
              var type = target.parent.getPropValue('type');
              return type === 'format';
            }
          }, {
            name: 'moneySliptFlag',
            title: t('typographyText.key_HmuraNC7fGJv'),
            setter: 'StringSetter',
            defaultValue: ',',
            condition: function condition(target) {
              var type = target.parent.getPropValue('type');
              return type === 'money';
            }
          }]
        }
      }
    }
  }, {
    name: "openComplement",
    title: {
      label: t("typographyText.key_vbwX1NPtg3dc"),
      tip: t("typographyText.key_G9PHuqoCi5Cv")
    },
    propType: "bool",
    setter: "BoolSetter",
    defaultValue: false
  }, {
    name: 'complementBit',
    title: t("typographyText.key_vbwX1NPtg3vi"),
    propType: "number",
    defaultValue: 0,
    setter: 'NumberSetter',
    condition: function condition(target) {
      var type = target.parent.getPropValue('openComplement');
      return type;
    }
  }, {
    name: 'complementCharacter',
    title: t("typographyText.key_vbwX1NPtg3vc"),
    propType: "string",
    setter: "StringSetter",
    defaultValue: '',
    condition: function condition(target) {
      var type = target.parent.getPropValue('openComplement');
      return type;
    }
  }, {
    name: 'delete',
    title: {
      label: t('typographyText.key_ULJNgynvNMah'),
      tip: t('typographyText.key_zRt2VDrRgzqv')
    },
    propType: 'bool',
    defaultValue: false
  }, {
    name: 'underline',
    title: {
      label: t('typographyText.key_nrKd6UC0aVCo'),
      tip: t('typographyText.key_Y9h0ffD5CMLB')
    },
    propType: 'bool',
    defaultValue: false
  }, {
    name: 'strong',
    title: {
      label: t('typographyText.key_ZvzHDoyHyXKA'),
      tip: t('typographyText.key_K5yr16dFLnAY')
    },
    propType: 'bool',
    defaultValue: false
  }],
  configure: {
    supports: {
      events: false,
      style: true,
      "loop": false,
      "condition": false
    }
  }
};