textfield.js 908 B

12345678910111213141516171819202122232425262728293031
  1. import _ from 'lodash'
  2. import {baseConfig} from "./base";
  3. import {text} from "../Defaults";
  4. export default function () {
  5. const cc = Ext.form.field.ComboBox.prototype.constructor
  6. const {initComponent} = Ext.form.field.Text.prototype
  7. Ext.form.field.Text.override({
  8. constructor(config) {
  9. const newConfig = _.defaultsDeep({
  10. // 强制属性
  11. }, baseConfig(config, 'col-item'), config, text)
  12. cc.call(this, newConfig)
  13. },
  14. initComponent() {
  15. /**
  16. * 改变必填项之前加星号
  17. */
  18. if (this.allowBlank === false || this.validateBlank === true) {
  19. this.beforeLabelTextTpl = [
  20. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  21. ];
  22. }
  23. initComponent.call(this)
  24. }
  25. });
  26. }