소스 검색

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/controls/input/search.js
luoyifan 3 년 전
부모
커밋
912ce169d7

+ 20 - 0
src/Defaults.ts

@@ -26,6 +26,26 @@ export const numberfield = {
     labelWidth: 70,
 }
 
+export const checkbox = {
+    labelAlign: 'right',
+    labelWidth: 70,
+}
+
+export const checkboxgroup = {
+    labelAlign: 'right',
+    labelWidth: 70,
+}
+
+export const radio = {
+    labelAlign: 'right',
+    labelWidth: 70,
+}
+
+export const radiogroup = {
+    labelAlign: 'right',
+    labelWidth: 70,
+}
+
 export const grid = {
     border: true,
     columnLines: true,

+ 106 - 0
src/PropertyDescription.ts

@@ -0,0 +1,106 @@
+import _ from 'lodash'
+
+export type GroupType = 'css' | 'data' | 'bind' | 'common' | 'event'
+
+export interface PropertyValue {
+  /**
+   * 属性名
+   */
+  name: string
+
+  /**
+   * 默认值
+   */
+  default: any
+
+  /**
+   * 隶属分组
+   */
+  group: GroupType
+
+  /**
+   * 描述
+   */
+  desc: string
+
+  /**
+   * 取值范围
+   */
+  type:
+    | 'boolean'
+    | 'number'
+    | 'string'
+    | 'object'
+    | 'dataSource'
+    | 'valid'
+    | 'format'
+    | Array<string>
+    | 'widget'
+
+  eventParamter?: string[]
+
+  eventResult?: string
+
+  eventDoc?:(vjson:any)=>string
+
+  expr?: boolean,
+}
+
+export interface EventValue {
+  /**
+   * 属性名
+   */
+  name: string
+
+  /**
+   * 描述
+   */
+  desc: string
+}
+
+export interface PropertyDescriptionInterface {
+  props: PropertyValue[]
+  events?: EventValue[]
+}
+
+export class PropertyDescription {
+  propertyes: PropertyDescriptionInterface = {
+    props: [],
+    events: []
+  }
+
+  constructor(...args: PropertyDescriptionInterface[]) {
+    _.each(args, arg => {
+      this.merge(arg)
+    })
+  }
+
+  merge(pd: PropertyDescriptionInterface) {
+    this.propertyes.props = <any>(
+      _.uniqBy([...this.propertyes.props, ...pd.props], 'name')
+    )
+    if (pd.events) {
+      if (this.propertyes.events) {
+        this.propertyes.events = <any>(
+          _.uniqBy([...this.propertyes.events, ...pd.events], 'name')
+        )
+      } else {
+        this.propertyes.events = <any>_.uniqBy([...pd.events], 'name')
+      }
+    }
+  }
+
+  /**
+   * 根据分组名 获取属性定义
+   */
+  getPropsByGroup(name: GroupType): PropertyValue[] {
+    return _.filter(this.propertyes.props, i => i.group === name)
+  }
+
+  /**
+   * 获取全部事件
+   */
+  getEvents(): EventValue[] {
+    return this.propertyes.events!
+  }
+}

+ 488 - 0
src/PropertyDescriptionTable.ts

@@ -0,0 +1,488 @@
+import _ from 'lodash'
+import {PropertyDescription, PropertyDescriptionInterface, PropertyValue} from './PropertyDescription'
+
+export const PropertyDescriptionTable = new Map<String, PropertyDescription>()
+
+PropertyDescriptionTable.set(
+    'tabCell',
+    new PropertyDescription({
+        props: [
+            {
+                name: 'header',
+                default: '',
+                group: 'common',
+                desc: '选项卡名称',
+                type: 'string'
+            },
+            {
+                name: 'close',
+                default: '',
+                group: 'common',
+                desc: '是否允许关闭',
+                type: 'boolean'
+            },
+        ]
+    })
+)
+
+export const width: PropertyValue = {
+    name: 'width',
+    default: '',
+    group: 'common',
+    desc: '宽',
+    type: 'number'
+}
+
+export const height: PropertyValue = {
+    name: 'height',
+    default: '',
+    group: 'common',
+    desc: '高',
+    type: 'number'
+}
+
+export const fieldLabel: PropertyValue = {
+    name: 'fieldLabel',
+    default: '',
+    group: 'common',
+    desc: '文本描述',
+    type: 'string',
+    expr: true,
+};
+export const borderless: PropertyValue = {
+    name: 'borderless',
+    default: '',
+    group: 'css',
+    desc: '是否有边框',
+    type: 'boolean',
+};
+export const labelAlign: PropertyValue = {
+    name: 'labelAlign',
+    default: '',
+    group: 'common',
+    desc: '描述对齐方式',
+    type: ['left', 'right', 'center']
+};
+export const type: PropertyValue = {
+    name: 'type',
+    default: '',
+    group: 'css',
+    desc: '容器内部线类型',
+    type: ['line', 'clean', 'wide', 'space', 'form']
+};
+export const labelWidth: PropertyValue = {
+    name: 'labelWidth',
+    default: undefined,
+    group: 'common',
+    desc: '文本宽度',
+    type: 'number'
+};
+export const gravity: PropertyValue = {
+    name: 'gravity',
+    default: 1,
+    group: 'common',
+    desc: '占位权重',
+    type: 'number'
+};
+export const hidden: PropertyValue = {
+    name: 'hidden',
+    default: false,
+    group: 'common',
+    desc: '隐藏',
+    type: 'boolean',
+    expr: true,
+};
+export const readonly: PropertyValue = {
+    name: 'readonly',
+    default: false,
+    group: 'common',
+    desc: '只读',
+    type: 'boolean',
+    expr: true,
+};
+export const disabled: PropertyValue = {
+    name: 'disabled',
+    default: false,
+    group: 'common',
+    desc: '禁用',
+    type: 'boolean',
+    expr: true,
+};
+export const loading: PropertyValue = {
+    name: 'loading',
+    default: false,
+    group: 'common',
+    desc: '载入中',
+    type: 'boolean',
+    expr: true,
+};
+export const required: PropertyValue = {
+    name: 'required',
+    default: false,
+    group: 'common',
+    desc: '必填',
+    type: 'boolean',
+    expr: true,
+};
+export const value: PropertyValue = {
+    name: 'value',
+    default: '',
+    group: 'common',
+    desc: '字段值',
+    type: 'string',
+    expr: true,
+};
+export const prompt: PropertyValue = {
+    name: 'prompt',
+    default: '请输入',
+    group: 'common',
+    desc: '水印',
+    type: 'string'
+};
+export const validType: PropertyValue = {
+    name: 'validType',
+    default: '',
+    group: 'common',
+    desc: '校验类型',
+    type: 'valid'
+};
+export const metaId: PropertyValue = {
+    name: 'metaId',
+    default: '',
+    group: 'bind',
+    desc: '元数据ID',
+    type: 'string'
+};
+export const template: PropertyValue = {
+    name: 'template',
+    default: '',
+    group: 'common',
+    desc: 'HTML内容',
+    type: 'string',
+    expr: true,
+}
+
+export const tooltip: PropertyValue = {
+    name: 'tooltip',
+    default: '',
+    group: 'common',
+    desc: '悬停提示',
+    type: 'string'
+}
+
+export const onClick: PropertyValue = {
+    name: 'onClick',
+    default: '',
+    group: 'event',
+    desc: '点击事件',
+    eventParamter: [
+        'sender: YvanUI.CtlButton',
+        'e: any'
+    ],
+    eventDoc(vjson) {
+        return (vjson['text'] ? vjson['text'] : '按钮') + '被点击后触发';
+    },
+    type: 'string'
+}
+
+PropertyDescriptionTable.set(
+    'rows',
+    new PropertyDescription({
+        props: [
+            gravity,
+            width
+        ]
+    })
+)
+
+PropertyDescriptionTable.set(
+    'cols',
+    new PropertyDescription({
+        props: [
+            gravity,
+            height
+        ]
+    })
+)
+
+PropertyDescriptionTable.set(
+    'window',
+    new PropertyDescription({
+        props: [
+            {
+                name: '_designMode',
+                default: 'module',
+                group: 'common',
+                desc: '设计类型',
+                type: ['none', 'dialog', 'scroll-dialog']
+            },
+            {
+                name: 'title',
+                default: '',
+                group: 'common',
+                desc: '对话框标题',
+                type: 'string'
+            },
+            {
+                name: 'modal',
+                default: '',
+                group: 'common',
+                desc: '是否模态',
+                type: 'boolean'
+            },
+            _.merge(_.cloneDeep(width), {default: 200}),
+            _.merge(_.cloneDeep(height), {default: 200}),
+            {
+                name: 'top',
+                default: 200,
+                group: 'common',
+                desc: '顶像素',
+                type: 'number'
+            },
+            {
+                name: 'left',
+                default: 200,
+                group: 'common',
+                desc: '左像素',
+                type: 'number'
+            }
+        ]
+    })
+)
+
+PropertyDescriptionTable.set(
+    'layout',
+    new PropertyDescription({
+        props: [
+            {
+                name: 'borderless',
+                default: true,
+                group: 'css',
+                desc: '有无边框',
+                type: 'boolean'
+            },
+            {
+                name: 'type',
+                default: '',
+                group: 'css',
+                desc: '布局类型',
+                type: ['line', 'clean', 'wide', 'space', 'form']
+            },
+            {
+                name: '_designMode',
+                default: 'module',
+                group: 'common',
+                desc: '设计类型',
+                type: ['none', 'module', 'scroll-module']
+            }
+        ]
+    })
+)
+
+export const YvBase: PropertyDescriptionInterface = {
+    props: [
+        {
+            name: 'bind',
+            default: '',
+            group: 'bind',
+            desc: '实体类名',
+            type: 'string'
+        },
+        {
+            name: 'ref',
+            default: '',
+            group: 'bind',
+            desc: '控件名',
+            type: 'string'
+        },
+        {
+            name: 'css',
+            default: '',
+            group: 'css',
+            desc: '样式类名',
+            type: 'string'
+        },
+        {
+            name: 'hidden',
+            default: true,
+            group: 'common',
+            desc: '是否显示',
+            type: 'boolean'
+        },
+        {
+            name: 'padding',
+            default: undefined,
+            group: 'css',
+            desc: '内边距',
+            type: 'object'
+        },
+        {
+            name: 'margin',
+            default: undefined,
+            group: 'css',
+            desc: '外边距',
+            type: 'object'
+        },
+        {
+            name: 'ff',
+            default: 0,
+            group: 'common',
+            desc: '自动定焦时间',
+            type: 'number'
+        },
+        width, height,
+        {
+            name: 'autowidth',
+            default: false,
+            group: 'common',
+            desc: '自动计算宽度',
+            type: 'boolean'
+        },
+        {
+            name: 'autoheight',
+            default: false,
+            group: 'common',
+            desc: '自动计算高度',
+            type: 'boolean'
+        },
+    ],
+    events: [
+        {name: 'onRender', desc: '第一次控件被渲染时触发'}
+    ]
+}
+
+export const YvDataSource: PropertyDescriptionInterface = {
+    props: [
+        {
+            name: 'type',
+            default: '',
+            group: 'data',
+            desc: '数据源类型',
+            type: 'dataSource'
+        }
+    ],
+    events: [{name: 'onDataComplete', desc: '数据绑定完成后触发'}]
+}
+
+PropertyDescriptionTable.set(
+    'template',
+    new PropertyDescription(YvBase, {
+        props: [
+            template
+        ]
+    })
+)
+
+PropertyDescriptionTable.set(
+    'fieldset',
+    new PropertyDescription(YvBase, {
+        props: [
+            {
+                name: 'label',
+                default: '',
+                group: 'common',
+                desc: '字段组标题',
+                type: 'string'
+            }
+        ]
+    })
+)
+
+PropertyDescriptionTable.set(
+    'iframe',
+    new PropertyDescription(YvBase, {
+        props: [
+            {
+                name: 'src',
+                default: '',
+                group: 'common',
+                desc: '地址路径',
+                type: 'string'
+            }
+        ]
+    })
+)
+
+PropertyDescriptionTable.set(
+    'uploader',
+    new PropertyDescription(YvBase, {
+        props: [
+            width, height,
+            {
+                name: 'value',
+                default: '上传',
+                group: 'common',
+                desc: '文本描述',
+                type: 'string'
+            },
+            {
+                name: 'upload',
+                default: '/upload',
+                group: 'common',
+                desc: '上传地址',
+                type: 'string'
+            },
+        ],
+        events: [
+            {name: 'onFileUpload', desc: '文件上传成功结束时触发'},
+            {name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发'},
+        ]
+    })
+)
+
+PropertyDescriptionTable.set(
+    'viewer',
+    new PropertyDescription(YvBase, {
+        props: [
+            value,
+            gravity,
+            {
+                name: 'imgWidth',
+                default: '',
+                group: 'common',
+                desc: '图片宽',
+                type: 'string'
+            },
+            {
+                name: 'imgHeight',
+                default: '',
+                group: 'common',
+                desc: '图片高',
+                type: 'string'
+            }
+        ]
+    })
+)
+
+PropertyDescriptionTable.set(
+    'image',
+    new PropertyDescription(YvBase, {
+        props: [
+            value,
+            gravity,
+            {
+                name: 'imgWidth',
+                default: '',
+                group: 'common',
+                desc: '图片宽',
+                type: 'string'
+            },
+            {
+                name: 'imgHeight',
+                default: '',
+                group: 'common',
+                desc: '图片高',
+                type: 'string'
+            }
+        ]
+    })
+)
+
+PropertyDescriptionTable.set(
+    'scrollview',
+    new PropertyDescription(YvBase, {
+        props: [
+            width, height
+        ]
+    })
+)

+ 30 - 10
src/controls/button.js

@@ -2,16 +2,36 @@ import _ from 'lodash'
 import $ from 'jquery'
 import {baseConfig} from "./base";
 import {button} from "../Defaults";
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../PropertyDescriptionTable";
+import {PropertyDescription} from "../PropertyDescription";
 
 export default function () {
-  /**
-   *
-   */
-  const ct = Ext.button.Button.prototype.constructor
-  Ext.button.Button.override({
-    constructor: function (config) {
-      const newConfig = _.defaultsDeep({}, config, baseConfig(config, "col-item"), button)
-      ct.call(this, newConfig)
-    }
-  });
+    /**
+     *
+     */
+    const ct = Ext.button.Button.prototype.constructor
+    Ext.button.Button.override({
+        constructor: function (config) {
+            const newConfig = _.defaultsDeep({}, config, baseConfig(config, "col-item"), button)
+            ct.call(this, newConfig)
+        }
+    });
+
+    PropertyDescriptionTable.set(
+        'button',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
 }

+ 21 - 0
src/controls/grid.js

@@ -4,6 +4,16 @@ import {baseConfig} from "./base";
 import {lookupFn, lookupScope} from "../lib/lib";
 import {serverInvokeUrlTransform} from "../lib/config";
 import {calcObject} from "../lib/systemLib";
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../PropertyDescriptionTable";
+import {PropertyDescription} from "../PropertyDescription";
 
 export default function () {
 
@@ -254,6 +264,17 @@ export default function () {
         //     dataSourceReload(this)
         // },
     })
+
+
+    PropertyDescriptionTable.set(
+        'yvgrid',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
 }
 
 /**

+ 44 - 0
src/controls/input/checkbox.js

@@ -0,0 +1,44 @@
+import _ from 'lodash'
+import {baseConfig} from "../base";
+import {checkbox} from "../../Defaults";
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../../PropertyDescriptionTable";
+import {PropertyDescription} from "../../PropertyDescription";
+
+export default function () {
+
+    const cc = Ext.form.field.Checkbox.prototype.constructor
+    const {initComponent} = Ext.form.field.Checkbox.prototype
+    Ext.form.field.Checkbox.override({
+        constructor(config) {
+            const newConfig = _.defaultsDeep({
+                // 强制属性
+
+            }, baseConfig(config, 'col-item'), config, checkbox)
+
+            cc.call(this, newConfig)
+        },
+
+        initComponent() {
+            initComponent.call(this)
+        },
+    });
+
+    PropertyDescriptionTable.set(
+        'checkbox',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
+
+}

+ 44 - 0
src/controls/input/checkboxgroup.js

@@ -0,0 +1,44 @@
+import _ from 'lodash'
+import {baseConfig} from "../base";
+import {checkboxgroup} from "../../Defaults";
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../../PropertyDescriptionTable";
+import {PropertyDescription} from "../../PropertyDescription";
+
+export default function () {
+
+    const cc = Ext.form.CheckboxGroup.prototype.constructor
+    const {initComponent} = Ext.form.CheckboxGroup.prototype
+    Ext.form.CheckboxGroup.override({
+        constructor(config) {
+            const newConfig = _.defaultsDeep({
+                // 强制属性
+
+            }, baseConfig(config, 'col-item'), config, checkboxgroup)
+
+            cc.call(this, newConfig)
+        },
+
+        initComponent() {
+            initComponent.call(this)
+        },
+    });
+
+    PropertyDescriptionTable.set(
+        'checkboxgroup',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
+
+}

+ 21 - 0
src/controls/input/combo.js

@@ -2,6 +2,16 @@ import _ from 'lodash'
 import {combo} from '../../Defaults'
 import {baseConfig} from "../base";
 import {dataSourceReload} from "../../DataSourceHelper";
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../../PropertyDescriptionTable";
+import {PropertyDescription} from "../../PropertyDescription";
 
 export default function () {
     const cc = Ext.form.field.ComboBox.prototype.constructor
@@ -106,4 +116,15 @@ export default function () {
         },
 
     });
+
+    PropertyDescriptionTable.set(
+        'combo',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
+
 }

+ 21 - 0
src/controls/input/datefield.js

@@ -2,6 +2,16 @@ import _ from 'lodash'
 import {baseConfig} from "../base";
 import {date} from "../../Defaults";
 import {dataSourceReload} from "../../DataSourceHelper";
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../../PropertyDescriptionTable";
+import {PropertyDescription} from "../../PropertyDescription";
 
 export default function () {
 
@@ -61,4 +71,15 @@ export default function () {
             initComponent.call(this)
         },
     });
+
+    PropertyDescriptionTable.set(
+        'datefield',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
+
 }

+ 21 - 0
src/controls/input/numberfield.js

@@ -1,6 +1,16 @@
 import _ from 'lodash'
 import {baseConfig} from "../base";
 import {numberfield} from "../../Defaults";
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../../PropertyDescriptionTable";
+import {PropertyDescription} from "../../PropertyDescription";
 
 export default function () {
 
@@ -20,4 +30,15 @@ export default function () {
             initComponent.call(this)
         },
     });
+
+    PropertyDescriptionTable.set(
+        'numberfield',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
+
 }

+ 44 - 0
src/controls/input/radio.js

@@ -0,0 +1,44 @@
+import _ from 'lodash'
+import {baseConfig} from "../base";
+import {radio} from "../../Defaults";
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../../PropertyDescriptionTable";
+import {PropertyDescription} from "../../PropertyDescription";
+
+export default function () {
+
+    const cc = Ext.form.field.Radio.prototype.constructor
+    const {initComponent} = Ext.form.field.Radio.prototype
+    Ext.form.field.Radio.override({
+        constructor(config) {
+            const newConfig = _.defaultsDeep({
+                // 强制属性
+
+            }, baseConfig(config, 'col-item'), config, radio)
+
+            cc.call(this, newConfig)
+        },
+
+        initComponent() {
+            initComponent.call(this)
+        },
+    });
+
+    PropertyDescriptionTable.set(
+        'radio',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
+
+}

+ 44 - 0
src/controls/input/radiogroup.js

@@ -0,0 +1,44 @@
+import _ from 'lodash'
+import {baseConfig} from "../base";
+import {radiogroup} from "../../Defaults";
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../../PropertyDescriptionTable";
+import {PropertyDescription} from "../../PropertyDescription";
+
+export default function () {
+
+    const cc = Ext.form.RadioGroup.prototype.constructor
+    const {initComponent} = Ext.form.RadioGroup.prototype
+    Ext.form.RadioGroup.override({
+        constructor(config) {
+            const newConfig = _.defaultsDeep({
+                // 强制属性
+
+            }, baseConfig(config, 'col-item'), config, radiogroup)
+
+            cc.call(this, newConfig)
+        },
+
+        initComponent() {
+            initComponent.call(this)
+        },
+    });
+
+    PropertyDescriptionTable.set(
+        'radiogroup',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
+
+}

+ 21 - 1
src/controls/input/search.js

@@ -3,6 +3,16 @@ import {baseConfig} from "../base";
 import {search} from "../../Defaults";
 import {invokeMethod} from '../../utils'
 import {clearViewModelByLookup, showWidget, stopEvent} from "../../lib/systemLib"
+import {
+    disabled,
+    fieldLabel,
+    gravity, height, metaId,
+    PropertyDescriptionTable,
+    tooltip,
+    value, width,
+    YvBase
+} from "../../PropertyDescriptionTable";
+import {PropertyDescription} from "../../PropertyDescription";
 
 export default function () {
 
@@ -120,4 +130,14 @@ export default function () {
             clearViewModelByLookup(sender, lookup)
         }
     });
-}
+}
+
+PropertyDescriptionTable.set(
+    'searchfield',
+    new PropertyDescription(YvBase, {
+        props: [
+            fieldLabel, value, disabled,
+            gravity, tooltip, metaId, width, height
+        ],
+    })
+)

+ 13 - 0
src/controls/input/textfield.js

@@ -1,6 +1,8 @@
 import _ from 'lodash'
 import {baseConfig} from "../base";
 import {text} from "../../Defaults";
+import {PropertyDescriptionTable, YvBase, fieldLabel, value, disabled, gravity, tooltip, metaId, width, height} from "../../PropertyDescriptionTable";
+import {PropertyDescription} from "../../PropertyDescription";
 
 export default function () {
 
@@ -67,4 +69,15 @@ export default function () {
             initComponent.call(this)
         }
     });
+
+    PropertyDescriptionTable.set(
+        'textfield',
+        new PropertyDescription(YvBase, {
+            props: [
+                fieldLabel, value, disabled,
+                gravity, tooltip, metaId, width, height
+            ],
+        })
+    )
+
 }

+ 3 - 1
src/index.ts

@@ -6,6 +6,7 @@ import jquery from 'jquery'
 import json5 from 'json5'
 import moment from 'moment'
 import './wotu-ui.css'
+import {PropertyDescriptionTable} from './PropertyDescriptionTable'
 
 export {
     axios,
@@ -14,7 +15,8 @@ export {
     jquery,
     json5,
     moment,
-    Defaults
+    Defaults,
+    PropertyDescriptionTable
 }
 
 export * from './message'

+ 8 - 0
src/init.ts

@@ -10,6 +10,10 @@ import initCombo from './controls/input/combo'
 import initSearch from './controls/input/search'
 import initDate from './controls/input/datefield'
 import initNumber from './controls/input/numberfield'
+import initCheckbox from './controls/input/checkbox'
+import initCheckboxGroup from './controls/input/checkboxgroup'
+import initRadio from './controls/input/radio'
+import initRadioGroup from './controls/input/radiogroup'
 import initRows from './controls/rows'
 import initCols from './controls/cols'
 import initButton from './controls/button'
@@ -112,4 +116,8 @@ export function init() {
     initSearch()
     initDate()
     initNumber()
+    initCheckbox()
+    initCheckboxGroup()
+    initRadio()
+    initRadioGroup()
 }

+ 2 - 2
src/lib/systemLib.ts

@@ -294,7 +294,7 @@ export function setComboStore(sender, config, getDictFn, bizKey) {
             if (sender.rendered) {
                 // 已经渲染出来了, 用方法进行修改
                 const editor = sender.getEditor()
-                if (editor.xtype === 'combo') {
+                if (editor && editor.xtype === 'combo') {
                     const valueField = r.field[0]
                     const displayField = r.field[1]
                     editor.valueField = valueField
@@ -322,7 +322,7 @@ export function setComboStore(sender, config, getDictFn, bizKey) {
                 const displayField = r.field[1]
                 _.each(r.data, row => {
                     // 从 valueField 找到要显示的 displayField
-                    if (row[valueField] === value) {
+                    if (row[valueField] == value) {
                         value = row[displayField]
                         return false
                     }